add nk_flags alignment to draw_button_text_* functions as the flags was not being used for the text

This commit is contained in:
Robin 2023-03-06 17:20:57 +01:00
parent 25b84d101d
commit 21e3c4df7b
2 changed files with 8 additions and 8 deletions

View File

@ -268,7 +268,7 @@ nk_draw_button_text_symbol(struct nk_command_buffer *out,
const struct nk_rect *bounds, const struct nk_rect *label,
const struct nk_rect *symbol, nk_flags state, const struct nk_style_button *style,
const char *str, int len, enum nk_symbol_type type,
const struct nk_user_font *font)
const struct nk_user_font *font, nk_flags align)
{
struct nk_color sym;
struct nk_text text;
@ -294,7 +294,7 @@ nk_draw_button_text_symbol(struct nk_command_buffer *out,
text.padding = nk_vec2(0,0);
nk_draw_symbol(out, type, *symbol, style->text_background, sym, 0, font);
nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font);
nk_widget_text(out, *label, str, len, &text, align, font);
}
NK_LIB nk_bool
nk_do_button_text_symbol(nk_flags *state,
@ -324,7 +324,7 @@ nk_do_button_text_symbol(nk_flags *state,
/* draw button */
if (style->draw_begin) style->draw_begin(out, style->userdata);
nk_draw_button_text_symbol(out, &bounds, &content, &tri,
*state, style, str, len, symbol, font);
*state, style, str, len, symbol, font, align);
if (style->draw_end) style->draw_end(out, style->userdata);
return ret;
}
@ -333,7 +333,7 @@ nk_draw_button_text_image(struct nk_command_buffer *out,
const struct nk_rect *bounds, const struct nk_rect *label,
const struct nk_rect *image, nk_flags state, const struct nk_style_button *style,
const char *str, int len, const struct nk_user_font *font,
const struct nk_image *img)
const struct nk_image *img, nk_flags align)
{
struct nk_text text;
const struct nk_style_item *background;
@ -350,7 +350,7 @@ nk_draw_button_text_image(struct nk_command_buffer *out,
else text.text = style->text_normal;
text.padding = nk_vec2(0,0);
nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font);
nk_widget_text(out, *label, str, len, &text, align, font);
nk_draw_image(out, *image, img, nk_white);
}
NK_LIB nk_bool
@ -385,7 +385,7 @@ nk_do_button_text_image(nk_flags *state,
icon.h -= 2 * style->image_padding.y;
if (style->draw_begin) style->draw_begin(out, style->userdata);
nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img);
nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img, align);
if (style->draw_end) style->draw_end(out, style->userdata);
return ret;
}

View File

@ -244,9 +244,9 @@ NK_LIB void nk_draw_button_symbol(struct nk_command_buffer *out, const struct nk
NK_LIB nk_bool nk_do_button_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, enum nk_symbol_type symbol, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_input *in, const struct nk_user_font *font);
NK_LIB void nk_draw_button_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *content, nk_flags state, const struct nk_style_button *style, const struct nk_image *img);
NK_LIB nk_bool nk_do_button_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, enum nk_button_behavior b, const struct nk_style_button *style, const struct nk_input *in);
NK_LIB void nk_draw_button_text_symbol(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *symbol, nk_flags state, const struct nk_style_button *style, const char *str, int len, enum nk_symbol_type type, const struct nk_user_font *font);
NK_LIB void nk_draw_button_text_symbol(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *symbol, nk_flags state, const struct nk_style_button *style, const char *str, int len, enum nk_symbol_type type, const struct nk_user_font *font, nk_flags align);
NK_LIB nk_bool nk_do_button_text_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, enum nk_symbol_type symbol, const char *str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in);
NK_LIB void nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, const struct nk_image *img);
NK_LIB void nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, const struct nk_image *img, nk_flags align);
NK_LIB nk_bool nk_do_button_text_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, const char* str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in);
/* toggle */