Add nk_window_get_scroll and nk_window_set_scroll
This commit is contained in:
parent
b9f84362fb
commit
42f4a03273
|
@ -97,6 +97,7 @@ NK_INCLUDE_COMMAND_USERDATA | Defining this adds a userdata pointer into eac
|
||||||
NK_BUTTON_TRIGGER_ON_RELEASE | Different platforms require button clicks occurring either on buttons being pressed (up to down) or released (down to up). By default this library will react on buttons being pressed, but if you define this it will only trigger if a button is released.
|
NK_BUTTON_TRIGGER_ON_RELEASE | Different platforms require button clicks occurring either on buttons being pressed (up to down) or released (down to up). By default this library will react on buttons being pressed, but if you define this it will only trigger if a button is released.
|
||||||
NK_ZERO_COMMAND_MEMORY | Defining this will zero out memory for each drawing command added to a drawing queue (inside nk_command_buffer_push). Zeroing command memory is very useful for fast checking (using memcmp) if command buffers are equal and avoid drawing frames when nothing on screen has changed since previous frame.
|
NK_ZERO_COMMAND_MEMORY | Defining this will zero out memory for each drawing command added to a drawing queue (inside nk_command_buffer_push). Zeroing command memory is very useful for fast checking (using memcmp) if command buffers are equal and avoid drawing frames when nothing on screen has changed since previous frame.
|
||||||
NK_UINT_DRAW_INDEX | Defining this will set the size of vertex index elements when using NK_VERTEX_BUFFER_OUTPUT to 32bit instead of the default of 16bit
|
NK_UINT_DRAW_INDEX | Defining this will set the size of vertex index elements when using NK_VERTEX_BUFFER_OUTPUT to 32bit instead of the default of 16bit
|
||||||
|
NK_KEYSTATE_BASED_INPUT | Define this if your backend uses key state for each frame rather than key press/release events
|
||||||
!!! WARNING
|
!!! WARNING
|
||||||
The following flags will pull in the standard C library:
|
The following flags will pull in the standard C library:
|
||||||
- NK_INCLUDE_DEFAULT_ALLOCATOR
|
- NK_INCLUDE_DEFAULT_ALLOCATOR
|
||||||
|
@ -845,6 +846,7 @@ nk_window_get_content_region_min | Returns the upper rectangle position of th
|
||||||
nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
|
nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
|
||||||
nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window
|
nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window
|
||||||
nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets
|
nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets
|
||||||
|
nk_window_get_scroll | Gets the scroll offset of the current window
|
||||||
nk_window_has_focus | Returns if the currently processed window is currently active
|
nk_window_has_focus | Returns if the currently processed window is currently active
|
||||||
nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed
|
nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed
|
||||||
nk_window_is_closed | Returns if the currently processed window was closed
|
nk_window_is_closed | Returns if the currently processed window was closed
|
||||||
|
@ -857,6 +859,7 @@ nk_window_set_bounds | Updates position and size of the currently
|
||||||
nk_window_set_position | Updates position of the currently process window
|
nk_window_set_position | Updates position of the currently process window
|
||||||
nk_window_set_size | Updates the size of the currently processed window
|
nk_window_set_size | Updates the size of the currently processed window
|
||||||
nk_window_set_focus | Set the currently processed window as active window
|
nk_window_set_focus | Set the currently processed window as active window
|
||||||
|
nk_window_set_scroll | Sets the scroll offset of the current window
|
||||||
nk_window_close | Closes the window with given window name which deletes the window at the end of the frame
|
nk_window_close | Closes the window with given window name which deletes the window at the end of the frame
|
||||||
nk_window_collapse | Collapses the window with given window name
|
nk_window_collapse | Collapses the window with given window name
|
||||||
nk_window_collapse_if | Collapses the window with given window name if the given condition was met
|
nk_window_collapse_if | Collapses the window with given window name if the given condition was met
|
||||||
|
@ -923,7 +926,7 @@ __ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
#### nk_window_find
|
#### nk_window_find
|
||||||
Finds and returns a window from passed name
|
Finds and returns a window from passed name
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
void nk_end(struct nk_context *ctx);
|
struct nk_window *nk_window_find(struct nk_context *ctx, const char *name);
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Parameter | Description
|
Parameter | Description
|
||||||
------------|-----------------------------------------------------------
|
------------|-----------------------------------------------------------
|
||||||
|
@ -1064,6 +1067,18 @@ Parameter | Description
|
||||||
__ctx__ | Must point to an previously initialized `nk_context` struct
|
__ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
Returns a pointer to window internal `nk_command_buffer` struct used as
|
Returns a pointer to window internal `nk_command_buffer` struct used as
|
||||||
drawing canvas. Can be used to do custom drawing.
|
drawing canvas. Can be used to do custom drawing.
|
||||||
|
#### nk_window_get_scroll
|
||||||
|
Gets the scroll offset for the current window
|
||||||
|
!!! WARNING
|
||||||
|
Only call this function between calls `nk_begin_xxx` and `nk_end`
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
void nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Parameter | Description
|
||||||
|
-------------|-----------------------------------------------------------
|
||||||
|
__ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
__offset_x__ | A pointer to the x offset output
|
||||||
|
__offset_y__ | A pointer to the y offset output
|
||||||
#### nk_window_has_focus
|
#### nk_window_has_focus
|
||||||
Returns if the currently processed window is currently active
|
Returns if the currently processed window is currently active
|
||||||
!!! WARNING
|
!!! WARNING
|
||||||
|
@ -1186,6 +1201,18 @@ Parameter | Description
|
||||||
------------|-----------------------------------------------------------
|
------------|-----------------------------------------------------------
|
||||||
__ctx__ | Must point to an previously initialized `nk_context` struct
|
__ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
__name__ | Identifier of the window to set focus on
|
__name__ | Identifier of the window to set focus on
|
||||||
|
#### nk_window_set_scroll
|
||||||
|
Sets the scroll offset for the current window
|
||||||
|
!!! WARNING
|
||||||
|
Only call this function between calls `nk_begin_xxx` and `nk_end`
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
void nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Parameter | Description
|
||||||
|
-------------|-----------------------------------------------------------
|
||||||
|
__ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
__offset_x__ | The x offset to scroll to
|
||||||
|
__offset_y__ | The y offset to scroll to
|
||||||
#### nk_window_close
|
#### nk_window_close
|
||||||
Closes a window and marks it for being freed at the end of the frame
|
Closes a window and marks it for being freed at the end of the frame
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
@ -1843,6 +1870,28 @@ void nk_group_scrolled_end(struct nk_context*);
|
||||||
Parameter | Description
|
Parameter | Description
|
||||||
------------|-----------------------------------------------------------
|
------------|-----------------------------------------------------------
|
||||||
__ctx__ | Must point to an previously initialized `nk_context` struct
|
__ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
#### nk_group_get_scroll
|
||||||
|
Gets the scroll position of the given group.
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Parameter | Description
|
||||||
|
-------------|-----------------------------------------------------------
|
||||||
|
__ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
__id__ | The id of the group to get the scroll position of
|
||||||
|
__x_offset__ | A pointer to the x offset output
|
||||||
|
__y_offset__ | A pointer to the y offset output
|
||||||
|
#### nk_group_set_scroll
|
||||||
|
Sets the scroll position of the given group.
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Parameter | Description
|
||||||
|
-------------|-----------------------------------------------------------
|
||||||
|
__ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
__id__ | The id of the group to scroll
|
||||||
|
__x_offset__ | The x offset to scroll to
|
||||||
|
__y_offset__ | The y offset to scroll to
|
||||||
### Tree
|
### Tree
|
||||||
Trees represent two different concept. First the concept of a collapsable
|
Trees represent two different concept. First the concept of a collapsable
|
||||||
UI section that can be either in a hidden or visibile state. They allow the UI
|
UI section that can be either in a hidden or visibile state. They allow the UI
|
||||||
|
@ -2258,6 +2307,7 @@ X...XXXXXXXXXXXXX...X - "
|
||||||
- [x]: Major version with API and library breaking changes
|
- [x]: Major version with API and library breaking changes
|
||||||
- [yy]: Minor version with non-breaking API and library changes
|
- [yy]: Minor version with non-breaking API and library changes
|
||||||
- [zz]: Bug fix version with no direct changes to API
|
- [zz]: Bug fix version with no direct changes to API
|
||||||
|
- 2018/10/31 (4.00.2) - Added NK_KEYSTATE_BASED_INPUT to "fix" state based backends
|
||||||
- 2018/04/01 (4.00.1) - Fixed calling `nk_convert` multiple time per single frame
|
- 2018/04/01 (4.00.1) - Fixed calling `nk_convert` multiple time per single frame
|
||||||
- 2018/04/01 (4.00.0) - BREAKING CHANGE: nk_draw_list_clear no longer tries to
|
- 2018/04/01 (4.00.0) - BREAKING CHANGE: nk_draw_list_clear no longer tries to
|
||||||
clear provided buffers. So make sure to either free
|
clear provided buffers. So make sure to either free
|
||||||
|
|
61
nuklear.h
61
nuklear.h
|
@ -1402,6 +1402,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*
|
||||||
/// nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
|
/// nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
|
||||||
/// nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window
|
/// nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window
|
||||||
/// nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets
|
/// nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets
|
||||||
|
/// nk_window_get_scroll | Gets the scroll offset of the current window
|
||||||
/// nk_window_has_focus | Returns if the currently processed window is currently active
|
/// nk_window_has_focus | Returns if the currently processed window is currently active
|
||||||
/// nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed
|
/// nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed
|
||||||
/// nk_window_is_closed | Returns if the currently processed window was closed
|
/// nk_window_is_closed | Returns if the currently processed window was closed
|
||||||
|
@ -1415,6 +1416,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*
|
||||||
/// nk_window_set_position | Updates position of the currently process window
|
/// nk_window_set_position | Updates position of the currently process window
|
||||||
/// nk_window_set_size | Updates the size of the currently processed window
|
/// nk_window_set_size | Updates the size of the currently processed window
|
||||||
/// nk_window_set_focus | Set the currently processed window as active window
|
/// nk_window_set_focus | Set the currently processed window as active window
|
||||||
|
/// nk_window_set_scroll | Sets the scroll offset of the current window
|
||||||
//
|
//
|
||||||
/// nk_window_close | Closes the window with given window name which deletes the window at the end of the frame
|
/// nk_window_close | Closes the window with given window name which deletes the window at the end of the frame
|
||||||
/// nk_window_collapse | Collapses the window with given window name
|
/// nk_window_collapse | Collapses the window with given window name
|
||||||
|
@ -1718,6 +1720,22 @@ NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*);
|
||||||
/// drawing canvas. Can be used to do custom drawing.
|
/// drawing canvas. Can be used to do custom drawing.
|
||||||
*/
|
*/
|
||||||
NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*);
|
NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*);
|
||||||
|
/*/// #### nk_window_get_scroll
|
||||||
|
/// Gets the scroll offset for the current window
|
||||||
|
/// !!! WARNING
|
||||||
|
/// Only call this function between calls `nk_begin_xxx` and `nk_end`
|
||||||
|
///
|
||||||
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
/// void nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y);
|
||||||
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
///
|
||||||
|
/// Parameter | Description
|
||||||
|
/// -------------|-----------------------------------------------------------
|
||||||
|
/// __ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
/// __offset_x__ | A pointer to the x offset output
|
||||||
|
/// __offset_y__ | A pointer to the y offset output
|
||||||
|
*/
|
||||||
|
NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y);
|
||||||
/*/// #### nk_window_has_focus
|
/*/// #### nk_window_has_focus
|
||||||
/// Returns if the currently processed window is currently active
|
/// Returns if the currently processed window is currently active
|
||||||
/// !!! WARNING
|
/// !!! WARNING
|
||||||
|
@ -1884,6 +1902,22 @@ NK_API void nk_window_set_size(struct nk_context*, const char *name, struct nk_v
|
||||||
/// __name__ | Identifier of the window to set focus on
|
/// __name__ | Identifier of the window to set focus on
|
||||||
*/
|
*/
|
||||||
NK_API void nk_window_set_focus(struct nk_context*, const char *name);
|
NK_API void nk_window_set_focus(struct nk_context*, const char *name);
|
||||||
|
/*/// #### nk_window_set_scroll
|
||||||
|
/// Sets the scroll offset for the current window
|
||||||
|
/// !!! WARNING
|
||||||
|
/// Only call this function between calls `nk_begin_xxx` and `nk_end`
|
||||||
|
///
|
||||||
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
/// void nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y);
|
||||||
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
///
|
||||||
|
/// Parameter | Description
|
||||||
|
/// -------------|-----------------------------------------------------------
|
||||||
|
/// __ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
/// __offset_x__ | The x offset to scroll to
|
||||||
|
/// __offset_y__ | The y offset to scroll to
|
||||||
|
*/
|
||||||
|
NK_API void nk_window_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y);
|
||||||
/*/// #### nk_window_close
|
/*/// #### nk_window_close
|
||||||
/// Closes a window and marks it for being freed at the end of the frame
|
/// Closes a window and marks it for being freed at the end of the frame
|
||||||
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
@ -2609,6 +2643,8 @@ NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct n
|
||||||
/// nk_group_scrolled_offset_begin | Start a new group with manual separated handling of scrollbar x- and y-offset
|
/// nk_group_scrolled_offset_begin | Start a new group with manual separated handling of scrollbar x- and y-offset
|
||||||
/// nk_group_scrolled_begin | Start a new group with manual scrollbar handling
|
/// nk_group_scrolled_begin | Start a new group with manual scrollbar handling
|
||||||
/// nk_group_scrolled_end | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero
|
/// nk_group_scrolled_end | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero
|
||||||
|
// nk_group_get_scroll | Gets the scroll offset for the given group
|
||||||
|
// nk_group_set_scroll | Sets the scroll offset for the given group
|
||||||
*/
|
*/
|
||||||
/*/// #### nk_group_begin
|
/*/// #### nk_group_begin
|
||||||
/// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
|
/// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
|
||||||
|
@ -16486,6 +16522,18 @@ nk_window_get_panel(struct nk_context *ctx)
|
||||||
if (!ctx || !ctx->current) return 0;
|
if (!ctx || !ctx->current) return 0;
|
||||||
return ctx->current->layout;
|
return ctx->current->layout;
|
||||||
}
|
}
|
||||||
|
NK_API void
|
||||||
|
nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y)
|
||||||
|
{
|
||||||
|
struct nk_window *win;
|
||||||
|
NK_ASSERT(ctx);
|
||||||
|
NK_ASSERT(ctx->current);
|
||||||
|
if (!ctx || !ctx->current)
|
||||||
|
return ;
|
||||||
|
win = ctx->current;
|
||||||
|
*offset_x = win->scrollbar.x;
|
||||||
|
*offset_y = win->scrollbar.y;
|
||||||
|
}
|
||||||
NK_API int
|
NK_API int
|
||||||
nk_window_has_focus(const struct nk_context *ctx)
|
nk_window_has_focus(const struct nk_context *ctx)
|
||||||
{
|
{
|
||||||
|
@ -16652,6 +16700,18 @@ nk_window_set_size(struct nk_context *ctx,
|
||||||
win->bounds.h = size.y;
|
win->bounds.h = size.y;
|
||||||
}
|
}
|
||||||
NK_API void
|
NK_API void
|
||||||
|
nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y)
|
||||||
|
{
|
||||||
|
struct nk_window *win;
|
||||||
|
NK_ASSERT(ctx);
|
||||||
|
NK_ASSERT(ctx->current);
|
||||||
|
if (!ctx || !ctx->current)
|
||||||
|
return;
|
||||||
|
win = ctx->current;
|
||||||
|
win->scrollbar.x = offset_x;
|
||||||
|
win->scrollbar.y = offset_y;
|
||||||
|
}
|
||||||
|
NK_API void
|
||||||
nk_window_collapse(struct nk_context *ctx, const char *name,
|
nk_window_collapse(struct nk_context *ctx, const char *name,
|
||||||
enum nk_collapse_states c)
|
enum nk_collapse_states c)
|
||||||
{
|
{
|
||||||
|
@ -16725,7 +16785,6 @@ nk_window_set_focus(struct nk_context *ctx, const char *name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* POPUP
|
* POPUP
|
||||||
|
|
|
@ -1183,6 +1183,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*
|
||||||
/// nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
|
/// nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
|
||||||
/// nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window
|
/// nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window
|
||||||
/// nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets
|
/// nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets
|
||||||
|
/// nk_window_get_scroll | Gets the scroll offset of the current window
|
||||||
/// nk_window_has_focus | Returns if the currently processed window is currently active
|
/// nk_window_has_focus | Returns if the currently processed window is currently active
|
||||||
/// nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed
|
/// nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed
|
||||||
/// nk_window_is_closed | Returns if the currently processed window was closed
|
/// nk_window_is_closed | Returns if the currently processed window was closed
|
||||||
|
@ -1196,6 +1197,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*
|
||||||
/// nk_window_set_position | Updates position of the currently process window
|
/// nk_window_set_position | Updates position of the currently process window
|
||||||
/// nk_window_set_size | Updates the size of the currently processed window
|
/// nk_window_set_size | Updates the size of the currently processed window
|
||||||
/// nk_window_set_focus | Set the currently processed window as active window
|
/// nk_window_set_focus | Set the currently processed window as active window
|
||||||
|
/// nk_window_set_scroll | Sets the scroll offset of the current window
|
||||||
//
|
//
|
||||||
/// nk_window_close | Closes the window with given window name which deletes the window at the end of the frame
|
/// nk_window_close | Closes the window with given window name which deletes the window at the end of the frame
|
||||||
/// nk_window_collapse | Collapses the window with given window name
|
/// nk_window_collapse | Collapses the window with given window name
|
||||||
|
@ -1499,6 +1501,22 @@ NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*);
|
||||||
/// drawing canvas. Can be used to do custom drawing.
|
/// drawing canvas. Can be used to do custom drawing.
|
||||||
*/
|
*/
|
||||||
NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*);
|
NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*);
|
||||||
|
/*/// #### nk_window_get_scroll
|
||||||
|
/// Gets the scroll offset for the current window
|
||||||
|
/// !!! WARNING
|
||||||
|
/// Only call this function between calls `nk_begin_xxx` and `nk_end`
|
||||||
|
///
|
||||||
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
/// void nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y);
|
||||||
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
///
|
||||||
|
/// Parameter | Description
|
||||||
|
/// -------------|-----------------------------------------------------------
|
||||||
|
/// __ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
/// __offset_x__ | A pointer to the x offset output
|
||||||
|
/// __offset_y__ | A pointer to the y offset output
|
||||||
|
*/
|
||||||
|
NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y);
|
||||||
/*/// #### nk_window_has_focus
|
/*/// #### nk_window_has_focus
|
||||||
/// Returns if the currently processed window is currently active
|
/// Returns if the currently processed window is currently active
|
||||||
/// !!! WARNING
|
/// !!! WARNING
|
||||||
|
@ -1665,6 +1683,22 @@ NK_API void nk_window_set_size(struct nk_context*, const char *name, struct nk_v
|
||||||
/// __name__ | Identifier of the window to set focus on
|
/// __name__ | Identifier of the window to set focus on
|
||||||
*/
|
*/
|
||||||
NK_API void nk_window_set_focus(struct nk_context*, const char *name);
|
NK_API void nk_window_set_focus(struct nk_context*, const char *name);
|
||||||
|
/*/// #### nk_window_set_scroll
|
||||||
|
/// Sets the scroll offset for the current window
|
||||||
|
/// !!! WARNING
|
||||||
|
/// Only call this function between calls `nk_begin_xxx` and `nk_end`
|
||||||
|
///
|
||||||
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
/// void nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y);
|
||||||
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
///
|
||||||
|
/// Parameter | Description
|
||||||
|
/// -------------|-----------------------------------------------------------
|
||||||
|
/// __ctx__ | Must point to an previously initialized `nk_context` struct
|
||||||
|
/// __offset_x__ | The x offset to scroll to
|
||||||
|
/// __offset_y__ | The y offset to scroll to
|
||||||
|
*/
|
||||||
|
NK_API void nk_window_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y);
|
||||||
/*/// #### nk_window_close
|
/*/// #### nk_window_close
|
||||||
/// Closes a window and marks it for being freed at the end of the frame
|
/// Closes a window and marks it for being freed at the end of the frame
|
||||||
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
|
||||||
|
@ -2390,6 +2424,8 @@ NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct n
|
||||||
/// nk_group_scrolled_offset_begin | Start a new group with manual separated handling of scrollbar x- and y-offset
|
/// nk_group_scrolled_offset_begin | Start a new group with manual separated handling of scrollbar x- and y-offset
|
||||||
/// nk_group_scrolled_begin | Start a new group with manual scrollbar handling
|
/// nk_group_scrolled_begin | Start a new group with manual scrollbar handling
|
||||||
/// nk_group_scrolled_end | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero
|
/// nk_group_scrolled_end | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero
|
||||||
|
// nk_group_get_scroll | Gets the scroll offset for the given group
|
||||||
|
// nk_group_set_scroll | Sets the scroll offset for the given group
|
||||||
*/
|
*/
|
||||||
/*/// #### nk_group_begin
|
/*/// #### nk_group_begin
|
||||||
/// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
|
/// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
|
||||||
|
|
|
@ -403,6 +403,18 @@ nk_window_get_panel(struct nk_context *ctx)
|
||||||
if (!ctx || !ctx->current) return 0;
|
if (!ctx || !ctx->current) return 0;
|
||||||
return ctx->current->layout;
|
return ctx->current->layout;
|
||||||
}
|
}
|
||||||
|
NK_API void
|
||||||
|
nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y)
|
||||||
|
{
|
||||||
|
struct nk_window *win;
|
||||||
|
NK_ASSERT(ctx);
|
||||||
|
NK_ASSERT(ctx->current);
|
||||||
|
if (!ctx || !ctx->current)
|
||||||
|
return ;
|
||||||
|
win = ctx->current;
|
||||||
|
*offset_x = win->scrollbar.x;
|
||||||
|
*offset_y = win->scrollbar.y;
|
||||||
|
}
|
||||||
NK_API int
|
NK_API int
|
||||||
nk_window_has_focus(const struct nk_context *ctx)
|
nk_window_has_focus(const struct nk_context *ctx)
|
||||||
{
|
{
|
||||||
|
@ -569,6 +581,18 @@ nk_window_set_size(struct nk_context *ctx,
|
||||||
win->bounds.h = size.y;
|
win->bounds.h = size.y;
|
||||||
}
|
}
|
||||||
NK_API void
|
NK_API void
|
||||||
|
nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y)
|
||||||
|
{
|
||||||
|
struct nk_window *win;
|
||||||
|
NK_ASSERT(ctx);
|
||||||
|
NK_ASSERT(ctx->current);
|
||||||
|
if (!ctx || !ctx->current)
|
||||||
|
return;
|
||||||
|
win = ctx->current;
|
||||||
|
win->scrollbar.x = offset_x;
|
||||||
|
win->scrollbar.y = offset_y;
|
||||||
|
}
|
||||||
|
NK_API void
|
||||||
nk_window_collapse(struct nk_context *ctx, const char *name,
|
nk_window_collapse(struct nk_context *ctx, const char *name,
|
||||||
enum nk_collapse_states c)
|
enum nk_collapse_states c)
|
||||||
{
|
{
|
||||||
|
@ -638,4 +662,3 @@ nk_window_set_focus(struct nk_context *ctx, const char *name)
|
||||||
}
|
}
|
||||||
ctx->active = win;
|
ctx->active = win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue