property: Allow optional labels for properties with #
This commit is contained in:
parent
31b5729d66
commit
7ddbe5cd52
@ -28180,7 +28180,9 @@ nk_draw_property(struct nk_command_buffer *out, const struct nk_style_property *
|
||||
|
||||
/* draw label */
|
||||
text.padding = nk_vec2(0,0);
|
||||
if (name && name[0] != '#') {
|
||||
nk_widget_text(out, *label, name, len, &text, NK_TEXT_CENTERED, font);
|
||||
}
|
||||
}
|
||||
NK_LIB void
|
||||
nk_do_property(nk_flags *ws,
|
||||
@ -28198,7 +28200,7 @@ nk_do_property(nk_flags *ws,
|
||||
nk_filter_float
|
||||
};
|
||||
nk_bool active, old;
|
||||
int num_len = 0, name_len;
|
||||
int num_len = 0, name_len = 0;
|
||||
char string[NK_MAX_NUMBER_BUFFER];
|
||||
float size;
|
||||
|
||||
@ -28218,7 +28220,9 @@ nk_do_property(nk_flags *ws,
|
||||
left.y = property.y + style->border + property.h/2.0f - left.h/2;
|
||||
|
||||
/* text label */
|
||||
if (name && name[0] != '#') {
|
||||
name_len = nk_strlen(name);
|
||||
}
|
||||
size = font->width(font->userdata, font->height, name, name_len);
|
||||
label.x = left.x + left.w + style->padding.x;
|
||||
label.w = (float)size + 2 * style->padding.x;
|
||||
|
@ -106,7 +106,9 @@ nk_draw_property(struct nk_command_buffer *out, const struct nk_style_property *
|
||||
|
||||
/* draw label */
|
||||
text.padding = nk_vec2(0,0);
|
||||
if (name && name[0] != '#') {
|
||||
nk_widget_text(out, *label, name, len, &text, NK_TEXT_CENTERED, font);
|
||||
}
|
||||
}
|
||||
NK_LIB void
|
||||
nk_do_property(nk_flags *ws,
|
||||
@ -124,7 +126,7 @@ nk_do_property(nk_flags *ws,
|
||||
nk_filter_float
|
||||
};
|
||||
nk_bool active, old;
|
||||
int num_len = 0, name_len;
|
||||
int num_len = 0, name_len = 0;
|
||||
char string[NK_MAX_NUMBER_BUFFER];
|
||||
float size;
|
||||
|
||||
@ -144,7 +146,9 @@ nk_do_property(nk_flags *ws,
|
||||
left.y = property.y + style->border + property.h/2.0f - left.h/2;
|
||||
|
||||
/* text label */
|
||||
if (name && name[0] != '#') {
|
||||
name_len = nk_strlen(name);
|
||||
}
|
||||
size = font->width(font->userdata, font->height, name, name_len);
|
||||
label.x = left.x + left.w + style->padding.x;
|
||||
label.w = (float)size + 2 * style->padding.x;
|
||||
|
Loading…
Reference in New Issue
Block a user