Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nk_draw_button_text_* to use nk_flags align passed from nk_menu_item_image_text etc #551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/nuklear_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/nuklear_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down