Added function to remove edit focus #321

This commit is contained in:
vurtun 2017-01-24 23:06:59 +01:00
parent 3123ba0167
commit ef2dcd3b77
2 changed files with 17 additions and 2 deletions

View File

@ -11,6 +11,7 @@
Changes:
--------
- 2017/01/24 (1.33.0) - Added programatic way of remove edit focus
- 2017/01/24 (1.32.3) - Fixed wrong define for basic type definitions for windows
- 2017/01/21 (1.32.2) - Fixed input capture from hidden or closed windows
- 2017/01/21 (1.32.1) - Fixed slider behavior and drawing

View File

@ -1,5 +1,5 @@
/*
Nuklear - 1.32.0 - public domain
Nuklear - 1.33.0 - public domain
no warrenty implied; use at your own risk.
authored from 2015-2016 by Micha Mettke
@ -893,7 +893,8 @@ NK_API float nk_propertyf(struct nk_context*, const char *nam
NK_API double nk_propertyd(struct nk_context*, const char *name, double min, double val, double max, double step, float inc_per_pixel);
/* Widgets: TextEdit */
NK_API void nk_edit_focus(struct nk_context *ctx, nk_flags flags);
NK_API void nk_edit_focus(struct nk_context*, nk_flags flags);
NK_API void nk_edit_unfocus(struct nk_context*);
NK_API nk_flags nk_edit_string(struct nk_context*, nk_flags, char *buffer, int *len, int max, nk_plugin_filter);
NK_API nk_flags nk_edit_buffer(struct nk_context*, nk_flags, struct nk_text_edit*, nk_plugin_filter);
NK_API nk_flags nk_edit_string_zero_terminated(struct nk_context*, nk_flags, char *buffer, int max, nk_plugin_filter);
@ -19811,6 +19812,19 @@ nk_edit_focus(struct nk_context *ctx, nk_flags flags)
win->edit.mode = NK_TEXT_EDIT_MODE_INSERT;
}
NK_API void
nk_edit_unfocus(struct nk_context *ctx)
{
struct nk_window *win;
NK_ASSERT(ctx);
NK_ASSERT(ctx->current);
if (!ctx || !ctx->current) return;
win = ctx->current;
win->edit.active = nk_false;
win->edit.name = 0;
}
NK_API nk_flags
nk_edit_string(struct nk_context *ctx, nk_flags flags,
char *memory, int *len, int max, nk_plugin_filter filter)