mirror of
https://github.com/Immediate-Mode-UI/Nuklear.git
synced 2026-11-30 16:48:10 +01:00
251 lines
14 KiB
HTML
251 lines
14 KiB
HTML
<!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.15.0"/>
|
|
<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>
|
|
<script type="text/javascript" src="clipboard.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript" src="cookie.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">
|
|
$(function() { init_search(); });
|
|
</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">Minimal-state, immediate-mode graphical user interface toolkit written in ANSI C.</div>
|
|
</td>
|
|
<td> <div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<span id="MSearchSelect" class="search-icon" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"><span class="search-icon-dropdown"></span></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()"><div id="MSearchCloseImg" class="close-icon"></div></a>
|
|
</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.15.0 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
|
</script>
|
|
<script type="text/javascript">
|
|
$(function() { codefold.init(); });
|
|
</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">
|
|
$(function(){initNavTree('Properties.html','',''); });
|
|
</script>
|
|
<div id="container">
|
|
<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 class="doxsection"><a class="anchor" id="autotoc_md100"></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 <span class="tt">limits.h</span>. For example <span class="tt">INT_MIN</span> and <span class="tt">INT_MAX</span> for <span class="tt">nk_property_int</span> and <span class="tt">nk_propertyi</span>. 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"> nk_input_begin(&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"> nk_input_motion(&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"> nk_input_end(&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"> nk_layout_row_dynamic(...);</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"> nk_end(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"> nk_foreach(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"> nk_clear(&ctx);</div>
|
|
<div class="line">}</div>
|
|
<div class="line">nk_free(&ctx);</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#l04577">nuklear.h:4577</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#l05843">nuklear.h:5843</a></div></div>
|
|
</div><!-- fragment --><h1 class="doxsection"><a class="anchor" id="autotoc_md101"></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">nk_property_float </td><td class="markdownTableBodyNone">Float property directly modifying a passed in value </td></tr>
|
|
<tr class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">nk_property_double </td><td class="markdownTableBodyNone">Double property directly modifying a passed in value </td></tr>
|
|
<tr class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">nk_propertyi </td><td class="markdownTableBodyNone">Integer property returning the modified int value </td></tr>
|
|
<tr class="markdownTableRowOdd">
|
|
<td class="markdownTableBodyNone">nk_propertyf </td><td class="markdownTableBodyNone">Float property returning the modified float value </td></tr>
|
|
<tr class="markdownTableRowEven">
|
|
<td class="markdownTableBodyNone">nk_propertyd </td><td class="markdownTableBodyNone">Double property returning the modified double value </td></tr>
|
|
</table>
|
|
<h1 class="doxsection"><a class="anchor" id="autotoc_md102"></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 <span class="tt">#</span> at the beginning. It will not be shown but guarantees correct behavior.</dd></dl>
|
|
<div class="fragment"><div class="line">nk_bool 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 <span class="tt"><a class="el" href="structnk__context.html">nk_context</a></span> 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>
|
|
<dl class="section return"><dt>Returns</dt><dd><span class="tt">true(1)</span> if the value changed </dd></dl>
|
|
</div></div><!-- contents -->
|
|
</div><!-- PageDoc -->
|
|
</div><!-- doc-content -->
|
|
<div id="page-nav" class="page-nav-panel">
|
|
<div id="page-nav-resize-handle"></div>
|
|
<div id="page-nav-tree">
|
|
<div id="page-nav-contents">
|
|
</div><!-- page-nav-contents -->
|
|
</div><!-- page-nav-tree -->
|
|
</div><!-- page-nav -->
|
|
</div><!-- container -->
|
|
<!-- 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.15.0 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|