File: structs.docbook

package info (click to toggle)
s3d 0.2.2.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 5,356 kB
  • sloc: ansic: 21,128; python: 488; perl: 98; makefile: 31; sh: 29
file content (83 lines) | stat: -rw-r--r-- 5,513 bytes parent folder | download | duplicates (8)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<sect2 id="struct_s3dw_style"><title>struct _s3dw_style</title><programlisting>struct <link linkend="struct_s3dw_style">_s3dw_style</link> {
	const char *name;
	const char *fontface;
	float surface_mat;
	float input_mat;
	float inputback_mat;
	float text_mat;
	float title_mat;
	float title_text_mat;
}</programlisting><para>With <link linkend="s3dw_style">s3dw_style</link> you can change the colors/materials of your widgets. materials are in the same as in <link linkend="s3d_push_materials_a">s3d_push_materials_a</link>, that means red,green,blue and alpha float values (between 0.0 and 1.0) for ambience, specular and diffuse color.     </para><variablelist><varlistentry><term>name</term><listitem><para>name of the style ... kind of redundant         </para></listitem></varlistentry><varlistentry><term>fontface</term><listitem><para>font face for all used fonts         </para></listitem></varlistentry><varlistentry><term>surface_mat</term><listitem><para>material for the surface background         </para></listitem></varlistentry><varlistentry><term>input_mat</term><listitem><para>material for button boxes and other widgets         </para></listitem></varlistentry><varlistentry><term>inputback_mat</term><listitem><para>material for input field background         </para></listitem></varlistentry><varlistentry><term>text_mat</term><listitem><para>material for the text on buttons and inputs         </para></listitem></varlistentry><varlistentry><term>title_mat</term><listitem><para>material for the title bar         </para></listitem></varlistentry><varlistentry><term>title_text_mat</term><listitem><para>material for the text on the title bar         </para></listitem></varlistentry></variablelist></sect2>
<sect2 id="struct_s3dw_widget"><title>struct _s3dw_widget</title><programlisting>struct <link linkend="struct_s3dw_widget">_s3dw_widget</link> {
	int type;
	s3dw_widget *parent;
	s3dw_style *style;
	int nobj;
	s3dw_widget **pobj;
	int focus;
	int flags;
	float ax;
	float ay;
	float az;
	float as;
	float arx;
	float ary;
	float arz;
	float width;
	float height;
	uint32_t oid;
	void *ptr;
	float x;
	float y;
	float z;
	float s;
	float rx;
	float ry;
	float rz;
}</programlisting><para>This is the most basic widget type, it contains all the &quot;general&quot; widget information. If you want to move a widget, you'd change x,y,z,s and rx,ry,rz and call <link linkend="s3dw_moveit">s3dw_moveit</link> to turn your action reality. Every other widget has this type as first entry, so a simple typecast to <link linkend="s3dw_widget">s3dw_widget</link> will give you the widgets &quot;general&quot; information. For typecast, you may use S3DWIDGET().</para><para>The pointer ptr allows linking to user-specific data structures. That comes in handy if the widget is called back by an event, and the program must now find out on which data the user reacted.     </para></sect2>
<sect2 id="struct_s3dw_button"><title>struct _s3dw_button</title><programlisting>struct <link linkend="struct_s3dw_button">_s3dw_button</link> {
	s3dw_widget widget;
	char *text;
	uint32_t oid_text;
	s3dw_callback onclick;
}</programlisting><para>The buttons is just a button as you would expect it in a 2D widget library. It only reacts on clicks.     </para></sect2>
<sect2 id="struct_s3dw_label"><title>struct _s3dw_label</title><programlisting>struct <link linkend="struct_s3dw_label">_s3dw_label</link> {
	s3dw_widget widget;
	char *text;
	s3dw_callback onclick;
}</programlisting><para>The labels is an label-field where a user may type things. onclick reacts on click in the field.     </para></sect2>
<sect2 id="struct_s3dw_scrollbar"><title>struct _s3dw_scrollbar</title><programlisting>struct <link linkend="struct_s3dw_scrollbar">_s3dw_scrollbar</link> {
	s3dw_widget widget;
	float pos;
	float max;
	int type;
	int loid;
	int roid;
	int baroid;
	s3dw_callback lonclick;
	s3dw_callback ronclick;
}</programlisting><para>The Scrollbar should be placed around scrollable content. Currently only the left and right icons are clickable (lonclick and ronclick callbacks), in vertical mode lonclick is the callback for the up icon, ronclick the callback for the down icon.     </para></sect2>
<sect2 id="struct_s3dw_textbox"><title>struct _s3dw_textbox</title><programlisting>struct <link linkend="struct_s3dw_textbox">_s3dw_textbox</link> {
	s3dw_widget widget;
	s3dw_scrollbar *scroll_vertical;
	s3dw_scrollbar *scroll_horizontal;
	char *text;
	int n_lineoids;
	int *p_lineoids;
	int window_x;
	int window_y;
	s3dw_callback onclick;
}</programlisting><para>A textbox shows some text with scrollbars to scroll around. It can currently only react to a click event.     </para></sect2>
<sect2 id="struct_s3dw_input"><title>struct _s3dw_input</title><programlisting>struct <link linkend="struct_s3dw_input">_s3dw_input</link> {
	s3dw_widget widget;
	char *text;
	uint32_t oid_text;
	s3dw_callback onclick;
	s3dw_callback onedit;
}</programlisting><para>The inputs is an input-field where a user may type things. onclick reacts on click in the field, onedit notifies you when someone writes in the field.     </para></sect2>
<sect2 id="struct_s3dw_surface"><title>struct _s3dw_surface</title><programlisting>struct <link linkend="struct_s3dw_surface">_s3dw_surface</link> {
	s3dw_widget widget;
	uint32_t oid_title;
	uint32_t oid_tbar;
	char *title;
}</programlisting><para>A surface is the window of this widget library, holding all of our elements like buttons, input fields etc ...     </para></sect2>