| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=11"/>
- <meta name="generator" content="Doxygen 1.9.8"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>Nuklear: Properties</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="dynsections.js"></script>
- <link href="navtree.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="resize.js"></script>
- <script type="text/javascript" src="navtreedata.js"></script>
- <script type="text/javascript" src="navtree.js"></script>
- <link href="search/search.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="search/searchdata.js"></script>
- <script type="text/javascript" src="search/search.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
- $(document).ready(function() { init_search(); });
- /* @license-end */
- </script>
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- <link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
- </head>
- <body>
- <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
- <div id="titlearea">
- <table cellspacing="0" cellpadding="0">
- <tbody>
- <tr id="projectrow">
- <td id="projectalign">
- <div id="projectname">Nuklear
- </div>
- <div id="projectbrief">This is a minimal-state, immediate-mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed as a simple embeddable user interface for application and does not have any dependencies, a default render backend or OS window/input handling but instead provides a highly modular, library-based approach, with simple input state for input and draw commands describing primitive shapes as output. So instead of providing a layered library that tries to abstract over a number of platform and render backends, it focuses only on the actual UI.</div>
- </td>
- <td> <div id="MSearchBox" class="MSearchBoxInactive">
- <span class="left">
- <span id="MSearchSelect" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"> </span>
- <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
- onfocus="searchBox.OnSearchFieldFocus(true)"
- onblur="searchBox.OnSearchFieldFocus(false)"
- onkeyup="searchBox.OnSearchFieldChange(event)"/>
- </span><span class="right">
- <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
- </span>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.9.8 -->
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
- var searchBox = new SearchBox("searchBox", "search/",'.html');
- /* @license-end */
- </script>
- </div><!-- top -->
- <div id="side-nav" class="ui-resizable side-nav-resizable">
- <div id="nav-tree">
- <div id="nav-tree-contents">
- <div id="nav-sync" class="sync"></div>
- </div>
- </div>
- <div id="splitbar" style="-moz-user-select:none;"
- class="ui-resizable-handle">
- </div>
- </div>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
- $(document).ready(function(){initNavTree('Properties.html',''); initResizable(); });
- /* @license-end */
- </script>
- <div id="doc-content">
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- </div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <div id="MSearchResults">
- <div class="SRPage">
- <div id="SRIndex">
- <div id="SRResults"></div>
- <div class="SRStatus" id="Loading">Loading...</div>
- <div class="SRStatus" id="Searching">Searching...</div>
- <div class="SRStatus" id="NoMatches">No Matches</div>
- </div>
- </div>
- </div>
- </div>
- <div><div class="header">
- <div class="headertitle"><div class="title">Properties</div></div>
- </div><!--header-->
- <div class="contents">
- <div class="textblock"><p>Properties are the main value modification widgets in Nuklear.</p>
- <p>Changing a value can be achieved by dragging, adding/removing incremental steps on button click or by directly typing a number.</p>
- <h1><a class="anchor" id="autotoc_md94"></a>
- Usage</h1>
- <p>Each property requires a unique name for identification that is also used for displaying a label. If you want to use the same name multiple times make sure add a '#' before your name. The '#' will not be shown but will generate a unique ID. Each property also takes in a minimum and maximum value. If you want to make use of the complete number range of a type just use the provided type limits from <code>limits.h</code>. For example <code>INT_MIN</code> and <code>INT_MAX</code> for <code>nk_property_int</code> and <code>nk_propertyi</code>. In additional each property takes in a increment value that will be added or subtracted if either the increment decrement button is clicked. Finally there is a value for increment per pixel dragged that is added or subtracted from the value.</p>
- <div class="fragment"><div class="line"><span class="keywordtype">int</span> value = 0;</div>
- <div class="line"><span class="keyword">struct </span><a class="code hl_struct" href="structnk__context.html">nk_context</a> ctx;</div>
- <div class="line">nk_init_xxx(&ctx, ...);</div>
- <div class="line"><span class="keywordflow">while</span> (1) {</div>
- <div class="line"> <span class="comment">// Input</span></div>
- <div class="line"> Event evt;</div>
- <div class="line"> <a class="code hl_function" href="nuklear_8h.html#a1dd51949401094f71d10429d45779d53">nk_input_begin</a>(&ctx);</div>
- <div class="line"> <span class="keywordflow">while</span> (GetEvent(&evt)) {</div>
- <div class="line"> <span class="keywordflow">if</span> (evt.type == MOUSE_MOVE)</div>
- <div class="line"> <a class="code hl_function" href="nuklear_8h.html#acdbdc5795b24d36875281cf3cac671fe">nk_input_motion</a>(&ctx, evt.motion.x, evt.motion.y);</div>
- <div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (evt.type == [...]) {</div>
- <div class="line"> nk_input_xxx(...);</div>
- <div class="line"> }</div>
- <div class="line"> }</div>
- <div class="line"> <a class="code hl_function" href="nuklear_8h.html#a15c0d237b6bb2f5195a09e259fd7b375">nk_input_end</a>(&ctx);</div>
- <div class="line"> <span class="comment">//</span></div>
- <div class="line"> <span class="comment">// Window</span></div>
- <div class="line"> <span class="keywordflow">if</span> (nk_begin_xxx(...) {</div>
- <div class="line"> <span class="comment">// Property</span></div>
- <div class="line"> <a class="code hl_function" href="nuklear_8h.html#a76e65dc775c0bd5efaa3c8f38f96823f">nk_layout_row_dynamic</a>(...);</div>
- <div class="line"> nk_property_int(ctx, <span class="stringliteral">"ID"</span>, INT_MIN, &value, INT_MAX, 1, 1);</div>
- <div class="line"> }</div>
- <div class="line"> <a class="code hl_function" href="nuklear_8h.html#ae0ade48c4c8df72456b9d97ab3d195e3">nk_end</a>(ctx);</div>
- <div class="line"> <span class="comment">//</span></div>
- <div class="line"> <span class="comment">// Draw</span></div>
- <div class="line"> <span class="keyword">const</span> <span class="keyword">struct </span><a class="code hl_struct" href="structnk__command.html">nk_command</a> *cmd = 0;</div>
- <div class="line"> <a class="code hl_define" href="nuklear_8h.html#aaca7101364db82c0f03401fafd2c66a6">nk_foreach</a>(cmd, &ctx) {</div>
- <div class="line"> <span class="keywordflow">switch</span> (cmd->type) {</div>
- <div class="line"> <span class="keywordflow">case</span> NK_COMMAND_LINE:</div>
- <div class="line"> your_draw_line_function(...)</div>
- <div class="line"> break;</div>
- <div class="line"> case NK_COMMAND_RECT</div>
- <div class="line"> your_draw_rect_function(...)</div>
- <div class="line"> break;</div>
- <div class="line"> case ...:</div>
- <div class="line"> <span class="comment">// [...]</span></div>
- <div class="line"> }</div>
- <div class="line"> <a class="code hl_function" href="nuklear_8h.html#ade3301f0a92370be1b4beac7eceac279">nk_clear</a>(&ctx);</div>
- <div class="line">}</div>
- <div class="line"><a class="code hl_function" href="nuklear_8h.html#a06772e194320fa99524681fd32df85e9">nk_free</a>(&ctx);</div>
- <div class="ttc" id="anuklear_8h_html_a06772e194320fa99524681fd32df85e9"><div class="ttname"><a href="nuklear_8h.html#a06772e194320fa99524681fd32df85e9">nk_free</a></div><div class="ttdeci">NK_API void nk_free(struct nk_context *)</div><div class="ttdoc">Frees all memory allocated by nuklear; Not needed if context was initialized with nk_init_fixed.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__context_8c_source.html#l00088">nuklear_context.c:88</a></div></div>
- <div class="ttc" id="anuklear_8h_html_a15c0d237b6bb2f5195a09e259fd7b375"><div class="ttname"><a href="nuklear_8h.html#a15c0d237b6bb2f5195a09e259fd7b375">nk_input_end</a></div><div class="ttdeci">NK_API void nk_input_end(struct nk_context *)</div><div class="ttdoc">End the input mirroring process by resetting mouse grabbing state to ensure the mouse cursor is not g...</div><div class="ttdef"><b>Definition</b> <a href="nuklear__input_8c_source.html#l00030">nuklear_input.c:30</a></div></div>
- <div class="ttc" id="anuklear_8h_html_a1dd51949401094f71d10429d45779d53"><div class="ttname"><a href="nuklear_8h.html#a1dd51949401094f71d10429d45779d53">nk_input_begin</a></div><div class="ttdeci">NK_API void nk_input_begin(struct nk_context *)</div><div class="ttdoc">Begins the input mirroring process by resetting text, scroll mouse, previous mouse position and movem...</div><div class="ttdef"><b>Definition</b> <a href="nuklear__input_8c_source.html#l00010">nuklear_input.c:10</a></div></div>
- <div class="ttc" id="anuklear_8h_html_a76e65dc775c0bd5efaa3c8f38f96823f"><div class="ttname"><a href="nuklear_8h.html#a76e65dc775c0bd5efaa3c8f38f96823f">nk_layout_row_dynamic</a></div><div class="ttdeci">NK_API void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols)</div><div class="ttdoc">Sets current row layout to share horizontal space between @cols number of widgets evenly.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__layout_8c_source.html#l00147">nuklear_layout.c:147</a></div></div>
- <div class="ttc" id="anuklear_8h_html_aaca7101364db82c0f03401fafd2c66a6"><div class="ttname"><a href="nuklear_8h.html#aaca7101364db82c0f03401fafd2c66a6">nk_foreach</a></div><div class="ttdeci">#define nk_foreach(c, ctx)</div><div class="ttdoc">Iterates over each draw command inside the context draw command list.</div><div class="ttdef"><b>Definition</b> <a href="nuklear_8h_source.html#l01031">nuklear.h:1031</a></div></div>
- <div class="ttc" id="anuklear_8h_html_acdbdc5795b24d36875281cf3cac671fe"><div class="ttname"><a href="nuklear_8h.html#acdbdc5795b24d36875281cf3cac671fe">nk_input_motion</a></div><div class="ttdeci">NK_API void nk_input_motion(struct nk_context *, int x, int y)</div><div class="ttdoc">Mirrors current mouse position to nuklear.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__input_8c_source.html#l00045">nuklear_input.c:45</a></div></div>
- <div class="ttc" id="anuklear_8h_html_ade3301f0a92370be1b4beac7eceac279"><div class="ttname"><a href="nuklear_8h.html#ade3301f0a92370be1b4beac7eceac279">nk_clear</a></div><div class="ttdeci">NK_API void nk_clear(struct nk_context *)</div><div class="ttdoc">Resets the context state at the end of the frame.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__context_8c_source.html#l00110">nuklear_context.c:110</a></div></div>
- <div class="ttc" id="anuklear_8h_html_ae0ade48c4c8df72456b9d97ab3d195e3"><div class="ttname"><a href="nuklear_8h.html#ae0ade48c4c8df72456b9d97ab3d195e3">nk_end</a></div><div class="ttdeci">NK_API void nk_end(struct nk_context *ctx)</div><div class="ttdef"><b>Definition</b> <a href="nuklear__window_8c_source.html#l00297">nuklear_window.c:297</a></div></div>
- <div class="ttc" id="astructnk__command_html"><div class="ttname"><a href="structnk__command.html">nk_command</a></div><div class="ttdoc">command base and header of every command inside the buffer</div><div class="ttdef"><b>Definition</b> <a href="nuklear_8h_source.html#l04467">nuklear.h:4467</a></div></div>
- <div class="ttc" id="astructnk__context_html"><div class="ttname"><a href="structnk__context.html">nk_context</a></div><div class="ttdef"><b>Definition</b> <a href="nuklear_8h_source.html#l05705">nuklear.h:5705</a></div></div>
- </div><!-- fragment --><h1><a class="anchor" id="autotoc_md95"></a>
- Reference</h1>
- <table class="markdownTable">
- <tr class="markdownTableHead">
- <th class="markdownTableHeadNone">Function </th><th class="markdownTableHeadNone">Description </th></tr>
- <tr class="markdownTableRowOdd">
- <td class="markdownTableBodyNone">nk_property_int </td><td class="markdownTableBodyNone">Integer property directly modifying a passed in value </td></tr>
- <tr class="markdownTableRowEven">
- <td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#a2ad0b76d6b0b29ba37ca1777953d4f89">nk_property_float</a> </td><td class="markdownTableBodyNone">Float property directly modifying a passed in value </td></tr>
- <tr class="markdownTableRowOdd">
- <td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#a6078e0bd051eadbaab18f5acea38e516">nk_property_double</a> </td><td class="markdownTableBodyNone">Double property directly modifying a passed in value </td></tr>
- <tr class="markdownTableRowEven">
- <td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#af079769a8700d947492b8b08977eeca2">nk_propertyi</a> </td><td class="markdownTableBodyNone">Integer property returning the modified int value </td></tr>
- <tr class="markdownTableRowOdd">
- <td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#a2030121357983cfabd73fadb997dbf04">nk_propertyf</a> </td><td class="markdownTableBodyNone">Float property returning the modified float value </td></tr>
- <tr class="markdownTableRowEven">
- <td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#ac5840ee35a5f6fcb30a086cf72afd991">nk_propertyd</a> </td><td class="markdownTableBodyNone">Double property returning the modified double value </td></tr>
- </table>
- <h1><a class="anchor" id="autotoc_md96"></a>
- # nk_property_int</h1>
- <p>Integer property directly modifying a passed in value !!! </p><dl class="section warning"><dt>Warning</dt><dd>To generate a unique property ID using the same label make sure to insert a <code>#</code> at the beginning. It will not be shown but guarantees correct behavior.</dd></dl>
- <div class="fragment"><div class="line"><span class="keywordtype">void</span> nk_property_int(<span class="keyword">struct</span> <a class="code hl_struct" href="structnk__context.html">nk_context</a> *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">int</span> min, <span class="keywordtype">int</span> *val, <span class="keywordtype">int</span> max, <span class="keywordtype">int</span> step, <span class="keywordtype">float</span> inc_per_pixel);</div>
- </div><!-- fragment --><table class="markdownTable">
- <tr class="markdownTableHead">
- <th class="markdownTableHeadNone">Parameter </th><th class="markdownTableHeadNone">Description </th></tr>
- <tr class="markdownTableRowOdd">
- <td class="markdownTableBodyNone"><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td></td></tr>
- </table>
- </dd>
- </dl>
- </td><td class="markdownTableBodyNone">Must point to an previously initialized <code><a class="el" href="structnk__context.html">nk_context</a></code> struct after calling a layouting function </td></tr>
- <tr class="markdownTableRowEven">
- <td class="markdownTableBodyNone"><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">name</td><td></td></tr>
- </table>
- </dd>
- </dl>
- </td><td class="markdownTableBodyNone">String used both as a label as well as a unique identifier </td></tr>
- <tr class="markdownTableRowOdd">
- <td class="markdownTableBodyNone"><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">min</td><td></td></tr>
- </table>
- </dd>
- </dl>
- </td><td class="markdownTableBodyNone">Minimum value not allowed to be underflown </td></tr>
- <tr class="markdownTableRowEven">
- <td class="markdownTableBodyNone"><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">val</td><td></td></tr>
- </table>
- </dd>
- </dl>
- </td><td class="markdownTableBodyNone">Integer pointer to be modified </td></tr>
- <tr class="markdownTableRowOdd">
- <td class="markdownTableBodyNone"><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">max</td><td></td></tr>
- </table>
- </dd>
- </dl>
- </td><td class="markdownTableBodyNone">Maximum value not allowed to be overflown </td></tr>
- <tr class="markdownTableRowEven">
- <td class="markdownTableBodyNone"><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">step</td><td></td></tr>
- </table>
- </dd>
- </dl>
- </td><td class="markdownTableBodyNone">Increment added and subtracted on increment and decrement button </td></tr>
- <tr class="markdownTableRowOdd">
- <td class="markdownTableBodyNone"><dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">inc_per_pixel</td><td></td></tr>
- </table>
- </dd>
- </dl>
- </td><td class="markdownTableBodyNone">Value per pixel added or subtracted on dragging </td></tr>
- </table>
- </div></div><!-- contents -->
- </div><!-- PageDoc -->
- </div><!-- doc-content -->
- <!-- start footer part -->
- <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
- <ul>
- <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
- </ul>
- </div>
- </body>
- </html>
|