Skip to content

Commit

Permalink
Merge pull request #558 from riri/fix-demo-titlebar-options
Browse files Browse the repository at this point in the history
Fixfixed titlebar options in overview demo
  • Loading branch information
RobLoach committed Aug 3, 2023
2 parents 017f27b + 77490e1 commit e3c5384
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions demo/common/overview.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,19 @@ overview(struct nk_context *ctx)
{
/* window flags */
static int show_menu = nk_true;
static int titlebar = nk_true;
static int border = nk_true;
static int resize = nk_true;
static int movable = nk_true;
static int no_scrollbar = nk_false;
static int scale_left = nk_false;
static nk_flags window_flags = 0;
static int minimizable = nk_true;
static nk_flags window_flags = NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_SCALABLE|NK_WINDOW_MOVABLE|NK_WINDOW_MINIMIZABLE;
nk_flags actual_window_flags;

/* popups */
static enum nk_style_header_align header_align = NK_HEADER_RIGHT;
static int show_app_about = nk_false;

/* window flags */
window_flags = 0;
ctx->style.window.header.align = header_align;
if (border) window_flags |= NK_WINDOW_BORDER;
if (resize) window_flags |= NK_WINDOW_SCALABLE;
if (movable) window_flags |= NK_WINDOW_MOVABLE;
if (no_scrollbar) window_flags |= NK_WINDOW_NO_SCROLLBAR;
if (scale_left) window_flags |= NK_WINDOW_SCALE_LEFT;
if (minimizable) window_flags |= NK_WINDOW_MINIMIZABLE;

if (nk_begin(ctx, "Overview", nk_rect(10, 10, 400, 600), window_flags))

actual_window_flags = window_flags;
if (!(actual_window_flags & NK_WINDOW_TITLE))
actual_window_flags &= ~(NK_WINDOW_MINIMIZABLE|NK_WINDOW_CLOSABLE);
if (nk_begin(ctx, "Overview", nk_rect(10, 10, 400, 600), actual_window_flags))
{
if (show_menu)
{
Expand Down Expand Up @@ -132,14 +121,14 @@ overview(struct nk_context *ctx)
/* window flags */
if (nk_tree_push(ctx, NK_TREE_TAB, "Window", NK_MINIMIZED)) {
nk_layout_row_dynamic(ctx, 30, 2);
nk_checkbox_label(ctx, "Titlebar", &titlebar);
nk_checkbox_label(ctx, "Menu", &show_menu);
nk_checkbox_label(ctx, "Border", &border);
nk_checkbox_label(ctx, "Resizable", &resize);
nk_checkbox_label(ctx, "Movable", &movable);
nk_checkbox_label(ctx, "No Scrollbar", &no_scrollbar);
nk_checkbox_label(ctx, "Minimizable", &minimizable);
nk_checkbox_label(ctx, "Scale Left", &scale_left);
nk_checkbox_flags_label(ctx, "Titlebar", &window_flags, NK_WINDOW_TITLE);
nk_checkbox_flags_label(ctx, "Border", &window_flags, NK_WINDOW_BORDER);
nk_checkbox_flags_label(ctx, "Resizable", &window_flags, NK_WINDOW_SCALABLE);
nk_checkbox_flags_label(ctx, "Movable", &window_flags, NK_WINDOW_MOVABLE);
nk_checkbox_flags_label(ctx, "No Scrollbar", &window_flags, NK_WINDOW_NO_SCROLLBAR);
nk_checkbox_flags_label(ctx, "Minimizable", &window_flags, NK_WINDOW_MINIMIZABLE);
nk_checkbox_flags_label(ctx, "Scale Left", &window_flags, NK_WINDOW_SCALE_LEFT);
nk_tree_pop(ctx);
}

Expand Down

0 comments on commit e3c5384

Please sign in to comment.