Debian Codegraph @

Descent3/newui_core.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Source: $
21 * $Revision: 27 $
22 * $Author: Samir $
23 * $Date: 4/29/99 2:18a $
24 *
25 * new NewUI Header
26 *
27 * $Log: /DescentIII/main/newui_core.h $
28 *
29 * 27 4/29/99 2:18a Samir
30 * updated art for options style menu.
31 *
32 * 26 4/28/99 1:54a Samir
33 * visual tweaks to text
34 *
35 * 25 4/27/99 2:13p Matt
36 * Replaced the two (new) new UI fonts with one new font from Doug.
37 *
38 * 24 4/27/99 9:24a Matt
39 * Added system for drawing title bars on dialogs.
40 *
41 * 23 4/26/99 7:46p Samir
42 * newuiTiledWindow flags passed to create is an int now.
43 *
44 * 22 4/21/99 10:58a Samir
45 * added changable text.
46 *
47 * 21 4/20/99 11:46a Samir
48 * numerous ui 'feel' fixes.
49 *
50 * 20 4/18/99 7:55p Samir
51 * fixed listbox double click and added functions to load and release
52 * pertinent newui graphic data.
53 *
54 * 19 4/15/99 5:28p Samir
55 * added advanced messagebox
56 *
57 * 18 4/05/99 5:13p Samir
58 * fixed combo box asthetics.
59 *
60 */
61
62 #ifndef NEWUI_CORE_H
63 #define NEWUI_CORE_Hcxx . . $ `Descent3/newui_core.h:63:9`!
64
65 #include "ui.h"cxx . . $ `<file>/ui/ui.h`/
66
67 #define N_NEWUI_BMPScxx . . $ `Descent3/newui_core.h:67:9`! 32 // number of ui bitmaps.
68 #define N_NEWUI_SHEETScxx . . $ `Descent3/newui_core.h:68:9`! 8 // number of sheets allowed in a menu.
69
70 #define NEWUI_MONITORFONT_COLORcxx . . $ `Descent3/newui_core.h:70:9`! GR_GREEN // GR_RGB(255,255,255)
71 #define NEWUI_GADGETFONT_COLORcxx . . $ `Descent3/newui_core.h:71:9`! GR_BLACK // GR_RGB(255,255,255)
72
73 #define NEWUI_GADGETFONT_HICOLORcxx . . $ `Descent3/newui_core.h:73:9`! GR_RGB(192, 192, 0)
74
75 #ifndef MSGBOX_OK
76 // types of message boxes
77 #define MSGBOX_NULLcxx . . $ `Descent3/newui_core.h:77:9`! 0
78 #define MSGBOX_OKcxx . . $ `Descent3/newui_core.h:78:9`! 1
79 #define MSGBOX_OKCANCELcxx . . $ `Descent3/newui_core.h:79:9`! 2
80 #define MSGBOX_YESNOcxx . . $ `Descent3/newui_core.h:80:9`! 3
81 #endif
82
83 // used internally for ease of management
84 #define N_DIRECTIONScxx . . $ `Descent3/newui_core.h:84:9`! 12
85 #define N_PIECE_IDXcxx . . $ `Descent3/newui_core.h:85:9`! 0
86 #define NE_PIECE_IDXcxx . . $ `Descent3/newui_core.h:86:9`! 1
87 #define E_PIECE_IDXcxx . . $ `Descent3/newui_core.h:87:9`! 2
88 #define SE_PIECE_IDXcxx . . $ `Descent3/newui_core.h:88:9`! 3
89 #define S_PIECE_IDXcxx . . $ `Descent3/newui_core.h:89:9`! 4
90 #define SW_PIECE_IDXcxx . . $ `Descent3/newui_core.h:90:9`! 5
91 #define W_PIECE_IDXcxx . . $ `Descent3/newui_core.h:91:9`! 6
92 #define NW_PIECE_IDXcxx . . $ `Descent3/newui_core.h:92:9`! 7
93 #define C_PIECE_IDXcxx . . $ `Descent3/newui_core.h:93:9`! 8
94 #define TL_PIECE_IDXcxx . . $ `Descent3/newui_core.h:94:9`! 9
95 #define TC_PIECE_IDXcxx . . $ `Descent3/newui_core.h:95:9`! 10
96 #define TR_PIECE_IDXcxx . . $ `Descent3/newui_core.h:96:9`! 11
97
98 // types of 'arrow' buttons used in newuiArrowButton
99 #define NEWUI_ARROW_LEFTcxx . . $ `Descent3/newui_core.h:99:9`! 0x1
100 #define NEWUI_ARROW_RIGHTcxx . . $ `Descent3/newui_core.h:100:9`! 0x2
101 #define NEWUI_ARROW_UPcxx . . $ `Descent3/newui_core.h:101:9`! 0x3
102 #define NEWUI_ARROW_DOWNcxx . . $ `Descent3/newui_core.h:102:9`! 0x4
103 #define NEWUI_ARROW_CBUPcxx . . $ `Descent3/newui_core.h:103:9`! 0x5
104 #define NEWUI_ARROW_CBDOWNcxx . . $ `Descent3/newui_core.h:104:9`! 0x6
105
106 // initializes the core system for the newui
107 void newuiCore_Initcxx . . $ newuiCore_Init(49f6e7a06ebc5aa8).();
108
109 // initializes the core system for the newui
110 void newuiCore_Closecxx . . $ newuiCore_Close(49f6e7a06ebc5aa8).();
111
112 // touches all newui bitmaps, do before any newui menus open
113 void newuiCore_PageInBitmapscxx . . $ newuiCore_PageInBitmaps(49f6e7a06ebc5aa8).();
114
115 // call when NO newui menus open
116 void newuiCore_ReleaseBitmapscxx . . $ newuiCore_ReleaseBitmaps(49f6e7a06ebc5aa8).();
117
118 // C interface to load and free bitmap resources
119 UIBitmapItemcxx . . $ UIBitmapItem# *newui_LoadBitmapcxx . . $ newui_LoadBitmap(9af3ea6534c90d0f).(const char *filename);
120
121 // C interface to load and free bitmap resources
122 void newui_FreeBitmapcxx . . $ newui_FreeBitmap(4dc4c37c6aa93e7c).(UIBitmapItemcxx . . $ UIBitmapItem# *bmitem);
123
124 // sets the callback for background rendering of desktop for UI
125 #define DEFAULT_UICALLBACKcxx . . $ `Descent3/newui_core.h:125:9`! ((void (*)())1)
126
127 void SetUICallbackcxx . . $ SetUICallback(964b12a25712bdc3).(void (*fn)());
128 void (*GetUICallbackcxx . . $ GetUICallback(9f019fced98557ce).())();
129
130 // predefined return values for DoUI or UI_frame_result.
131 #define NEWUIRES_FORCEQUITcxx . . $ `Descent3/newui_core.h:131:9`! -2
132
133 // does a UI loop: returns a result value for the current window in focus.
134 int DoUIcxx . . $ DoUI(b126dc7c1de90089).();
135
136 // does one frame of UI input (returns result.)
137 void DoUIFramecxx . . $ DoUIFrame(49f6e7a06ebc5aa8).();
138
139 // does one frame of UI without polling input.
140 void DoUIFrameWithoutInputcxx . . $ DoUIFrameWithoutInput(49f6e7a06ebc5aa8).();
141
142 // gets frame result of ui input.
143 int GetUIFrameResultcxx . . $ GetUIFrameResult(b126dc7c1de90089).();
144
145 //////////////////////////////////////////////////////////////////////////////
146
147 // CLASS simple buttons
148
149 class newuiSlidercxx . . $ newuiSlider#;
150 class newuiCheckBoxcxx . . $ newuiCheckBox#;
151 class newuiRadioButtoncxx . . $ newuiRadioButton#;
152 class newuiButtoncxx . . $ newuiButton#;
153 class newuiMenucxx . . $ newuiMenu#;
154 class newuiListBoxcxx . . $ newuiListBox#;
155 class newuiEditBoxcxx . . $ newuiEditBox#;
156 class newuiComboBoxcxx . . $ newuiComboBox#;
157 class newuiHotspotcxx . . $ newuiHotspot#;
158
159 #define DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`! -5
160
161 enum tAlignmentcxx . . $ tAlignment# { NEWUI_ALIGN_VERTcxx . . $ NEWUI_ALIGN_VERT., NEWUI_ALIGN_HORIZcxx . . $ NEWUI_ALIGN_HORIZ. };
162
163 #define SLIDER_UNITS_INTcxx . . $ `Descent3/newui_core.h:163:9`! 0
164 #define SLIDER_UNITS_PERCENTcxx . . $ `Descent3/newui_core.h:164:9`! 1
165 #define SLIDER_UNITS_FLOATcxx . . $ `Descent3/newui_core.h:165:9`! 2
166
167 // used optionally for sliders.
168 struct tSliderSettingscxx . . $ tSliderSettings# {
169 unioncxx . . $ tSliderSettings#$anonymous_type_0# {
170 int icxx . . $ tSliderSettings#$anonymous_type_0#i.;
171 float fcxx . . $ tSliderSettings#$anonymous_type_0#f.;
172 } min_valcxx . . $ tSliderSettings#min_val.;
173 unioncxx . . $ tSliderSettings#$anonymous_type_1# {
174 int icxx . . $ tSliderSettings#$anonymous_type_1#i.;
175 float fcxx . . $ tSliderSettings#$anonymous_type_1#f.;
176 } max_valcxx . . $ tSliderSettings#max_val.;
177 int typecxx . . $ tSliderSettings#type.; // enumerated above in SLIDER_UNITS
178 };
179
180 #define NEWUI_EDIT_CANCELED_STRcxx . . $ `Descent3/newui_core.h:180:9`! "\1" // if a newuiEditbox returns this, then we cancelled. invalid string
181
182 #define NEWUI_EDIT_BUFLENcxx . . $ `Descent3/newui_core.h:182:9`! 63
183
184 #define NEWUI_BTNF_FRAMEDcxx . . $ `Descent3/newui_core.h:184:9`! UIF_CUSTOMFcxx . . $ `ui/ui.h:352:9`! // when Adding a button, this button have 'framed' art.
185 #define NEWUI_BTNF_LONGcxx . . $ `Descent3/newui_core.h:185:9`! (UIF_CUSTOMFcxx . . $ `ui/ui.h:352:9`! << 1) // button will be a long version (with art)
186
187 // CLASS contains gadgets
188
189 class newuiSheetcxx . . $ newuiSheet# {
190 int m_sxcxx . . $ newuiSheet#m_sx., m_sycxx . . $ newuiSheet#m_sy.; // origin of sheet gadgets relative to parent.
191 int16_tcxx . . $ int16_t# m_initial_focus_idcxx . . $ newuiSheet#m_initial_focus_id.; // gadget that will have focus upon realization.
192
193 public:
194 newuiSheetcxx . . $ newuiSheet#newuiSheet(49f6e7a06ebc5aa8).();
195
196 // called usually by other classes, used to initialize the sheet
197 void Createcxx . . $ newuiSheet#Create(d9d4491c5dd23a91).(UIWindowcxx . . $ UIWindow# *menu, const char *title, int n_items, int sx, int sy);
198
199 // deallocates memory
200 void Destroycxx . . $ newuiSheet#Destroy(49f6e7a06ebc5aa8).();
201
202 // get properties
203 int Xcxx . . $ newuiSheet#X(455f465bc33b4cdf).() const { return m_sxcxx . . $ newuiSheet#m_sx.; };
204 int Ycxx . . $ newuiSheet#Y(455f465bc33b4cdf).() const { return m_sycxx . . $ newuiSheet#m_sy.; };
205
206 // resets gadget list
207 void Resetcxx . . $ newuiSheet#Reset(49f6e7a06ebc5aa8).();
208
209 // call this to initialize gadgets specified above in parent window
210 void Realizecxx . . $ newuiSheet#Realize(49f6e7a06ebc5aa8).();
211
212 // call this to release gadgets specified above in parent window, retreives checkbox,radio,etc values too.
213 void Unrealizecxx . . $ newuiSheet#Unrealize(49f6e7a06ebc5aa8).();
214
215 // ALL following functions that return a pointer, that pointer contains the value of the gadget added
216 // i.e. checkbox will have a true or false value. you can use this pointer to modify gadget values.
217 // to validate these modifications, call 'UpdateChanges'. (done internally most of the time)
218
219 // call these functions to determine if a pointer's value has changed after call to UpdateReturnValues (internal)
220 bool HasChangedcxx . . $ newuiSheet#HasChanged(78ac5d2f3d401626).(bool *bptr);
221 bool HasChangedcxx . . $ newuiSheet#HasChanged(2c92555bf46fdf74).(int16_tcxx . . $ int16_t# *sptr);
222 bool HasChangedcxx . . $ newuiSheet#HasChanged(18a3c31ed0aa5760).(int *iptr);
223 bool HasChangedcxx . . $ newuiSheet#HasChanged(c6b7e35ff6de5671).(char *cptr);
224
225 // obtain's pointer to gadget of respective item. it is your responsibility to typecast the gadget
226 // only works if you specified an ID! Also the sheet must have been realized by now.
227 UIGadgetcxx . . $ UIGadget# *GetGadgetcxx . . $ newuiSheet#GetGadget(d6ee160b69f32e15).(int16_tcxx . . $ int16_t# id);
228
229 // set focus on this gadget specified by id upon realization.
230 void SetInitialFocusedGadgetcxx . . $ newuiSheet#SetInitialFocusedGadget(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# id);
231
232 // creates gadget list.pix_offset is the pixel offset from the group title to the first control.
233 void NewGroupcxx . . $ newuiSheet#NewGroup(465b27e37ce794b1).(const char *title, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y, tAlignmentcxx . . $ tAlignment# align = NEWUI_ALIGN_VERTcxx . . $ NEWUI_ALIGN_VERT., int16_tcxx . . $ int16_t# pix_offset = -1);
234
235 // adds standard button to current group. (flags see NEWUI_BTNF_xxxx)
236 void AddButtoncxx . . $ newuiSheet#AddButton(680bf41633375800).(const char *title, int16_tcxx . . $ int16_t# id, int16_tcxx . . $ int16_t# flags = 0);
237
238 // adds a long button (flags see NEWUI_BTNF_xxxx)
239 void AddLongButtoncxx . . $ newuiSheet#AddLongButton(680bf41633375800).(const char *title, int16_tcxx . . $ int16_t# id, int16_tcxx . . $ int16_t# flags = 0);
240
241 // adds checkbox to current group. initial state of checkbox can be set.
242 bool *AddCheckBoxcxx . . $ newuiSheet#AddCheckBox(b1b99af17a84c782).(const char *title, bool init_state = false, int16_tcxx . . $ int16_t# id = DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`!);
243
244 // adds long checkbox to current group. initial state of checkbox can be set.
245 bool *AddLongCheckBoxcxx . . $ newuiSheet#AddLongCheckBox(b1b99af17a84c782).(const char *title, bool init_state = false, int16_tcxx . . $ int16_t# id = DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`!);
246
247 // adds a radio button to current group. initial state of radio may be set
248 // pointer returned will return index of radio button in group currently selected.
249 int *AddFirstRadioButtoncxx . . $ newuiSheet#AddFirstRadioButton(c0389c32fb6fc938).(const char *title, int16_tcxx . . $ int16_t# id = DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`!);
250
251 // adds a radio button to current group. initial state of radio may be set
252 void AddRadioButtoncxx . . $ newuiSheet#AddRadioButton(9a5cb738bb1a644).(const char *title, int16_tcxx . . $ int16_t# id = DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`!);
253
254 // adds a radio button to current group. initial state of radio may be set
255 int *AddFirstLongRadioButtoncxx . . $ newuiSheet#AddFirstLongRadioButton(c0389c32fb6fc938).(const char *title, int16_tcxx . . $ int16_t# id = DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`!);
256
257 // adds a radio button to current group. initial state of radio may be set
258 void AddLongRadioButtoncxx . . $ newuiSheet#AddLongRadioButton(9a5cb738bb1a644).(const char *title, int16_tcxx . . $ int16_t# id = DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`!);
259
260 // adds a slider, set the range for it too., returns two values, int16_t[0] = position, int16_t[1] = range
261 int16_tcxx . . $ int16_t# *AddSlidercxx . . $ newuiSheet#AddSlider(8ed53311be8e1fab).(const char *title, int16_tcxx . . $ int16_t# range, int16_tcxx . . $ int16_t# init_pos = 0, tSliderSettingscxx . . $ tSliderSettings# *settings = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!,
262 int16_tcxx . . $ int16_t# id = DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`!);
263
264 // adds a static text item
265 void AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(const char *text, ...);
266
267 // adds a static bitmap
268 void AddBitmapcxx . . $ newuiSheet#AddBitmap(d4f767463ce0a6b3).(int bm_handle);
269
270 // adds a static text item
271 char *AddChangeableTextcxx . . $ newuiSheet#AddChangeableText(ff224f080444ee45).(int buflen);
272
273 // adds a listbox
274 newuiListBoxcxx . . $ newuiListBox# *AddListBoxcxx . . $ newuiSheet#AddListBox(b890ce7adcd9a5ed).(int16_tcxx . . $ int16_t# w, int16_tcxx . . $ int16_t# h, int16_tcxx . . $ int16_t# id, uint16_tcxx . . $ uint16_t# flags = 0);
275
276 // adds a listbox
277 newuiComboBoxcxx . . $ newuiComboBox# *AddComboBoxcxx . . $ newuiSheet#AddComboBox(b9251fbe6368b7af).(int16_tcxx . . $ int16_t# id, uint16_tcxx . . $ uint16_t# flags = 0);
278
279 // adds an edit box
280 char *AddEditBoxcxx . . $ newuiSheet#AddEditBox(56493f8cd670630f).(const char *title, int16_tcxx . . $ int16_t# maxlen = NEWUI_EDIT_BUFLENcxx . . $ `Descent3/newui_core.h:182:9`!, int16_tcxx . . $ int16_t# w = 0, int16_tcxx . . $ int16_t# id = DEFAULT_NEWUIDcxx . . $ `Descent3/newui_core.h:159:9`!,
281 int16_tcxx . . $ int16_t# flags = 0, bool return_on_esc = false);
282
283 // adds a hotspot :(, should word wrap too.
284 void AddHotspotcxx . . $ newuiSheet#AddHotspot(9900cc9f47e11d13).(const char *title, int16_tcxx . . $ int16_t# w, int16_tcxx . . $ int16_t# h, int16_tcxx . . $ int16_t# id, bool group = false);
285
286 // THESE FUNCTIONS ARE CALLED BY FRAMEWORK, BUT IF YOU NEED TO DO SOME CUSTOM UI HANDLING, THESE
287 // FUNCTIONS ARE MADE PUBLIC.
288 public:
289 // refreshes gadget states with values passed to the pointers returned by the below functions
290 // depends on no direct manipulation of gadgets outside framework.
291 void UpdateChangescxx . . $ newuiSheet#UpdateChanges(49f6e7a06ebc5aa8).();
292
293 // refreshes return values of gadgets, so they are accessible by the pointers returned by below functions
294 // if a gadget has changed since last call to DoUI, the user can tell this by calling HasChanged
295 void UpdateReturnValuescxx . . $ newuiSheet#UpdateReturnValues(49f6e7a06ebc5aa8).();
296
297 private:
298 struct t_gadget_desccxx . . $ newuiSheet#t_gadget_desc# {
299 int8_tcxx . . $ int8_t# typecxx . . $ newuiSheet#t_gadget_desc#type.; // enumerated ui gadget type
300 bool changedcxx . . $ newuiSheet#t_gadget_desc#changed.; // parameters are different than defaults?
301 int16_tcxx . . $ int16_t# idcxx . . $ newuiSheet#t_gadget_desc#id.; // id value
302 char *titlecxx . . $ newuiSheet#t_gadget_desc#title.; // title of gadget
303 unioncxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_2# {
304 int icxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_2#i.;
305 int16_tcxx . . $ int16_t# scxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_2#s.[2];
306 bool bcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_2#b.;
307 void *pcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_2#p.;
308 } parmcxx . . $ newuiSheet#t_gadget_desc#parm.; // parameter list.
309 unioncxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3# {
310 UIGadgetcxx . . $ UIGadget# *gadgetcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#gadget.;
311 UITextcxx . . $ UIText# *textcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#text.;
312 newuiSlidercxx . . $ newuiSlider# *slidercxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#slider.;
313 newuiCheckBoxcxx . . $ newuiCheckBox# *chboxcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#chbox.;
314 newuiRadioButtoncxx . . $ newuiRadioButton# *radiocxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#radio.;
315 newuiButtoncxx . . $ newuiButton# *buttoncxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#button.;
316 newuiListBoxcxx . . $ newuiListBox# *lbcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#lb.;
317 newuiComboBoxcxx . . $ newuiComboBox# *cbcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#cb.;
318 newuiEditBoxcxx . . $ newuiEditBox# *editcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#edit.;
319 newuiHotspotcxx . . $ newuiHotspot# *hotcxx . . $ newuiSheet#t_gadget_desc#$anonymous_type_3#hot.;
320 } objcxx . . $ newuiSheet#t_gadget_desc#obj.;
321 void *internalcxx . . $ newuiSheet#t_gadget_desc#internal.; // internal info.
322 } *m_gadgetlistcxx . . $ newuiSheet#m_gadgetlist.;
323
324 UIWindowcxx . . $ UIWindow# *m_parentcxx . . $ newuiSheet#m_parent.;
325 int m_ngadgetscxx . . $ newuiSheet#m_ngadgets., m_gadgetlimitcxx . . $ newuiSheet#m_gadgetlimit.;
326 bool m_realizedcxx . . $ newuiSheet#m_realized.;
327 char *m_titlecxx . . $ newuiSheet#m_title.;
328
329 t_gadget_desccxx . . $ newuiSheet#t_gadget_desc# *AddGadgetcxx . . $ newuiSheet#AddGadget(23885b9c9481ab71).(int16_tcxx . . $ int16_t# id, int8_tcxx . . $ int8_t# type, const char *title);
330
331 public:
332 const char *GetTitlecxx . . $ newuiSheet#GetTitle(33a1f659e94feb42).() { return m_titlecxx . . $ newuiSheet#m_title.; };
333 };
334
335 // CLASS new button class.
336
337 class newuiButtoncxx . . $ newuiButton# : virtual public UIButtoncxx . . $ UIButton# {
338 public:
339 newuiButtoncxx . . $ newuiButton#newuiButton(49f6e7a06ebc5aa8).();
340
341 // see (NEWUI_BTNF_xxx) flags
342 void Createcxx . . $ newuiButton#Create(6c82988af4899650).(UIWindowcxx . . $ UIWindow# *wnd, int16_tcxx . . $ int16_t# id, const char *name, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y, int16_tcxx . . $ int16_t# flags = 0);
343
344 protected:
345 virtual void OnDrawcxx . . $ newuiButton#OnDraw(49f6e7a06ebc5aa8).(); // overridable draws the background first
346 virtual void OnDestroycxx . . $ newuiButton#OnDestroy(49f6e7a06ebc5aa8).(); // override: frees memory and such.
347 virtual void OnFormatcxx . . $ newuiButton#OnFormat(49f6e7a06ebc5aa8).(); // new formatting
348 virtual void OnLostFocuscxx . . $ newuiButton#OnLostFocus(49f6e7a06ebc5aa8).();
349 virtual void OnGainFocuscxx . . $ newuiButton#OnGainFocus(49f6e7a06ebc5aa8).();
350
351 UIBitmapItemcxx . . $ UIBitmapItem# *m_bkgcxx . . $ newuiButton#m_bkg., *m_litbkgcxx . . $ newuiButton#m_litbkg.; // used to define visual characteristics of button
352 UISnazzyTextItemcxx . . $ UISnazzyTextItem# *m_textcxx . . $ newuiButton#m_text.;
353
354 // this is used in multiple inheritance cases.(flags are additional attributes usually passed when creating gadget)
355 void InitStatescxx . . $ newuiButton#InitStates(e7abf97c08fae620).(const char *name, bool is_long, int16_tcxx . . $ int16_t# flags = 0);
356
357 public:
358 UISnazzyTextItemcxx . . $ UISnazzyTextItem# *GetTitlecxx . . $ newuiButton#GetTitle(f7c48f119a8bdae9).() { return m_textcxx . . $ newuiButton#m_text.; };
359 };
360
361 // CLASS a large option button used in menus.
362
363 class newuiMenuOptionButtoncxx . . $ newuiMenuOptionButton# : public newuiButtoncxx . . $ newuiButton# {
364 public:
365 void Createcxx . . $ newuiMenuOptionButton#Create(1deaf4d7e2763ddc).(newuiMenucxx . . $ newuiMenu# *menu, newuiMenuOptionButtoncxx . . $ newuiMenuOptionButton# *last, int16_tcxx . . $ int16_t# id, const char *name, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y,
366 bool m_mono_press);
367
368 protected:
369 void OnMouseBtnDowncxx . . $ newuiMenuOptionButton#OnMouseBtnDown(d4f767463ce0a6b3).(int btn);
370 void OnMouseBtnUpcxx . . $ newuiMenuOptionButton#OnMouseBtnUp(d4f767463ce0a6b3).(int btn);
371 virtual void OnKeyDowncxx . . $ newuiMenuOptionButton#OnKeyDown(d4f767463ce0a6b3).(int key);
372 virtual void OnKeyUpcxx . . $ newuiMenuOptionButton#OnKeyUp(d4f767463ce0a6b3).(int key);
373
374 private:
375 bool m_mono_presscxx . . $ newuiMenuOptionButton#m_mono_press.;
376 newuiMenuOptionButtoncxx . . $ newuiMenuOptionButton# *m_prev_btncxx . . $ newuiMenuOptionButton#m_prev_btn., *m_next_btncxx . . $ newuiMenuOptionButton#m_next_btn.;
377 };
378
379 class newuiTinyButtoncxx . . $ newuiTinyButton# : public newuiButtoncxx . . $ newuiButton# {
380 public:
381 void Createcxx . . $ newuiTinyButton#Create(752e5b2327f90754).(UIWindowcxx . . $ UIWindow# *wnd, int16_tcxx . . $ int16_t# id, const char *name, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y);
382 };
383
384 // CLASS creates an arrow button that is sensitive to touch (when down, always select)
385
386 class newuiArrowButtoncxx . . $ newuiArrowButton# : public newuiButtoncxx . . $ newuiButton# {
387 public:
388 newuiArrowButtoncxx . . $ newuiArrowButton#newuiArrowButton(49f6e7a06ebc5aa8).(){};
389
390 void Createcxx . . $ newuiArrowButton#Create(a92569a4941e4071).(UIWindowcxx . . $ UIWindow# *wnd, int16_tcxx . . $ int16_t# id, int16_tcxx . . $ int16_t# type, const char *name, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y);
391 void Showcxx . . $ newuiArrowButton#Show(b45ddcbc8423892c).(bool show = true); // this will activate or deactivate a button.
392
393 protected:
394 virtual void OnMouseBtnDowncxx . . $ newuiArrowButton#OnMouseBtnDown(d4f767463ce0a6b3).(int btn);
395 virtual void OnMouseBtnUpcxx . . $ newuiArrowButton#OnMouseBtnUp(d4f767463ce0a6b3).(int btn);
396 virtual void OnDrawcxx . . $ newuiArrowButton#OnDraw(49f6e7a06ebc5aa8).();
397
398 private:
399 float m_timercxx . . $ newuiArrowButton#m_timer., m_selecttimercxx . . $ newuiArrowButton#m_selecttimer.;
400 bool m_hiddencxx . . $ newuiArrowButton#m_hidden.;
401 };
402
403 // CLASS a new listbox. uses less memory than the old listbox hopefully.
404
405 #define SUBGADGET_UPcxx . . $ `Descent3/newui_core.h:405:9`! 0x3
406 #define SUBGADGET_DOWNcxx . . $ `Descent3/newui_core.h:406:9`! 0x4
407
408 class newuiListBoxcxx . . $ newuiListBox# : public UIGadgetcxx . . $ UIGadget# {
409 public:
410 newuiListBoxcxx . . $ newuiListBox#newuiListBox(49f6e7a06ebc5aa8).();
411
412 // creates listbox
413 void Createcxx . . $ newuiListBox#Create(e6e6eb18e32bd8f).(UIWindowcxx . . $ UIWindow# *wnd, int16_tcxx . . $ int16_t# id, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y, int16_tcxx . . $ int16_t# w, int16_tcxx . . $ int16_t# h, uint16_tcxx . . $ uint16_t# flags);
414
415 // functions to add or remove items,
416 void AddItemcxx . . $ newuiListBox#AddItem(85c52e162fed56f9).(const char *name);
417 void RemoveItemcxx . . $ newuiListBox#RemoveItem(85c52e162fed56f9).(const char *name);
418 void RemoveAllcxx . . $ newuiListBox#RemoveAll(49f6e7a06ebc5aa8).();
419
420 // item information
421 int GetCurrentIndexcxx . . $ newuiListBox#GetCurrentIndex(b126dc7c1de90089).();
422 void SetCurrentIndexcxx . . $ newuiListBox#SetCurrentIndex(d4f767463ce0a6b3).(int index);
423 bool GetCurrentItemcxx . . $ newuiListBox#GetCurrentItem(37e8d18a243bba77).(char *buffer, int buflen);
424 bool GetItemcxx . . $ newuiListBox#GetItem(3f730e01d352290e).(int index, char *buffer, int buflen);
425 bool SetCurrentItemcxx . . $ newuiListBox#SetCurrentItem(c5f7da30cbc0f4e9).(const char *name);
426
427 // set callbacks
428 void SetSelectChangeCallbackcxx . . $ newuiListBox#SetSelectChangeCallback(94eb4457dc8d4d10).(void (*fn)(int));
429 void SetSelectChangeCallbackcxx . . $ newuiListBox#SetSelectChangeCallback(af3d7c1df3fe7292).(void (*fn)(int, void *), void *ptr);
430
431 protected:
432 virtual void OnLostFocuscxx . . $ newuiListBox#OnLostFocus(49f6e7a06ebc5aa8).(); // override: behavior when gadget loses input focus.
433 virtual void OnGainFocuscxx . . $ newuiListBox#OnGainFocus(49f6e7a06ebc5aa8).(); // override: behavior when gadget gains input focus.
434 virtual void OnDrawcxx . . $ newuiListBox#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
435 virtual void OnKeyDowncxx . . $ newuiListBox#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
436 virtual void OnKeyUpcxx . . $ newuiListBox#OnKeyUp(d4f767463ce0a6b3).(int key); // behavior when key is released.
437 virtual void OnMouseBtnDowncxx . . $ newuiListBox#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // behavior when mouse button is pressed.
438 virtual void OnMouseBtnUpcxx . . $ newuiListBox#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // behavior when mouse button is released.
439 virtual void OnNotifySelectcxx . . $ newuiListBox#OnNotifySelect(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *g); // this function will handle when an arrow button was pressed
440 virtual void OnSelectcxx . . $ newuiListBox#OnSelect(49f6e7a06ebc5aa8).(); // when a listbox item was double clicked (or entered)
441 virtual void OnDestroycxx . . $ newuiListBox#OnDestroy(49f6e7a06ebc5aa8).(); // called when destroyed.
442 virtual void OnUserProcesscxx . . $ newuiListBox#OnUserProcess(49f6e7a06ebc5aa8).(); // override: behavior when gadget is processed
443 virtual void OnAttachToWindowcxx . . $ newuiListBox#OnAttachToWindow(49f6e7a06ebc5aa8).(); // when gadget is added to a window (AddGadget is called)
444 virtual void OnDetachFromWindowcxx . . $ newuiListBox#OnDetachFromWindow(49f6e7a06ebc5aa8).(); // when gadget is detached from window
445
446 private:
447 char **m_ItemListcxx . . $ newuiListBox#m_ItemList.; // list of strings.
448 int *m_Virt2Realcxx . . $ newuiListBox#m_Virt2Real.; // translates virtual(user) id to real index
449 int *m_Real2Virtcxx . . $ newuiListBox#m_Real2Virt.; // translates real index into virtual(user) id
450
451 void (*selectchange_fncxx . . $ newuiListBox#selectchange_fn.)(int); // callback when selection changes in listbox.
452 void (*selectchange_id_fncxx . . $ newuiListBox#selectchange_id_fn.)(int, void *); // callback when selection changes in listbox..also return the ID
453 void *m_callbackptrcxx . . $ newuiListBox#m_callbackptr.; // user defined callback pointer
454
455 int m_NumItemscxx . . $ newuiListBox#m_NumItems.; // number of items in list.
456 int m_SelectedIndexcxx . . $ newuiListBox#m_SelectedIndex.; // current selected index into listbox
457 int m_Indexcxx . . $ newuiListBox#m_Index.; // current index of visible items.
458 int m_NumVisibleItemscxx . . $ newuiListBox#m_NumVisibleItems.; // number of items visible in listbox
459 int m_boffscxx . . $ newuiListBox#m_boffs.; // offset from edge to text region (border width)
460 int m_mse_xcxx . . $ newuiListBox#m_mse_x., m_mse_ycxx . . $ newuiListBox#m_mse_y.; // mouse x and y of last click.
461 int m_last_mse_xcxx . . $ newuiListBox#m_last_mse_x., m_last_mse_ycxx . . $ newuiListBox#m_last_mse_y.;
462 int m_last_selected_indexcxx . . $ newuiListBox#m_last_selected_index.;
463 float m_click_timecxx . . $ newuiListBox#m_click_time.; // time in between clicks.
464 int8_tcxx . . $ int8_t# m_nclickscxx . . $ newuiListBox#m_nclicks.;
465 bool m_mse_clickedcxx . . $ newuiListBox#m_mse_clicked.;
466
467 newuiArrowButtoncxx . . $ newuiArrowButton# m_up_btncxx . . $ newuiListBox#m_up_btn.; // buttons to scroll.
468 newuiArrowButtoncxx . . $ newuiArrowButton# m_down_btncxx . . $ newuiListBox#m_down_btn.;
469
470 UIBitmapItemcxx . . $ UIBitmapItem# *m_piecescxx . . $ newuiListBox#m_pieces.[N_DIRECTIONScxx . . $ `Descent3/newui_core.h:84:9`!]; // bitmap pieces
471
472 void Offsetcxx . . $ newuiListBox#Offset(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# offs);
473 void SetInternalCurrentIndexcxx . . $ newuiListBox#SetInternalCurrentIndex(d4f767463ce0a6b3).(int index);
474 };
475
476 // CLASS newuiComboBox
477
478 class newuiComboBoxcxx . . $ newuiComboBox# : public UIGadgetcxx . . $ UIGadget# {
479 public:
480 newuiComboBoxcxx . . $ newuiComboBox#newuiComboBox(49f6e7a06ebc5aa8).();
481
482 // creates listbox
483 void Createcxx . . $ newuiComboBox#Create(b592d8b1d10b24b1).(UIWindowcxx . . $ UIWindow# *wnd, int16_tcxx . . $ int16_t# id, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y, uint16_tcxx . . $ uint16_t# flags);
484
485 // functions to add or remove items,
486 void AddItemcxx . . $ newuiComboBox#AddItem(85c52e162fed56f9).(const char *name);
487 void RemoveItemcxx . . $ newuiComboBox#RemoveItem(85c52e162fed56f9).(const char *name);
488 void RemoveAllcxx . . $ newuiComboBox#RemoveAll(49f6e7a06ebc5aa8).();
489
490 // item information
491 int GetCurrentIndexcxx . . $ newuiComboBox#GetCurrentIndex(b126dc7c1de90089).();
492 void SetCurrentIndexcxx . . $ newuiComboBox#SetCurrentIndex(d4f767463ce0a6b3).(int index);
493 bool GetCurrentItemcxx . . $ newuiComboBox#GetCurrentItem(37e8d18a243bba77).(char *buffer, int buflen);
494 bool GetItemcxx . . $ newuiComboBox#GetItem(3f730e01d352290e).(int index, char *buffer, int buflen);
495 bool SetCurrentItemcxx . . $ newuiComboBox#SetCurrentItem(c5f7da30cbc0f4e9).(const char *name);
496
497 // set callbacks
498 void SetSelectChangeCallbackcxx . . $ newuiComboBox#SetSelectChangeCallback(94eb4457dc8d4d10).(void (*fn)(int));
499
500 protected:
501 virtual void OnDrawcxx . . $ newuiComboBox#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
502 virtual void OnKeyDowncxx . . $ newuiComboBox#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
503 virtual void OnNotifySelectcxx . . $ newuiComboBox#OnNotifySelect(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *g); // this function will handle when an arrow button was pressed
504 virtual void OnSelectcxx . . $ newuiComboBox#OnSelect(49f6e7a06ebc5aa8).(); // when a listbox item was double clicked (or entered)
505 virtual void OnDestroycxx . . $ newuiComboBox#OnDestroy(49f6e7a06ebc5aa8).(); // called when destroyed.
506 virtual void OnAttachToWindowcxx . . $ newuiComboBox#OnAttachToWindow(49f6e7a06ebc5aa8).(); // when gadget is added to a window (AddGadget is called)
507 virtual void OnDetachFromWindowcxx . . $ newuiComboBox#OnDetachFromWindow(49f6e7a06ebc5aa8).(); // when gadget is detached from window
508
509 private:
510 char **m_ItemListcxx . . $ newuiComboBox#m_ItemList.; // list of strings.
511 int *m_Virt2Realcxx . . $ newuiComboBox#m_Virt2Real.; // translates virtual(user) id to real index
512 int *m_Real2Virtcxx . . $ newuiComboBox#m_Real2Virt.; // translates real index into virtual(user) id
513
514 void (*selectchange_fncxx . . $ newuiComboBox#selectchange_fn.)(int); // callback when selection changes in listbox.
515
516 int m_NumItemscxx . . $ newuiComboBox#m_NumItems.; // number of items in list.
517 int m_Indexcxx . . $ newuiComboBox#m_Index.; // current index of visible items.
518 int m_boffscxx . . $ newuiComboBox#m_boffs.; // offset from edge to text region (border width)
519 bool m_showupcxx . . $ newuiComboBox#m_showup., m_showdowncxx . . $ newuiComboBox#m_showdown.;
520
521 newuiArrowButtoncxx . . $ newuiArrowButton# m_up_btncxx . . $ newuiComboBox#m_up_btn.; // buttons to scroll.
522 newuiArrowButtoncxx . . $ newuiArrowButton# m_down_btncxx . . $ newuiComboBox#m_down_btn.;
523
524 UIBitmapItemcxx . . $ UIBitmapItem# *m_barbmpcxx . . $ newuiComboBox#m_barbmp.; // bitmap pieces
525 };
526
527 // the new classic hotspot CLASS
528
529 class newuiHotspotcxx . . $ newuiHotspot# : public UIGadgetcxx . . $ UIGadget# {
530 private:
531 char *m_titlecxx . . $ newuiHotspot#m_title.;
532 int16_tcxx . . $ int16_t# m_alphacxx . . $ newuiHotspot#m_alpha., m_alpha_adjustcxx . . $ newuiHotspot#m_alpha_adjust.;
533 float m_mse_timercxx . . $ newuiHotspot#m_mse_timer.;
534
535 public:
536 newuiHotspotcxx . . $ newuiHotspot#newuiHotspot(49f6e7a06ebc5aa8).();
537
538 void Createcxx . . $ newuiHotspot#Create(c5b4ce760113345f).(UIWindowcxx . . $ UIWindow# *wnd, int16_tcxx . . $ int16_t# id, const char *title, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y, int16_tcxx . . $ int16_t# w, int16_tcxx . . $ int16_t# h, int16_tcxx . . $ int16_t# flags = 0);
539 const char *GetTitlecxx . . $ newuiHotspot#GetTitle(a9f41ea0e82d88cf).() const { return m_titlecxx . . $ newuiHotspot#m_title.; };
540
541 protected:
542 virtual void OnDrawcxx . . $ newuiHotspot#OnDraw(49f6e7a06ebc5aa8).(); // this will use the newuiButton drawing scheme
543 virtual void OnDestroycxx . . $ newuiHotspot#OnDestroy(49f6e7a06ebc5aa8).();
544 virtual void OnMouseBtnDowncxx . . $ newuiHotspot#OnMouseBtnDown(d4f767463ce0a6b3).(int btn);
545 virtual void OnMouseBtnUpcxx . . $ newuiHotspot#OnMouseBtnUp(d4f767463ce0a6b3).(int btn);
546 virtual void OnGainFocuscxx . . $ newuiHotspot#OnGainFocus(49f6e7a06ebc5aa8).();
547 virtual void OnLostFocuscxx . . $ newuiHotspot#OnLostFocus(49f6e7a06ebc5aa8).();
548 };
549
550 ///////////////////////////////////////////////////////////////////////////////
551
552 // CLASS, contains options buttons and sheets of ui stuff
553
554 #define NEWUIMENU_SMALLcxx . . $ `Descent3/newui_core.h:554:9`! 0x10
555 #define NEWUIMENU_MEDIUMcxx . . $ `Descent3/newui_core.h:555:9`! 0x20
556 #define NEWUIMENU_LARGEcxx . . $ `Descent3/newui_core.h:556:9`! 0x40
557
558 class newuiMenucxx . . $ newuiMenu# : public UIWindowcxx . . $ UIWindow# {
559 public:
560 newuiMenucxx . . $ newuiMenu#newuiMenu(49f6e7a06ebc5aa8).();
561
562 // creates a menu
563 void Createcxx . . $ newuiMenu#Create(49f6e7a06ebc5aa8).();
564
565 // adds an option to a menu, returns a newuiSheet object to add user interface to.
566 newuiSheetcxx . . $ newuiSheet# *AddOptioncxx . . $ newuiMenu#AddOption(f02bcd29588925e6).(int16_tcxx . . $ int16_t# id, const char *title, int size = NEWUIMENU_SMALLcxx . . $ `Descent3/newui_core.h:554:9`!, bool has_sheet = true, int yoff = 0);
567 void AddSimpleOptioncxx . . $ newuiMenu#AddSimpleOption(6ed0a7151bf51ed1).(int16_tcxx . . $ int16_t# id, const char *title, int yoff = 0);
568
569 // sets current option to display.
570 void SetCurrentOptioncxx . . $ newuiMenu#SetCurrentOption(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# id);
571
572 // returns current option
573 int16_tcxx . . $ int16_t# GetCurrentOptioncxx . . $ newuiMenu#GetCurrentOption(524863554b4a534e).() const;
574
575 // returns current sheet
576 newuiSheetcxx . . $ newuiSheet# *GetCurrentSheetcxx . . $ newuiMenu#GetCurrentSheet(30d547b14d44a52d).() const;
577
578 // set master sheet,button locations
579 void SetPlacementscxx . . $ newuiMenu#SetPlacements(548fbf2da99c1809).(int x, int y, int options_x, int options_y, int options_w, int options_h, int title_x, int title_y,
580 tAlignmentcxx . . $ tAlignment# align = NEWUI_ALIGN_VERTcxx . . $ NEWUI_ALIGN_VERT.);
581
582 // processes a menu
583 int DoUIcxx . . $ newuiMenu#DoUI(b126dc7c1de90089).();
584
585 // THESE FUNCTIONS DEAL WITH CALLBACK PROCEDURES
586 public:
587 // when a new option is realized, this function will be called.
588 // passed in: the menu object, the old option and the new option and an optional pointer respectively
589 void SetOnOptionSwitchCBcxx . . $ newuiMenu#SetOnOptionSwitchCB(a57b737311599b0a).(void (*fn)(newuiMenucxx . . $ newuiMenu# *, int16_tcxx . . $ int16_t#, int16_tcxx . . $ int16_t#, void *), void *data);
590
591 // when a new option is ready. at this point the system sets the focus on this option
592 void SetOnOptionFocusCBcxx . . $ newuiMenu#SetOnOptionFocusCB(d86502bad44a4a2).(void (*fn)(newuiMenucxx . . $ newuiMenu# *, int16_tcxx . . $ int16_t#, void *), void *data);
593
594 // equivalent of SetUICallback, called before gadgets are drawn
595 void SetOnUIFrameCBcxx . . $ newuiMenu#SetOnUIFrameCB(964b12a25712bdc3).(void (*fn)());
596
597 protected:
598 virtual void OnDrawcxx . . $ newuiMenu#OnDraw(49f6e7a06ebc5aa8).(); // overridable draws the window background before gadgets
599 virtual void OnDestroycxx . . $ newuiMenu#OnDestroy(49f6e7a06ebc5aa8).(); // overridable: called in Destroy
600
601 UIBitmapItemcxx . . $ UIBitmapItem# *m_bkgcxx . . $ newuiMenu#m_bkg.; // background
602
603 private:
604 newuiMenuOptionButtoncxx . . $ newuiMenuOptionButton# m_sheetbtncxx . . $ newuiMenu#m_sheetbtn.[N_NEWUI_SHEETScxx . . $ `Descent3/newui_core.h:68:9`!];
605 newuiSheetcxx . . $ newuiSheet# m_sheetscxx . . $ newuiMenu#m_sheets.[N_NEWUI_SHEETScxx . . $ `Descent3/newui_core.h:68:9`!];
606 bool m_hassheetcxx . . $ newuiMenu#m_hassheet.[N_NEWUI_SHEETScxx . . $ `Descent3/newui_core.h:68:9`!];
607 newuiSheetcxx . . $ newuiSheet# *m_cursheetcxx . . $ newuiMenu#m_cursheet.; // current sheet
608 int m_nsheetscxx . . $ newuiMenu#m_nsheets., m_sheetxcxx . . $ newuiMenu#m_sheetx., m_sheetycxx . . $ newuiMenu#m_sheety.; // sheet characteristics
609 int m_optionswcxx . . $ newuiMenu#m_optionsw., m_optionshcxx . . $ newuiMenu#m_optionsh.;
610 int m_optionsxcxx . . $ newuiMenu#m_optionsx., m_optionsycxx . . $ newuiMenu#m_optionsy.; // option button placements
611 int m_titlexcxx . . $ newuiMenu#m_titlex., m_titleycxx . . $ newuiMenu#m_titley.; // title location.
612 tAlignmentcxx . . $ tAlignment# m_aligncxx . . $ newuiMenu#m_align.; // alignment of text
613 int16_tcxx . . $ int16_t# m_newoptionidcxx . . $ newuiMenu#m_newoptionid.; // tells that a new option has been selected.
614 int16_tcxx . . $ int16_t# m_cursheetidxcxx . . $ newuiMenu#m_cursheetidx.;
615 bool m_refreshgadgetscxx . . $ newuiMenu#m_refreshgadgets.; // refreshes gadgets on current sheet.
616
617 void (*m_activate_sheet_cbcxx . . $ newuiMenu#m_activate_sheet_cb.)(newuiMenucxx . . $ newuiMenu# *, int16_tcxx . . $ int16_t#, int16_tcxx . . $ int16_t#, void *);
618 void (*m_option_focus_cbcxx . . $ newuiMenu#m_option_focus_cb.)(newuiMenucxx . . $ newuiMenu# *, int16_tcxx . . $ int16_t#, void *);
619 void (*m_uiframe_cbcxx . . $ newuiMenu#m_uiframe_cb.)();
620
621 void *m_activate_sheet_cb_datacxx . . $ newuiMenu#m_activate_sheet_cb_data.;
622 void *m_option_focus_cb_datacxx . . $ newuiMenu#m_option_focus_cb_data.;
623 };
624
625 // CLASS, large (fullscreen) menu
626
627 class newuiLargeMenucxx . . $ newuiLargeMenu# : public newuiMenucxx . . $ newuiMenu# {
628 public:
629 // creates a menu
630 void Createcxx . . $ newuiLargeMenu#Create(49f6e7a06ebc5aa8).();
631
632 // adds an option to a menu, returns a newuiSheet object to add user interface to.
633 newuiSheetcxx . . $ newuiSheet# *AddOptioncxx . . $ newuiLargeMenu#AddOption(2e05a335277a5351).(int16_tcxx . . $ int16_t# id, const char *title, int size = NEWUIMENU_MEDIUMcxx . . $ `Descent3/newui_core.h:555:9`!);
634 };
635
636 // CLASS, small message box
637 #define NEWUI_MSGBOX_SHEET_Wcxx . . $ `Descent3/newui_core.h:637:9`! 200
638 #define NEWUI_MSGBOX_MAXBTNScxx . . $ `Descent3/newui_core.h:638:9`! 4
639
640 class newuiMessageBoxcxx . . $ newuiMessageBox# : public UIWindowcxx . . $ UIWindow# {
641 public:
642 newuiMessageBoxcxx . . $ newuiMessageBox#newuiMessageBox(49f6e7a06ebc5aa8).();
643
644 void Createcxx . . $ newuiMessageBox#Create(34d26762b42c433a).(const char *title, int type = MSGBOX_OKcxx . . $ `Descent3/newui_core.h:78:9`!);
645
646 void AddButtoncxx . . $ newuiMessageBox#AddButton(7b85637613228108).(const char *title, int slot, int key = 0);
647
648 // grab the message box's sheet.
649 newuiSheetcxx . . $ newuiSheet# *GetSheetcxx . . $ newuiMessageBox#GetSheet(661381a276e5b628).();
650
651 // do user interface, return UID_OK or UID_CANCEL or UID_??? (UID_OK and UID_CANCEL are predefined)
652 int DoUIcxx . . $ newuiMessageBox#DoUI(b126dc7c1de90089).();
653
654 protected:
655 virtual void OnDrawcxx . . $ newuiMessageBox#OnDraw(49f6e7a06ebc5aa8).(); // overridable draws the window background before gadgets
656 virtual void OnDestroycxx . . $ newuiMessageBox#OnDestroy(49f6e7a06ebc5aa8).();
657
658 private:
659 newuiSheetcxx . . $ newuiSheet# m_sheetcxx . . $ newuiMessageBox#m_sheet.;
660 newuiButtoncxx . . $ newuiButton# m_btncxx . . $ newuiMessageBox#m_btn.[NEWUI_MSGBOX_MAXBTNScxx . . $ `Descent3/newui_core.h:638:9`!];
661
662 UIBitmapItemcxx . . $ UIBitmapItem# *m_bkgcxx . . $ newuiMessageBox#m_bkg.;
663 };
664
665 // CLASS, sizable window
666
667 class newuiTiledWindowcxx . . $ newuiTiledWindow# : public UIWindowcxx . . $ UIWindow# {
668 public:
669 newuiTiledWindowcxx . . $ newuiTiledWindow#newuiTiledWindow(49f6e7a06ebc5aa8).();
670
671 void Createcxx . . $ newuiTiledWindow#Create(9860cac3d762132).(const char *title, int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y, int16_tcxx . . $ int16_t# w, int16_tcxx . . $ int16_t# h, int flags = 0);
672
673 // grab a newui interface from it.
674 newuiSheetcxx . . $ newuiSheet# *GetSheetcxx . . $ newuiTiledWindow#GetSheet(661381a276e5b628).();
675
676 // do user interface on it.
677 int DoUIcxx . . $ newuiTiledWindow#DoUI(b126dc7c1de90089).();
678
679 // set callbacks, SetData keeps a pointer that is passed to all callbacks
680 void SetDatacxx . . $ newuiTiledWindow#SetData(5d22bdacc48458e8).(void *data);
681
682 // first called when DoUI is called.
683 void SetOnStartUICBcxx . . $ newuiTiledWindow#SetOnStartUICB(af93e79073e6e663).(void (*fn)(newuiTiledWindowcxx . . $ newuiTiledWindow# *, void *));
684
685 // called when DoUI returns
686 void SetOnEndUICBcxx . . $ newuiTiledWindow#SetOnEndUICB(af93e79073e6e663).(void (*fn)(newuiTiledWindowcxx . . $ newuiTiledWindow# *, void *));
687
688 // called before rend_Flip but after ui has drawn. (SetUICallback is before ui has been rendered)
689 void SetOnDrawCBcxx . . $ newuiTiledWindow#SetOnDrawCB(af93e79073e6e663).(void (*fn)(newuiTiledWindowcxx . . $ newuiTiledWindow# *, void *));
690
691 // called after DoUIFrame is called. for immediate results.
692 void SetOnUIFrameCBcxx . . $ newuiTiledWindow#SetOnUIFrameCB(af93e79073e6e663).(void (*fn)(newuiTiledWindowcxx . . $ newuiTiledWindow# *, void *));
693
694 protected:
695 virtual void OnDrawcxx . . $ newuiTiledWindow#OnDraw(49f6e7a06ebc5aa8).();
696 virtual void OnDestroycxx . . $ newuiTiledWindow#OnDestroy(49f6e7a06ebc5aa8).();
697
698 private:
699 UIBitmapItemcxx . . $ UIBitmapItem# *m_piecescxx . . $ newuiTiledWindow#m_pieces.[N_DIRECTIONScxx . . $ `Descent3/newui_core.h:84:9`!]; // bitmap pieces
700 newuiSheetcxx . . $ newuiSheet# m_sheetcxx . . $ newuiTiledWindow#m_sheet.;
701 char m_titlecxx . . $ newuiTiledWindow#m_title.[64];
702 void *m_datacxx . . $ newuiTiledWindow#m_data.;
703 bool m_realizedcxx . . $ newuiTiledWindow#m_realized.;
704
705 void (*m_startui_cbcxx . . $ newuiTiledWindow#m_startui_cb.)(newuiTiledWindowcxx . . $ newuiTiledWindow# *, void *);
706 void (*m_endui_cbcxx . . $ newuiTiledWindow#m_endui_cb.)(newuiTiledWindowcxx . . $ newuiTiledWindow# *, void *);
707 void (*m_draw_cbcxx . . $ newuiTiledWindow#m_draw_cb.)(newuiTiledWindowcxx . . $ newuiTiledWindow# *, void *);
708 void (*m_onframe_cbcxx . . $ newuiTiledWindow#m_onframe_cb.)(newuiTiledWindowcxx . . $ newuiTiledWindow# *, void *);
709
710 int GetTopTileIndexcxx . . $ newuiTiledWindow#GetTopTileIndex(9b79fb6aee4c0440).(int tx, int window_width);
711 };
712
713 // inlines and macros
714
715 #define F_APPROXIMATEcxx . . $ `Descent3/newui_core.h:715:9`!(_f) ((_f) + 0.000001f)
716
717 inline int16_tcxx . . $ int16_t# CALC_SLIDER_POS_FLOATcxx . . $ CALC_SLIDER_POS_FLOAT(e0a034531ef5a7c4).(float val, const tSliderSettingscxx . . $ tSliderSettings# *settings, int16_tcxx . . $ int16_t# range) {
718 int16_tcxx . . $ int16_t# curpos;
719 curpos = (int16_tcxx . . $ int16_t#)F_APPROXIMATEcxx . . $ tSliderSettings#min_val.(((val - settings->min_val.f) * range) / (settings->max_val.f - settings->min_val.f));
720 return curpos;
721 }
722
723 inline int16_tcxx . . $ int16_t# CALC_SLIDER_POS_INTcxx . . $ CALC_SLIDER_POS_INT(62cdf42153e34a13).(int val, const tSliderSettingscxx . . $ tSliderSettings# *settings, int16_tcxx . . $ int16_t# range) {
724 int16_tcxx . . $ int16_t# curpos;
725 float num = (float)((val - settings->min_valcxx . . $ tSliderSettings#min_val..icxx . . $ tSliderSettings#$anonymous_type_0#i.) * range);
726 float dem = (float)((settings->max_valcxx . . $ tSliderSettings#max_val..icxx . . $ tSliderSettings#$anonymous_type_1#i. - settings->min_valcxx . . $ tSliderSettings#min_val..icxx . . $ tSliderSettings#$anonymous_type_0#i.));
727 curpos = (int16_tcxx . . $ int16_t#)F_APPROXIMATEcxx . . $ `Descent3/newui_core.h:715:9`!(num / dem);
728 return curpos;
729 }
730
731 inline float CALC_SLIDER_FLOAT_VALUEcxx . . $ CALC_SLIDER_FLOAT_VALUE(da32870243b99ecb).(int16_tcxx . . $ int16_t# val, float min, float max, int16_tcxx . . $ int16_t# range) {
732 float retval;
733 retval = F_APPROXIMATEcxx . . $ `Descent3/newui_core.h:715:9`!((max - min) * val / range) + min;
734 return retval;
735 }
736
737 inline int CALC_SLIDER_INT_VALUEcxx . . $ CALC_SLIDER_INT_VALUE(46336090ce738d2a).(int16_tcxx . . $ int16_t# val, int min, int max, int16_tcxx . . $ int16_t# range) {
738 int retval;
739 float num = (float)((max - min) * val);
740 retval = (int)(F_APPROXIMATEcxx . . $ `Descent3/newui_core.h:715:9`!(num / range)) + min;
741 return retval;
742 }
743
744 #endif