]> icculus.org git repositories - divverent/nexuiz.git/blob - menu/mcontrols.qh
grappling hook
[divverent/nexuiz.git] / menu / mcontrols.qh
1 ///////////////////////////////////////////////
2 // Controls/Item Header File
3 ///////////////////////
4 // This file belongs to dpmod/darkplaces
5 // AK contains all item specific stuff
6 ////////////////////////////////////////////////
7 // constants
8 /*
9 Items/Controls:
10
11 This control is supported/required by the menu manager :
12 ITEM_WINDOW
13 (ITEM_REFERENCE)
14
15 The rest is not required:
16 ITEM_CUSTIOM
17
18 ITEM_PICTURE
19
20 ITEM_TEXT
21
22 ITEM_BUTTON
23 ITEM_TEXTBUTTON
24
25 ITEM_RECTANGLE
26
27 ITEM_SLIDER
28
29 ITEM_TEXTSWITCH
30 */
31
32 // item constants
33
34 // colors
35
36 // text colors
37 const vector ITEM_TEXT_NORMAL_COLOR     = '1 1 1';
38 const float      ITEM_TEXT_NORMAL_ALPHA         = 1;
39
40 const vector ITEM_TEXT_SELECTED_COLOR   = '0 0 1';
41 const float      ITEM_TEXT_SELECTED_ALPHA       = 1;
42
43 const vector ITEM_TEXT_PRESSED_COLOR    = '1 0 0';
44 const float      ITEM_TEXT_PRESSED_ALPHA        = 1;
45
46
47 // pitures
48 const vector ITEM_PICTURE_NORMAL_COLOR = '1 1 1';
49 const float      ITEM_PICTURE_NORMAL_ALPHA = 1;
50
51 const vector ITEM_PICTURE_SELECTED_COLOR = '1 1 1';
52 const float      ITEM_PICTURE_SELECTED_ALPHA = 1;
53
54 const vector ITEM_PICTURE_PRESSED_COLOR = '1 1 1';
55 const float      ITEM_PICTURE_PRESSED_ALPHA = 1;
56
57 // slider color
58 const vector ITEM_SLIDER_COLOR  = '1 1 1';
59 const float      ITEM_SLIDER_ALPHA      = 1;
60
61 // ITEM_SLIDER
62 const float      ITEM_SLIDER_STEP               = 1;
63 const float  ITEM_SLIDER_LEFT_MARGIN  = 7;
64 const float      ITEM_SLIDER_RIGHT_MARGIN = 7;
65
66 const string ITEM_SLIDER_DEFAULT_BAR = "gfx/m_sliderbar";
67 const string ITEM_SLIDER_DEFAULT_SLIDER = "gfx/m_slider";
68
69 // used only in non-picture mode
70 const vector ITEM_SLIDER_BAR_COLOR_DELTA = '-0.8 -0.8 0';
71
72 const vector ITEM_SLIDER_SIZE           = '10 10 0';
73
74 // ITEM_BUTTON/ITEM_TEXTBUTTON
75
76 const float             ITEM_BUTTON_HOLD_PRESSED        = 0.2;
77
78 const float             TEXTBUTTON_STYLE_BOX            = 2;
79 const float             TEXTBUTTON_STYLE_OUTLINE        = 1;
80 const float             TEXTBUTTON_STYLE_TEXT           = 0;
81
82 const float             TEXTBUTTON_OUTLINE_WIDTH        = 1.0;
83
84 //ITEM_TEXT
85 const vector    ITEM_TEXT_FONT_SIZE = '11 11 0';
86
87 const float     TEXT_ALIGN_LEFT         = 0;
88 const float             TEXT_ALIGN_CENTER       = 1;
89 const float     TEXT_ALIGN_RIGHT        = 2;
90 const float             TEXT_ALIGN_RIGHTPOS     = 4;    // |text - actually this isnt necessary
91 const float             TEXT_ALIGN_CENTERPOS    = 8;    // te|xt
92 const float     TEXT_ALIGN_LEFTPOS              = 16;   // text|
93
94 // ITEM_BUTTON/ITEM_TEXTBUTTON states
95 const float             BUTTON_NORMAL   = 0;
96 const float             BUTTON_SELECTED = 1;
97 const float             BUTTON_PRESSED  = 2;
98
99 // ITEM_EDITBOX constantes
100 const float             EDITBOX_CURSOR_FREQ = 1;
101
102 // flags constant
103
104 const float     FLAG_STANDARD           = 1;    // use this flag if you want the standard behavior and not what the control recommends
105 const float FLAG_HIDDEN                 = 2;    // events wont be called and it wont be drawn, etc.
106 const float FLAG_NOSELECT               = 4;    // cant be selected (but events will be called)
107 const float FLAG_CONNECTEDONLY  = 8;    // only if connected (i.e. playing)
108 const float FLAG_SERVERONLY             = 16;   // only displayed if server
109 const float FLAG_DEVELOPERONLY  = 32;   // only displayed if developer
110 const float _FLAG_MOUSEINAREA   = 64;   // used to determine wheter to call mouse_enter/_leave
111 const float FLAG_DRAWONLY               = 128;  // only the draw event will be called
112 const float     FLAG_AUTOSETCLICK       = 256;  // used to make click_pos and click_size always the same as pos and size
113 const float FLAG_AUTOSETCLIP    = 512;  // used to make clip_pos/_size always the same like pos and size
114 const float FLAG_CHILDDRAWONLY  = 1024; // used to make the children only drawable
115 const float FLAG_DRAWREFRESHONLY= 2048; // only the draw and refresh event get called
116 const float FLAG_CHILDDRAWREFRESHONLY = 4096;
117
118 // control fields
119 // fields used by multiple items
120 .vector color;
121 .float  alpha;
122 .float  drawflag;
123
124 // ITEM_REFERENCE
125 .string link; // window link
126
127 // ITEM_PICTURE
128 .string picture;
129 .vector pos;
130 .vector size;
131
132 // ITEM_TEXT
133 .string text;
134 .vector font_size;
135 .float  alignment;
136
137 // ITEM_BUTTON
138 .string picture_selected;
139 .string picture_pressed;
140 .string sound_selected;
141 .string sound_pressed;
142
143 .vector color_selected;
144 .vector color_pressed;
145 .float  alpha_selected;
146 .float  alpha_pressed;
147 .float  drawflag_selected;
148 .float  drawflag_pressed;
149
150 .float  _press_time;
151 .float  hold_pressed;
152
153 .float  _button_state;
154
155 // ITEM_TEXTBUTTON
156 //.string       text;
157 //.vector       font_size;
158 //.float        alignment;
159 .float          style;
160
161 // ITEM_SLIDER
162 //.string       picture_slider; = picture
163 .string         picture_bar;
164 .string         sound_increase;
165 .string         sound_decrease;
166
167 .float          min_value;
168 .float          max_value;
169 .float          value;
170
171 .float          step;
172
173 .vector         slider_size;
174 .float          left_margin;
175 .float          right_margin;
176
177 .void(void) slidermove;
178
179 // ITEM_TEXTSWITCH (derived from ITEM_TEXT mostly)
180 //.string       text;   // like above
181 //.float        value;  // the current displayed/selected text
182
183 .void(void) switchchange;
184
185 // ITEM_EDITBOX (derived from ITEM_TEXT mostly)
186 .string format; // //wildcards are * for each letter except the next after it - \* for * and */ space ' ' for one letter e.g. "   .   .   .   " for an ip field
187 .float maxlen; // -1 for infinite
188 .float _cursorpos;
189 // functions
190
191 /*void(void) ctinit_picture;
192 void(void) ctinit_button;
193 void(void) ctinit_textbutton;*/