fixed typo #34 no3,4
This commit is contained in:
parent
e6a305f020
commit
333d5f33e7
18
demo/demo.c
18
demo/demo.c
@ -112,10 +112,10 @@ demo_window(struct zr_layout *layout, struct zr_context *ctx, enum theme *theme)
|
|||||||
ctx->style.header.align = header_align;
|
ctx->style.header.align = header_align;
|
||||||
if (border) window_flags |= ZR_WINDOW_BORDER;
|
if (border) window_flags |= ZR_WINDOW_BORDER;
|
||||||
if (resize) window_flags |= ZR_WINDOW_SCALABLE;
|
if (resize) window_flags |= ZR_WINDOW_SCALABLE;
|
||||||
if (moveable) window_flags |= ZR_WINDOW_MOVEABLE;
|
if (moveable) window_flags |= ZR_WINDOW_MOVABLE;
|
||||||
if (no_scrollbar) window_flags |= ZR_WINDOW_NO_SCROLLBAR;
|
if (no_scrollbar) window_flags |= ZR_WINDOW_NO_SCROLLBAR;
|
||||||
if (minimizable) window_flags |= ZR_WINDOW_MINIMIZABLE;
|
if (minimizable) window_flags |= ZR_WINDOW_MINIMIZABLE;
|
||||||
if (close) window_flags |= ZR_WINDOW_CLOSEABLE;
|
if (close) window_flags |= ZR_WINDOW_CLOSABLE;
|
||||||
|
|
||||||
/* main window */
|
/* main window */
|
||||||
if (zr_begin(ctx, layout, "Demo", zr_rect(30, 30, 400, 600), window_flags))
|
if (zr_begin(ctx, layout, "Demo", zr_rect(30, 30, 400, 600), window_flags))
|
||||||
@ -163,7 +163,7 @@ demo_window(struct zr_layout *layout, struct zr_context *ctx, enum theme *theme)
|
|||||||
/* about popup */
|
/* about popup */
|
||||||
struct zr_layout popup;
|
struct zr_layout popup;
|
||||||
static struct zr_rect s = {20, 100, 300, 190};
|
static struct zr_rect s = {20, 100, 300, 190};
|
||||||
if (zr_popup_begin(ctx, &popup, ZR_POPUP_STATIC, "About", ZR_WINDOW_CLOSEABLE, s))
|
if (zr_popup_begin(ctx, &popup, ZR_POPUP_STATIC, "About", ZR_WINDOW_CLOSABLE, s))
|
||||||
{
|
{
|
||||||
zr_layout_row_dynamic(ctx, 20, 1);
|
zr_layout_row_dynamic(ctx, 20, 1);
|
||||||
zr_label(ctx, "Zahnrad", ZR_TEXT_LEFT);
|
zr_label(ctx, "Zahnrad", ZR_TEXT_LEFT);
|
||||||
@ -179,7 +179,7 @@ demo_window(struct zr_layout *layout, struct zr_context *ctx, enum theme *theme)
|
|||||||
/* close popup */
|
/* close popup */
|
||||||
struct zr_layout popup;
|
struct zr_layout popup;
|
||||||
static const struct zr_rect s = {20, 150, 230, 150};
|
static const struct zr_rect s = {20, 150, 230, 150};
|
||||||
if(zr_popup_begin(ctx, &popup, ZR_POPUP_STATIC, "Quit", ZR_WINDOW_CLOSEABLE, s))
|
if(zr_popup_begin(ctx, &popup, ZR_POPUP_STATIC, "Quit", ZR_WINDOW_CLOSABLE, s))
|
||||||
{
|
{
|
||||||
zr_layout_row_dynamic(ctx, 30, 1);
|
zr_layout_row_dynamic(ctx, 30, 1);
|
||||||
zr_label(ctx, "Are you sure you want to exit?", ZR_TEXT_LEFT);
|
zr_label(ctx, "Are you sure you want to exit?", ZR_TEXT_LEFT);
|
||||||
@ -200,7 +200,7 @@ demo_window(struct zr_layout *layout, struct zr_context *ctx, enum theme *theme)
|
|||||||
/* color picker popup */
|
/* color picker popup */
|
||||||
struct zr_layout popup;
|
struct zr_layout popup;
|
||||||
if (zr_popup_begin(ctx, &popup, ZR_POPUP_STATIC, "Color Picker",
|
if (zr_popup_begin(ctx, &popup, ZR_POPUP_STATIC, "Color Picker",
|
||||||
ZR_WINDOW_CLOSEABLE, zr_rect(10, 100, 360, 280)))
|
ZR_WINDOW_CLOSABLE, zr_rect(10, 100, 360, 280)))
|
||||||
{
|
{
|
||||||
zr_layout_row_dynamic(ctx, 30, 2);
|
zr_layout_row_dynamic(ctx, 30, 2);
|
||||||
zr_label(ctx, zr_get_color_name((enum zr_style_colors)color_picker_index), ZR_TEXT_LEFT);
|
zr_label(ctx, zr_get_color_name((enum zr_style_colors)color_picker_index), ZR_TEXT_LEFT);
|
||||||
@ -860,8 +860,8 @@ run_demo(struct demo *gui)
|
|||||||
|
|
||||||
/* simple demo window */
|
/* simple demo window */
|
||||||
if (zr_begin(ctx, &layout, "Show", zr_rect(20, 20, 200, 200),
|
if (zr_begin(ctx, &layout, "Show", zr_rect(20, 20, 200, 200),
|
||||||
ZR_WINDOW_BORDER|ZR_WINDOW_MOVEABLE|ZR_WINDOW_SCALABLE|
|
ZR_WINDOW_BORDER|ZR_WINDOW_MOVABLE|ZR_WINDOW_SCALABLE|
|
||||||
ZR_WINDOW_CLOSEABLE|ZR_WINDOW_MINIMIZABLE|ZR_WINDOW_TITLE))
|
ZR_WINDOW_CLOSABLE|ZR_WINDOW_MINIMIZABLE|ZR_WINDOW_TITLE))
|
||||||
{
|
{
|
||||||
enum {EASY, HARD};
|
enum {EASY, HARD};
|
||||||
static int op = EASY;
|
static int op = EASY;
|
||||||
@ -882,8 +882,8 @@ run_demo(struct demo *gui)
|
|||||||
|
|
||||||
/* metrics window */
|
/* metrics window */
|
||||||
if (zr_begin(ctx, &layout, "Metrics", zr_rect(50, 600, 250, 300),
|
if (zr_begin(ctx, &layout, "Metrics", zr_rect(50, 600, 250, 300),
|
||||||
ZR_WINDOW_BORDER|ZR_WINDOW_MOVEABLE|ZR_WINDOW_SCALABLE|
|
ZR_WINDOW_BORDER|ZR_WINDOW_MOVABLE|ZR_WINDOW_SCALABLE|
|
||||||
ZR_WINDOW_CLOSEABLE|ZR_WINDOW_MINIMIZABLE))
|
ZR_WINDOW_CLOSABLE|ZR_WINDOW_MINIMIZABLE))
|
||||||
{
|
{
|
||||||
struct zr_memory_status status;
|
struct zr_memory_status status;
|
||||||
zr_buffer_info(&status, &ctx->memory);
|
zr_buffer_info(&status, &ctx->memory);
|
||||||
|
@ -233,7 +233,7 @@ button_demo(struct zr_context *ctx, struct icons *img)
|
|||||||
|
|
||||||
ctx->style.font.height = 20;
|
ctx->style.font.height = 20;
|
||||||
zr_begin(ctx, &layout, "Button Demo", zr_rect(50,50,255,610),
|
zr_begin(ctx, &layout, "Button Demo", zr_rect(50,50,255,610),
|
||||||
ZR_WINDOW_BORDER|ZR_WINDOW_MOVEABLE|ZR_WINDOW_BORDER_HEADER|ZR_WINDOW_TITLE);
|
ZR_WINDOW_BORDER|ZR_WINDOW_MOVABLE|ZR_WINDOW_BORDER_HEADER|ZR_WINDOW_TITLE);
|
||||||
|
|
||||||
/*------------------------------------------------
|
/*------------------------------------------------
|
||||||
* MENU
|
* MENU
|
||||||
@ -352,7 +352,7 @@ basic_demo(struct zr_context *ctx, struct icons *img)
|
|||||||
struct zr_layout combo;
|
struct zr_layout combo;
|
||||||
ctx->style.font.height = 20;
|
ctx->style.font.height = 20;
|
||||||
zr_begin(ctx, &layout, "Basic Demo", zr_rect(320, 50, 275, 610),
|
zr_begin(ctx, &layout, "Basic Demo", zr_rect(320, 50, 275, 610),
|
||||||
ZR_WINDOW_BORDER|ZR_WINDOW_MOVEABLE|ZR_WINDOW_BORDER_HEADER|ZR_WINDOW_TITLE);
|
ZR_WINDOW_BORDER|ZR_WINDOW_MOVABLE|ZR_WINDOW_BORDER_HEADER|ZR_WINDOW_TITLE);
|
||||||
|
|
||||||
/*------------------------------------------------
|
/*------------------------------------------------
|
||||||
* POPUP BUTTON
|
* POPUP BUTTON
|
||||||
@ -464,7 +464,7 @@ grid_demo(struct zr_context *ctx)
|
|||||||
|
|
||||||
ctx->style.font.height = 20;
|
ctx->style.font.height = 20;
|
||||||
zr_begin(ctx, &layout, "Grid Demo", zr_rect(600, 350, 275, 250),
|
zr_begin(ctx, &layout, "Grid Demo", zr_rect(600, 350, 275, 250),
|
||||||
ZR_WINDOW_TITLE|ZR_WINDOW_BORDER|ZR_WINDOW_MOVEABLE|
|
ZR_WINDOW_TITLE|ZR_WINDOW_BORDER|ZR_WINDOW_MOVABLE|
|
||||||
ZR_WINDOW_BORDER_HEADER|ZR_WINDOW_NO_SCROLLBAR);
|
ZR_WINDOW_BORDER_HEADER|ZR_WINDOW_NO_SCROLLBAR);
|
||||||
|
|
||||||
ctx->style.font.height = 18;
|
ctx->style.font.height = 18;
|
||||||
|
@ -216,7 +216,7 @@ node_editor_draw(struct zr_context *ctx, struct node_editor *nodedit)
|
|||||||
it->bounds.y - nodedit->scrolling.y, it->bounds.w, it->bounds.h));
|
it->bounds.y - nodedit->scrolling.y, it->bounds.w, it->bounds.h));
|
||||||
|
|
||||||
/* execute node window */
|
/* execute node window */
|
||||||
if (zr_group_begin(ctx, &node, it->name, ZR_WINDOW_MOVEABLE|ZR_WINDOW_NO_SCROLLBAR|ZR_WINDOW_BORDER|ZR_WINDOW_TITLE))
|
if (zr_group_begin(ctx, &node, it->name, ZR_WINDOW_MOVABLE|ZR_WINDOW_NO_SCROLLBAR|ZR_WINDOW_BORDER|ZR_WINDOW_TITLE))
|
||||||
{
|
{
|
||||||
static const float ratio[] = {0.25f, 0.75f};
|
static const float ratio[] = {0.25f, 0.75f};
|
||||||
/* always have last selected node on top */
|
/* always have last selected node on top */
|
||||||
@ -669,7 +669,7 @@ main(int argc, char *argv[])
|
|||||||
int incursor;
|
int incursor;
|
||||||
struct zr_layout layout;
|
struct zr_layout layout;
|
||||||
if (zr_begin(&ctx, &layout, "Nodedit", zr_rect(0,0,width,height),
|
if (zr_begin(&ctx, &layout, "Nodedit", zr_rect(0,0,width,height),
|
||||||
ZR_WINDOW_BORDER|ZR_WINDOW_NO_SCROLLBAR|ZR_WINDOW_CLOSEABLE))
|
ZR_WINDOW_BORDER|ZR_WINDOW_NO_SCROLLBAR|ZR_WINDOW_CLOSABLE))
|
||||||
node_editor_draw(&ctx, &nodedit);
|
node_editor_draw(&ctx, &nodedit);
|
||||||
else goto cleanup;
|
else goto cleanup;
|
||||||
zr_end(&ctx);
|
zr_end(&ctx);
|
||||||
|
@ -7145,7 +7145,7 @@ zr_layout_begin(struct zr_context *ctx, const char *title)
|
|||||||
/* move panel position if requested */
|
/* move panel position if requested */
|
||||||
layout->header_h = c->font.height + 4 * item_padding.y;
|
layout->header_h = c->font.height + 4 * item_padding.y;
|
||||||
layout->header_h += window_padding.y;
|
layout->header_h += window_padding.y;
|
||||||
if ((win->flags & ZR_WINDOW_MOVEABLE) && !(win->flags & ZR_WINDOW_ROM)) {
|
if ((win->flags & ZR_WINDOW_MOVABLE) && !(win->flags & ZR_WINDOW_ROM)) {
|
||||||
int incursor;
|
int incursor;
|
||||||
struct zr_rect move;
|
struct zr_rect move;
|
||||||
move.x = win->bounds.x;
|
move.x = win->bounds.x;
|
||||||
@ -7204,7 +7204,7 @@ zr_layout_begin(struct zr_context *ctx, const char *title)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* window header */
|
/* window header */
|
||||||
header_active = (win->flags & (ZR_WINDOW_CLOSEABLE|ZR_WINDOW_MINIMIZABLE));
|
header_active = (win->flags & (ZR_WINDOW_CLOSABLE|ZR_WINDOW_MINIMIZABLE));
|
||||||
header_active = header_active || (win->flags & ZR_WINDOW_TITLE);
|
header_active = header_active || (win->flags & ZR_WINDOW_TITLE);
|
||||||
header_active = header_active && !(win->flags & ZR_WINDOW_HIDDEN) && title;
|
header_active = header_active && !(win->flags & ZR_WINDOW_HIDDEN) && title;
|
||||||
|
|
||||||
@ -7244,7 +7244,7 @@ zr_layout_begin(struct zr_context *ctx, const char *title)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* window header icons */
|
/* window header icons */
|
||||||
if (win->flags & ZR_WINDOW_CLOSEABLE)
|
if (win->flags & ZR_WINDOW_CLOSABLE)
|
||||||
zr_header_flag(ctx, &header, c->header.close_symbol, c->header.close_symbol,
|
zr_header_flag(ctx, &header, c->header.close_symbol, c->header.close_symbol,
|
||||||
c->header.align, ZR_WINDOW_HIDDEN);
|
c->header.align, ZR_WINDOW_HIDDEN);
|
||||||
if (win->flags & ZR_WINDOW_MINIMIZABLE)
|
if (win->flags & ZR_WINDOW_MINIMIZABLE)
|
||||||
@ -9489,7 +9489,7 @@ zr_group_begin(struct zr_context *ctx, struct zr_layout *layout,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ZR_INTERSECT(c->x, c->y, c->w, c->h, bounds.x, bounds.y, bounds.w, bounds.h) &&
|
if (!ZR_INTERSECT(c->x, c->y, c->w, c->h, bounds.x, bounds.y, bounds.w, bounds.h) &&
|
||||||
!(flags & ZR_WINDOW_MOVEABLE)) {
|
!(flags & ZR_WINDOW_MOVABLE)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1128,13 +1128,13 @@ enum zr_window_flags {
|
|||||||
/* Draws a border around the window to visually seperate the window from the background */
|
/* Draws a border around the window to visually seperate the window from the background */
|
||||||
ZR_WINDOW_BORDER_HEADER = ZR_FLAG(1),
|
ZR_WINDOW_BORDER_HEADER = ZR_FLAG(1),
|
||||||
/* Draws a border between window header and body */
|
/* Draws a border between window header and body */
|
||||||
ZR_WINDOW_MOVEABLE = ZR_FLAG(2),
|
ZR_WINDOW_MOVABLE = ZR_FLAG(2),
|
||||||
/* The moveable flag inidicates that a window can be moved by user input or by
|
/* The moveable flag inidicates that a window can be moved by user input or by
|
||||||
* dragging the window header */
|
* dragging the window header */
|
||||||
ZR_WINDOW_SCALABLE = ZR_FLAG(3),
|
ZR_WINDOW_SCALABLE = ZR_FLAG(3),
|
||||||
/* The scaleable flag indicates that a window can be scaled by user input
|
/* The scaleable flag indicates that a window can be scaled by user input
|
||||||
* by dragging a scaler icon at the button of the window */
|
* by dragging a scaler icon at the button of the window */
|
||||||
ZR_WINDOW_CLOSEABLE = ZR_FLAG(4),
|
ZR_WINDOW_CLOSABLE = ZR_FLAG(4),
|
||||||
/* adds a closeable icon into the header */
|
/* adds a closeable icon into the header */
|
||||||
ZR_WINDOW_MINIMIZABLE = ZR_FLAG(5),
|
ZR_WINDOW_MINIMIZABLE = ZR_FLAG(5),
|
||||||
/* adds a minimize icon into the header */
|
/* adds a minimize icon into the header */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user