Fixed edit multiline widget width calculation

pull/277/head
vurtun 2016-11-14 19:21:49 +01:00
parent d26ff34448
commit c61d4f063c
3 changed files with 5 additions and 7 deletions

View File

@ -2,8 +2,7 @@
static void
calculator(struct nk_context *ctx)
{
struct nk_panel layout;
if (nk_begin(ctx, &layout, "Calculator", nk_rect(10, 10, 180, 250),
if (nk_begin(ctx, "Calculator", nk_rect(10, 10, 180, 250),
NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_MOVABLE))
{
static int set = 0, prev = 0, op = 0;
@ -29,8 +28,7 @@ calculator(struct nk_context *ctx)
a = b = op = 0; current = &a; set = 0;
} if (nk_button_label(ctx, "0")) {
*current = *current*10.0f; set = 0;
}
if (nk_button_label(ctx, "=")) {
} if (nk_button_label(ctx, "=")) {
solve = 1; prev = op; op = 0;
}
} else if (((i+1) % 4)) {

View File

@ -36,7 +36,7 @@ overview(struct nk_context *ctx)
static int mcheck = nk_true;
nk_menubar_begin(ctx);
nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
nk_layout_row_begin(ctx, NK_STATIC, 25, 4);
nk_layout_row_push(ctx, 45);
if (nk_menu_begin_label(ctx, "MENU", NK_TEXT_LEFT, nk_vec2(120, 200)))
{

View File

@ -14128,7 +14128,7 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
area.w = bounds.w - (2.0f * style->padding.x + 2 * style->border);
area.h = bounds.h - (2.0f * style->padding.y + 2 * style->border);
if (flags & NK_EDIT_MULTILINE)
area.w = NK_MAX(0, area.w - style->scrollbar_size.y);
area.w = NK_MAX(0, area.w - style->scrollbar_size.x);
row_height = (flags & NK_EDIT_MULTILINE)? font->height + style->row_padding: area.h;
/* calculate clipping rectangle */
@ -14283,7 +14283,7 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
nk_fill_rect(out, bounds, style->rounding, background->data.color);
} else nk_draw_image(out, bounds, &background->data.image, nk_white);}
area.w -= style->cursor_size + style->scrollbar_size.x;
area.w = NK_MAX(0, area.w - style->cursor_size);
if (edit->active)
{
int total_lines = 1;