Added the previously mising close window function

This commit is contained in:
vurtun 2016-03-02 19:06:31 +01:00
parent 047deec3cd
commit 53a6a4590d
2 changed files with 18 additions and 1 deletions

View File

@ -8043,6 +8043,22 @@ zr_window_is_active(struct zr_context *ctx, const char *name)
return win == ctx->active;
}
void
zr_window_close(struct zr_context *ctx, const char *name)
{
int title_len;
zr_hash title_hash;
struct zr_window *win;
ZR_ASSERT(ctx);
if (!ctx) return;
title_len = (int)zr_strsiz(name);
title_hash = zr_murmur_hash(name, (int)title_len, ZR_WINDOW_TITLE);
win = zr_find_window(ctx, title_hash);
if (!win) return;
win->flags |= ZR_WINDOW_HIDDEN;
}
void
zr_window_set_bounds(struct zr_context *ctx, struct zr_rect bounds)
{
@ -8136,7 +8152,7 @@ zr_window_set_focus(struct zr_context *ctx, const char *name)
title_len = (int)zr_strsiz(name);
title_hash = zr_murmur_hash(name, (int)title_len, ZR_WINDOW_TITLE);
win = zr_find_window(ctx, title_hash);
if (ctx->end != win) {
if (win && ctx->end != win) {
zr_remove_window(ctx, win);
zr_insert_window(ctx, win);
}

View File

@ -1724,6 +1724,7 @@ int zr_window_is_collapsed(struct zr_context*, const char*);
int zr_window_is_closed(struct zr_context*, const char*);
int zr_window_is_active(struct zr_context*, const char*);
void zr_window_close(struct zr_context*, const char *name);
void zr_window_set_bounds(struct zr_context*, struct zr_rect);
void zr_window_set_position(struct zr_context*, struct zr_vec2);
void zr_window_set_size(struct zr_context*, struct zr_vec2);