diff --git a/demo/demo.c b/demo/demo.c index a2c2fd1..1bd294e 100644 --- a/demo/demo.c +++ b/demo/demo.c @@ -434,7 +434,7 @@ demo_window(struct zr_context *ctx) zr_menubar_begin(ctx); zr_layout_row_begin(ctx, ZR_STATIC, 25, 2); zr_layout_row_push(ctx, 45); - if (zr_menu_text_begin(ctx, &menu, "MENU", 120)) + if (zr_menu_text_begin(ctx, &menu, "MENU", ZR_TEXT_DEFAULT_LEFT, 120)) { static size_t prog = 40; static int slider = 10; diff --git a/zahnrad.c b/zahnrad.c index dd768b7..9f43230 100644 --- a/zahnrad.c +++ b/zahnrad.c @@ -12123,7 +12123,7 @@ zr_menu_begin(struct zr_panel *layout, struct zr_context *ctx, struct zr_window int zr_menu_text_begin(struct zr_context *ctx, struct zr_panel *layout, - const char *title, float width) + const char *title, zr_flags align, float width) { struct zr_window *win; const struct zr_input *in; @@ -12150,7 +12150,7 @@ zr_menu_text_begin(struct zr_context *ctx, struct zr_panel *layout, button.base.border = ctx->style.colors[ZR_COLOR_WINDOW]; button.base.normal = ctx->style.colors[ZR_COLOR_WINDOW]; button.base.active = ctx->style.colors[ZR_COLOR_WINDOW]; - button.alignment = ZR_TEXT_CENTERED|ZR_TEXT_MIDDLE; + button.alignment = align; button.normal = ctx->style.colors[ZR_COLOR_TEXT]; button.active = ctx->style.colors[ZR_COLOR_TEXT]; button.hover = ctx->style.colors[ZR_COLOR_TEXT]; diff --git a/zahnrad.h b/zahnrad.h index 6b12a18..b4360e8 100644 --- a/zahnrad.h +++ b/zahnrad.h @@ -1377,8 +1377,14 @@ enum zr_text_align { /* text is aligned to the top (Y-axis)*/ ZR_TEXT_MIDDLE = 0x10, /* text is aligned to the middle (Y-axis) */ - ZR_TEXT_BOTTOM = 0x20 + ZR_TEXT_BOTTOM = 0x20, /* text is aligned to the bottom (Y-axis)*/ + ZR_TEXT_DEFAULT_CENTER = ZR_TEXT_CENTERED|ZR_TEXT_MIDDLE, + /* default center alignment with text centered both in X-and Y-axis */ + ZR_TEXT_DEFAULT_LEFT = ZR_TEXT_LEFT|ZR_TEXT_MIDDLE, + /* default left alignment with text centered left in X-and and center Y-axis */ + ZR_TEXT_DEFAULT_RIGHT = ZR_TEXT_RIGHT|ZR_TEXT_MIDDLE + /* default right alignment with text centered right in X-and and center Y-axis */ }; enum zr_button_behavior { @@ -1954,7 +1960,8 @@ void zr_tooltip_end(struct zr_context*); void zr_menubar_begin(struct zr_context*); void zr_menubar_end(struct zr_context*); -int zr_menu_text_begin(struct zr_context*, struct zr_panel*, const char*, float width); +int zr_menu_text_begin(struct zr_context*, struct zr_panel*, const char*, + zr_flags, float width); int zr_menu_icon_begin(struct zr_context*, struct zr_panel*, const char*, struct zr_image, float width); int zr_menu_symbol_begin(struct zr_context*, struct zr_panel*, const char*,