/usr/share/doc/s3d/ch03s02.html is in s3d-doc 0.2.2-14.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>function reference</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><meta name="keywords" content="s3d, API, handbook, guide" /><link rel="home" href="index.html" title="S3D - a 3D Desktop Environment" /><link rel="up" href="ch03.html" title="Chapter 3. libs3dw - The S3D Widget Library" /><link rel="prev" href="ch03.html" title="Chapter 3. libs3dw - The S3D Widget Library" /><link rel="next" href="ch03s03.html" title="Data types" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">function reference</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><th width="60%" align="center">Chapter 3. libs3dw - The S3D Widget Library</th><td width="20%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="functions_s3dw"></a>function reference</h2></div></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_button_new"></a>s3dw_button_new</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">s3dw_button *<strong class="fsfunc">s3dw_button_new</strong>(</code></td><td>const s3dw_surface *<var class="pdparam">surface</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">text</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">posx</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">posy</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Creates a new button on the surface, with "text" written on it and the upper left corner at (posx,posy) on the surface.</p><p>See <a class="link" href="ch03s03.html#s3dw_button" title="typedef s3dw_button">s3dw_button</a> for information about callbacks which may be defined. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_label_new"></a>s3dw_label_new</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">s3dw_label *<strong class="fsfunc">s3dw_label_new</strong>(</code></td><td>const s3dw_surface *<var class="pdparam">surface</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">text</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">posx</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">posy</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Creates a new label on the surface, with "text" written on it and the upper left corner at (posx,posy) on the surface.</p><p>See <a class="link" href="ch03s03.html#s3dw_label" title="typedef s3dw_label">s3dw_label</a> for information about callbacks which may be defined. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_input_new"></a>s3dw_input_new</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">s3dw_input *<strong class="fsfunc">s3dw_input_new</strong>(</code></td><td>const s3dw_surface *<var class="pdparam">surface</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">width</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">posx</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">posy</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Creates a new input-box on the surface with a input width of "width", the upper left corner at (posx,posy) on the surface. The input-box is empty on creation and can be change with <a class="link" href="ch03s02.html#s3dw_input_change_text" title="s3dw_input_change_text">s3dw_input_change_text</a>, and received with <a class="link" href="ch03s02.html#s3dw_input_gettext" title="s3dw_input_gettext">s3dw_input_gettext</a></p><p>See <a class="link" href="ch03s03.html#s3dw_input" title="typedef s3dw_input">s3dw_input</a> for information about callbacks which may be defined. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_textbox_new"></a>s3dw_textbox_new</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">s3dw_textbox *<strong class="fsfunc">s3dw_textbox_new</strong>(</code></td><td>const s3dw_surface *<var class="pdparam">surface</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">text</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">posx</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">posy</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">width</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">height</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Creates a new textbox on the surface, with "text" written on it and the upper left corner at (posx,posy) on the surface. Width and height define the size of the textbox including scrollbars which are rendered around the textfield.</p><p>See <a class="link" href="ch03s03.html#s3dw_textbox" title="typedef s3dw_textbox">s3dw_textbox</a> for information about callbacks which may be defined. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_input_gettext"></a>s3dw_input_gettext</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">char *<strong class="fsfunc">s3dw_input_gettext</strong>(</code></td><td>s3dw_input *<var class="pdparam">input</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the text which is currently entered in the referenced input-box. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_input_change_text"></a>s3dw_input_change_text</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_input_change_text</strong>(</code></td><td>s3dw_input *<var class="pdparam">input</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">text</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Change the text in the referenced input-box to the specified text. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_label_change_text"></a>s3dw_label_change_text</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_label_change_text</strong>(</code></td><td>s3dw_label *<var class="pdparam">label</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">text</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Change the text in the referenced label to the specified text. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_surface_new"></a>s3dw_surface_new</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">s3dw_surface *<strong class="fsfunc">s3dw_surface_new</strong>(</code></td><td>const char *<var class="pdparam">title</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">width</var>, </td></tr><tr><td> </td><td>float <var class="pdparam">height</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Creates a new surface (a new window) with title "title" and dimension "width" x "height".</p><p>See <a class="link" href="ch03s03.html#s3dw_surface" title="typedef s3dw_surface">s3dw_surface</a> for information about callbacks which may be defined. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_getroot"></a>s3dw_getroot</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">s3dw_widget *<strong class="fsfunc">s3dw_getroot</strong>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the root-widget, which holds all the surfaces. E.g. if you want to move all widgets at once, adjust the root-widgets x,y,z and use <a class="link" href="ch03s02.html#s3dw_moveit" title="s3dw_moveit">s3dw_moveit</a>()</p><pre class="programlisting"> <a class="link" href="ch03s03.html#s3dw_widget" title="typedef s3dw_widget">s3dw_widget</a> *root = <a class="link" href="ch03s02.html#s3dw_getroot" title="s3dw_getroot">s3dw_getroot</a>();
// move widget center to (0,5,0). upon creation, it's centered at (0,0,0),
// so this might move it up
root->x=0;
root->y=5;
root->z=0;
<a class="link" href="ch03s02.html#s3dw_moveit" title="s3dw_moveit">s3dw_moveit</a>(root);
</pre></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_moveit"></a>s3dw_moveit</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_moveit</strong>(</code></td><td>s3dw_widget *<var class="pdparam">widget</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Moves/translates the widget as you specified in it's private <a class="link" href="ch03s03.html#s3dw_widget" title="typedef s3dw_widget">s3dw_widget</a> structure. Should be casted with S3DWIDGET(). </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_delete"></a>s3dw_delete</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_delete</strong>(</code></td><td>s3dw_widget *<var class="pdparam">widget</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Deletes any widget. Should be casted with S3DWIDGET(). </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_show"></a>s3dw_show</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_show</strong>(</code></td><td>s3dw_widget *<var class="pdparam">widget</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Switches a widget visible. Should be casted with S3DWIDGET(). </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_focus"></a>s3dw_focus</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_focus</strong>(</code></td><td>s3dw_widget *<var class="pdparam">focus</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Gives focus to the widget, relative to its parent. That means you can focus a surface, and each surface can focus one of its element, e.g. an input field. Should be casted with S3DWIDGET(). </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_textbox_scrollup"></a>s3dw_textbox_scrollup</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_textbox_scrollup</strong>(</code></td><td>s3dw_textbox *<var class="pdparam">textbox</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Scrolls the text in the textbox up by one line, if possible. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_textbox_scrolldown"></a>s3dw_textbox_scrolldown</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_textbox_scrolldown</strong>(</code></td><td>s3dw_textbox *<var class="pdparam">textbox</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Scrolls the text in the textbox down by one line, if possible. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_textbox_scrollleft"></a>s3dw_textbox_scrollleft</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_textbox_scrollleft</strong>(</code></td><td>s3dw_textbox *<var class="pdparam">textbox</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Scrolls the text in the textbox to the left by one character, if possible. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_textbox_scrollright"></a>s3dw_textbox_scrollright</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_textbox_scrollright</strong>(</code></td><td>s3dw_textbox *<var class="pdparam">textbox</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Scrolls the text in the textbox to the right by one character, if possible. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_textbox_scrollto"></a>s3dw_textbox_scrollto</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_textbox_scrollto</strong>(</code></td><td>s3dw_textbox *<var class="pdparam">textbox</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">x</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">y</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Scrolls the text in the textbox so that the character in row y, column x is in the top left corner of the textbox. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_textbox_change_text"></a>s3dw_textbox_change_text</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_textbox_change_text</strong>(</code></td><td>s3dw_textbox *<var class="pdparam">textbox</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">text</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Change the text in the referenced textbox to the specified text. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_handle_click"></a>s3dw_handle_click</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <strong class="fsfunc">s3dw_handle_click</strong>(</code></td><td>const struct s3d_evt *<var class="pdparam">event</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If you want your widgets on mouseclicks (believe me, you want that), you have to call this either in your clickhandler-function or specify it itself as the clickhandler.</p><pre class="programlisting"> // way 1:
<a class="link" href="ch02s02.html#s3d_set_callback" title="s3d_set_callback">s3d_set_callback</a>(S3D_EVENT_OBJ_CLICK,<a class="link" href="ch03s02.html#s3dw_handle_click" title="s3dw_handle_click">s3dw_handle_click</a>);
// way 2:
...
void click(struct <a class="link" href="ch02s03.html#structs3d_evt" title="struct s3d_evt">s3d_evt</a> *evt)
{
<a class="link" href="ch03s02.html#s3dw_handle_click" title="s3dw_handle_click">s3dw_handle_click</a>(evt);
....
// your own clickhandler code
...
}
....
<a class="link" href="ch02s02.html#s3d_set_callback" title="s3d_set_callback">s3d_set_callback</a>(S3D_EVENT_OBJ_CLICK,click);
</pre></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_handle_key"></a>s3dw_handle_key</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <strong class="fsfunc">s3dw_handle_key</strong>(</code></td><td>const struct s3d_evt *<var class="pdparam">event</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This is somehow useful to call in your keyhandler functions if you want to have input-boxes work. ;)</p><pre class="programlisting"> // way 1:
<a class="link" href="ch02s02.html#s3d_set_callback" title="s3d_set_callback">s3d_set_callback</a>(S3D_EVENT_KEY,<a class="link" href="ch03s02.html#s3dw_handle_key" title="s3dw_handle_key">s3dw_handle_key</a>);
// way 2:
...
void key(struct <a class="link" href="ch02s03.html#structs3d_evt" title="struct s3d_evt">s3d_evt</a> *evt)
{
<a class="link" href="ch03s02.html#s3dw_handle_key" title="s3dw_handle_key">s3dw_handle_key</a>(evt);
....
// your own keyhandler code
...
}
....
<a class="link" href="ch02s02.html#s3d_set_callback" title="s3d_set_callback">s3d_set_callback</a>(S3D_EVENT_KEY,key);
</pre></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_object_info"></a>s3dw_object_info</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <strong class="fsfunc">s3dw_object_info</strong>(</code></td><td>struct s3d_evt *<var class="pdparam">event</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This can be used to let s3dw handle S3D_EVENT_OBJ_INFO-events. With this, s3dw can consider the camera position and makes things like following the camera possible. </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="s3dw_ani_mate"></a>s3dw_ani_mate</h3></div></div></div><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <s3dw.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">s3dw_ani_mate</strong>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Just call this in your mainloop if you want some nice window sliding animations. it's somewhat bloating, but you don't want to miss it ;)</p><pre class="programlisting"> #include <time.h> // nanosleep()
static struct timespec t={0.33*1000*1000}; // 33 mili seconds
void mainloop()
{
// keep this in your mainloop. this will do smooth animations for you ...
<a class="link" href="ch03s02.html#s3dw_ani_mate" title="s3dw_ani_mate">s3dw_ani_mate</a>();
nanosleep(&t,NULL);
}
....
<a class="link" href="ch02s02.html#s3d_mainloop" title="s3d_mainloop">s3d_mainloop</a>(mainloop);
</pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. libs3dw - The S3D Widget Library </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Data types</td></tr></table></div></body></html>
|