Added additional layouting utility function

This commit is contained in:
vurtun 2017-06-08 17:56:59 +02:00
parent 27603d5b97
commit a79a0837ba
2 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,7 @@
Changes:
--------
- 2017/06/08 (1.39.0) - Added function to retrieve window space without calling a nk_layout_xxx function
- 2017/06/06 (1.38.5) - Fixed `nk_convert` return flag for command buffer
- 2017/05/23 (1.38.4) - Fixed activation behavior for widgets partially clipped
- 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries

View File

@ -1655,6 +1655,7 @@ NK_API void nk_layout_space_begin(struct nk_context*, enum nk_layout_format, flo
NK_API void nk_layout_space_push(struct nk_context*, struct nk_rect);
NK_API void nk_layout_space_end(struct nk_context*);
NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context*);
NK_API struct nk_rect nk_layout_space_bounds(struct nk_context*);
NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2);
NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2);
@ -19389,6 +19390,26 @@ nk_layout_space_bounds(struct nk_context *ctx)
return ret;
}
NK_API struct nk_rect
nk_layout_widget_bounds(struct nk_context *ctx)
{
struct nk_rect ret;
struct nk_window *win;
struct nk_panel *layout;
NK_ASSERT(ctx);
NK_ASSERT(ctx->current);
NK_ASSERT(ctx->current->layout);
win = ctx->current;
layout = win->layout;
ret.x = layout->at_x;
ret.y = layout->clip.y;
ret.w = layout->bounds.w - NK_MAX(layout->at_x - layout->bounds.x,0);
ret.h = layout->row.height;
return ret;
}
NK_API struct nk_vec2
nk_layout_space_to_screen(struct nk_context *ctx, struct nk_vec2 ret)
{