fixed window flag manipulation

This commit is contained in:
vurtun 2016-01-01 21:13:01 +01:00
parent bcabde32ab
commit 599a64ed9e
2 changed files with 21 additions and 17 deletions

View File

@ -70,6 +70,11 @@ struct zr_edit_box {
}; };
enum zr_internal_window_flags { enum zr_internal_window_flags {
ZR_WINDOW_HIDDEN = ZR_FLAG(10),
/* Hiddes the window and stops any window interaction and drawing can be set
* by user input or by closing the window */
ZR_WINDOW_MINIMIZED = ZR_FLAG(11),
/* marks the window as minimized */
ZR_WINDOW_SUB = ZR_FLAG(12), ZR_WINDOW_SUB = ZR_FLAG(12),
/* Marks the window as subwindow of another window*/ /* Marks the window as subwindow of another window*/
ZR_WINDOW_GROUP = ZR_FLAG(13), ZR_WINDOW_GROUP = ZR_FLAG(13),
@ -6601,7 +6606,11 @@ zr_begin(struct zr_context *ctx, struct zr_layout *layout,
win->bounds = bounds; win->bounds = bounds;
win->name = title_hash; win->name = title_hash;
win->popup.win = 0; win->popup.win = 0;
} else win->seq++; } else {
win->flags &= ~(zr_flags)(ZR_WINDOW_HIDDEN-1);
win->flags |= flags;
win->seq++;
}
if (win->flags & ZR_WINDOW_HIDDEN) return 0; if (win->flags & ZR_WINDOW_HIDDEN) return 0;
/* overlapping window */ /* overlapping window */
@ -6952,7 +6961,7 @@ zr_header_toggle(struct zr_context *ctx, struct zr_window_header *header,
static int static int
zr_header_flag(struct zr_context *ctx, struct zr_window_header *header, zr_header_flag(struct zr_context *ctx, struct zr_window_header *header,
zr_rune inactive, zr_rune active, enum zr_style_header_align align, zr_rune inactive, zr_rune active, enum zr_style_header_align align,
enum zr_window_flags flag) zr_flags flag)
{ {
struct zr_window *win = ctx->current; struct zr_window *win = ctx->current;
struct zr_layout *layout = win->layout; struct zr_layout *layout = win->layout;

View File

@ -1209,34 +1209,29 @@ struct zr_menu {
}; };
enum zr_window_flags { enum zr_window_flags {
ZR_WINDOW_HIDDEN = ZR_FLAG(0), ZR_WINDOW_BORDER = ZR_FLAG(0),
/* Hiddes the window and stops any window interaction and drawing can be set
* by user input or by closing the window */
ZR_WINDOW_MINIMIZED = ZR_FLAG(1),
/* marks the window as minimized */
ZR_WINDOW_BORDER = ZR_FLAG(2),
/* 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(3), 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(4), ZR_WINDOW_MOVEABLE = 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_SCALEABLE = ZR_FLAG(5), ZR_WINDOW_SCALEABLE = 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(6), ZR_WINDOW_CLOSEABLE = ZR_FLAG(4),
/* adds a closeable icon into the header */ /* adds a closeable icon into the header */
ZR_WINDOW_MINIMIZABLE = ZR_FLAG(7), ZR_WINDOW_MINIMIZABLE = ZR_FLAG(5),
/* adds a minimize icon into the header */ /* adds a minimize icon into the header */
ZR_WINDOW_ROM = ZR_FLAG(8), ZR_WINDOW_ROM = ZR_FLAG(6),
/* sets the window into a read only mode and does not allow input changes */ /* sets the window into a read only mode and does not allow input changes */
ZR_WINDOW_DYNAMIC = ZR_FLAG(9), ZR_WINDOW_DYNAMIC = ZR_FLAG(7),
/* special type of window which grows up in height while being filled to a /* special type of window which grows up in height while being filled to a
* certain maximum height. It is mainly used for combo boxes/menus but can be * certain maximum height. It is mainly used for combo boxes/menus but can be
* used to create perfectly fitting windows as well */ * used to create perfectly fitting windows as well */
ZR_WINDOW_NO_SCROLLBAR = ZR_FLAG(10), ZR_WINDOW_NO_SCROLLBAR = ZR_FLAG(8),
/* Removes the scrollbar from the window */ /* Removes the scrollbar from the window */
ZR_WINDOW_TITLE = ZR_FLAG(11) ZR_WINDOW_TITLE = ZR_FLAG(9)
/* Removes the scrollbar from the window */ /* Removes the scrollbar from the window */
}; };