Debian Codegraph @

ui/ui.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 * $Logfile: /DescentIII/Main/Lib/ui.h $
21 * $Revision: 75 $
22 * $Date: 5/17/99 5:19p $
23 * $Author: Samir $
24 *
25 * UI system
26 *
27 * $Log: /DescentIII/Main/Lib/ui.h $
28 *
29 * 75 5/17/99 5:19p Samir
30 * added ability for edit box to autoselect when hitting the max number of
31 * characters typable.
32 *
33 * 74 5/02/99 2:08a Samir
34 * added Enable and Disable and only accept locking of button if mouse is
35 * inside the button.
36 *
37 * 73 4/29/99 2:21a Samir
38 * added flag for gadgets.
39 *
40 * 72 4/28/99 1:54a Samir
41 * visual tweaks to text
42 *
43 * 71 4/26/99 7:46p Samir
44 * you can get flags from a window now.
45 *
46 * 70 4/16/99 4:02a Jeff
47 * include linux_fix.h for linxu builds...reduces errors
48 *
49 * 69 4/15/99 1:45a Jeff
50 * changes for linux compile
51 *
52 * 68 4/03/99 9:26p Jeff
53 * changed dialogs that weren't using UID_OK and UID_CANCEL to use and
54 * handle them properly
55 *
56 * 67 3/23/99 9:02p Samir
57 * up accelerator count for windows to 48.
58 *
59 * 66 2/28/99 3:25a Samir
60 * added flag to input only numbers.
61 *
62 * 65 2/26/99 2:12a Samir
63 * added window accelrators
64 *
65 * 64 2/22/99 8:13p Samir
66 * added slave gadget system that only uses mouse input from window, but
67 * defers keys to its master.
68 *
69 * 63 2/21/99 6:36p Samir
70 * focusing changes and key input changes to ui.,
71 *
72 * 62 2/17/99 8:32p Samir
73 * fixed bugs in remove gadget, added callbacks for attaching and
74 * detaching gadgets.
75 *
76 * 61 2/16/99 12:08p Samir
77 * added gadget notification system.
78 *
79 * 60 1/18/99 5:08a Jeff
80 * added some flags related to sorted listboxes
81 *
82 * 59 12/30/98 12:16p Kevin
83 * Auto Mission Download system
84 *
85 * 58 11/03/98 7:05p Samir
86 * added word wrapping console.
87 *
88 * 57 10/20/98 12:14p Jeff
89 * added color to the UIGroup
90 *
91 * 56 10/19/98 6:30p Jeff
92 * changes made for detail variables. Put in preset values. Preset
93 * options. Removed terrain_cast from detail. Put new callbacks in
94 * UIListBox and UISlider
95 *
96 * 55 10/19/98 12:18p Samir
97 * made tabbing between edit controls possible.
98 *
99 * 54 10/17/98 11:26a Samir
100 * fixed some edit box scrolling issues.
101 *
102 * 53 10/16/98 1:42p Jeff
103 * updated UIGroup
104 *
105 * 52 10/07/98 11:25a Jeff
106 * created UIGroup
107 *
108 * 51 9/30/98 4:34p Samir
109 * added enable function.
110 *
111 * 50 9/22/98 3:57p Samir
112 * listbox prob fixed again.
113 *
114 * 49 9/14/98 11:22a Samir
115 * enhanced editboxes
116 *
117 * 48 9/02/98 6:50p Samir
118 * added new combo box.
119 *
120 * 47 8/27/98 5:03p Kevin
121 * Prettied up multiplayer screens and fixed some bugs.
122 *
123 * 46 8/27/98 2:52p Samir
124 * changing window system to work in two modes.
125 *
126 * 45 8/26/98 12:25p Samir
127 * fixed the whole editbox, keyboard access mess.
128 *
129 * 44 8/25/98 7:08p Samir
130 * select how keys are sent to a gadget.
131 *
132 * 43 8/25/98 5:27p Samir
133 * new focusing rules for keyboard.
134 *
135 * 42 8/24/98 3:12p Samir
136 * fixed text clipping
137 *
138 * 41 8/11/98 11:38a Samir
139 * fixed listbox probs yet again. arrows on side this time.
140 *
141 * 40 7/29/98 3:26p Samir
142 * fixed some listbox mouse problems.
143 *
144 * 39 6/23/98 5:05p Samir
145 * console supports color per line ONLY.
146 *
147 * 38 6/22/98 7:31p Samir
148 * added UIEdit::Activate, which activates an edit box manually.
149 *
150 * 37 6/22/98 2:15p Samir
151 * added UIConsoleGadget.
152 *
153 * 36 6/05/98 5:58p Jeff
154 * Added a way to change the items for the states of a HotSpot
155 *
156 * 35 6/05/98 5:35p Samir
157 * massive improvement in UI keyboard interface.
158 *
159 * 34 5/22/98 5:02p Jeff
160 * Added a flag for radio buttons so the button part won't be drawn (just
161 * the text)
162 *
163 * 33 5/08/98 3:58p Samir
164 * added ability to move a UI object.
165 *
166 * 32 4/29/98 1:04p Jeff
167 * fixed up the UIListBox a bit (color control and scroll buttons)
168 *
169 * 31 4/29/98 11:55a Samir
170 * allow user to change color of selected listbox item.
171 *
172 * 30 4/24/98 2:42a Samir
173 * added UICheckBox
174 *
175 * 29 4/13/98 7:02p Samir
176 * made some things protected.
177 *
178 * 28 3/13/98 5:18p Jeff
179 * Added 2 flags for new UIListBox for scrolling and some member vars for
180 * UIListBox
181 *
182 * 27 3/10/98 7:25p Samir
183 * Changes to UISlider
184 *
185 * 26 3/10/98 12:48p Samir
186 * Fixed flags for UIWindow so centering is supported.
187 *
188 * 25 3/09/98 5:05p Samir
189 * Added callback to selection change function.
190 *
191 * 24 3/09/98 3:43p Samir
192 * Made some window flag changes.
193 *
194 * 23 3/06/98 10:48a Samir
195 * Check if button is active.
196 *
197 * 22 3/05/98 6:40p Samir
198 * Implemented radio buttons.
199 *
200 * 21 3/04/98 12:08p Samir
201 * Slider fixed.
202 *
203 * 20 2/26/98 2:50p Samir
204 * Did some stuff with UISlider.
205 *
206 * 19 2/15/98 7:07p Samir
207 * Revamped way keys like up and down are handled in window system.
208 *
209 * 18 2/13/98 6:34p Samir
210 * Added UIStatic class.
211 *
212 * 17 2/10/98 4:55p Samir
213 * Added radio buttons.
214 *
215 * 16 2/02/98 7:36p Samir
216 * Added UIObject::Destroy.
217 *
218 * 15 1/30/98 7:03p Samir
219 * Added UIConsole.
220 *
221 * 14 1/23/98 5:45p Samir
222 * Added OnUserProcess to UIWindow class.
223 *
224 * 13 1/18/98 4:22p Samir
225 * Implemented new UIItem system.
226 *
227 * 12 1/13/98 6:59p Jeff
228 * (Samir) moved defines from UIlib.h to ui.h.
229 *
230 * 11 1/13/98 4:32p Samir
231 * Made tUIInput a shared structure to be used by ui_DoFrame to return UI
232 * input values.
233 *
234 * 10 1/13/98 4:28p Samir
235 * Added sliders.
236 *
237 * 9 1/09/98 12:01p Samir
238 * Added prototypes for sliders, listboxes, and scrollbars.
239 *
240 * 8 1/08/98 12:17p Samir
241 * Added TitledWindow and modified the UI interface for polling.
242 *
243 * 7 1/05/98 4:55p Samir
244 * Took out m_Flags from child classes of UIGadget
245 *
246 * 6 1/05/98 4:36p Samir
247 * Moved centering and fittext control flags to UIGadget class.
248 *
249 * 5 1/05/98 4:19p Samir
250 * UIGadget has fewer pure virtuals.
251 *
252 * 4 1/05/98 3:48p Jason
253 * added SetAllText function for buttons
254 *
255 * 3 1/05/98 3:18p Samir
256 * Added some button flags.
257 *
258 * 2 1/02/98 12:49p Samir
259 * Edit control and static control added.
260 *
261 * 1 12/30/97 4:37p Samir
262 * Initial revision
263 *
264 * $NoKeywords: $
265 */
266
267 #ifndef UI_H
268 #define UI_Hcxx . . $ `ui/ui.h:268:9`!
269
270 #include <cstdint>
271
272 #if defined(POSIXcxx . . $ `<built-in>:480:9`!)
273 #include "linux_fix.h"cxx . . $ `<file>/linux/linux_fix.h`/ //for stricmp's through code
274 #endif
275
276 #include "uires.h"cxx . . $ `<file>/ui/uires.h`/
277
278 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
279 #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/
280
281 // Class identification
282
283 typedef unsigned tUIClasscxx . . $ tUIClass#;
284
285 const tUIClasscxx . . $ tUIClass# uiObjectcxx . . $ uiObject. = 0, uiWindowcxx . . $ uiWindow. = 1, uiTitledWindowcxx . . $ uiTitledWindow. = 2, uiGadgetcxx . . $ uiGadget. = 3, uiHotspotcxx . . $ uiHotspot. = 4, uiButtoncxx . . $ uiButton. = 5, uiEditcxx . . $ uiEdit. = 6,
286 uiTextcxx . . $ uiText. = 7, uiSlidercxx . . $ uiSlider. = 8, uiVScrollBarcxx . . $ uiVScrollBar. = 9, uiListBoxcxx . . $ uiListBox. = 10;
287
288 const tUIClasscxx . . $ tUIClass# uiNewClasscxx . . $ uiNewClass. = 100;
289
290 typedef int tUIBmpHandlecxx . . $ tUIBmpHandle#;
291
292 class UIObjectcxx . . $ UIObject#;
293 class UIGadgetcxx . . $ UIGadget#;
294 class UIInterfacecxx . . $ UIInterface#;
295 class UIItemcxx . . $ UIItem#;
296 class UITextItemcxx . . $ UITextItem#;
297 class UIWindowcxx . . $ UIWindow#;
298 // ----------------------------------------------------------------------------
299 // UIObject
300 // The absolute primitive for the UI system. All UI class are derived from
301 // tUIObject.
302
303 class UIObjectcxx . . $ UIObject# {
304 bool m_Createdcxx . . $ UIObject#m_Created.; // is this object created?
305
306 // variables shared by the entire UI hierarchy
307 protected:
308 int m_Xcxx . . $ UIObject#m_X., m_Ycxx . . $ UIObject#m_Y.; // Location of UIObject relative to some other object.
309 int m_Wcxx . . $ UIObject#m_W., m_Hcxx . . $ UIObject#m_H.; // Dimensions of the UIObject
310
311 public:
312 UIObjectcxx . . $ UIObject#UIObject(49f6e7a06ebc5aa8).();
313 virtual ~cxx . . $ UIObject#`~UIObject`(ced63f7c635d850d).UIObjectcxx . . $ UIObject#();
314
315 void Createcxx . . $ UIObject#Create(748afa4755bc9595).(int x, int y, int w, int h); // define the ui object.
316 void Destroycxx . . $ UIObject#Destroy(49f6e7a06ebc5aa8).() { m_Createdcxx . . $ UIObject#m_Created. = false; };
317 bool IsCreatedcxx . . $ UIObject#IsCreated(50ce9a9e25b4a850).() const { return m_Createdcxx . . $ UIObject#m_Created.; };
318
319 // data access
320 int Xcxx . . $ UIObject#X(455f465bc33b4cdf).() const { return m_Xcxx . . $ UIObject#m_X.; }; // access the X,Y,W,H fields.
321 int Ycxx . . $ UIObject#Y(455f465bc33b4cdf).() const { return m_Ycxx . . $ UIObject#m_Y.; };
322 int Wcxx . . $ UIObject#W(455f465bc33b4cdf).() const { return m_Wcxx . . $ UIObject#m_W.; };
323 int Hcxx . . $ UIObject#H(455f465bc33b4cdf).() const { return m_Hcxx . . $ UIObject#m_H.; };
324
325 // moves the object.
326 void Movecxx . . $ UIObject#Move(748afa4755bc9595).(int x, int y, int w, int h);
327
328 // inheritable operations
329 public:
330 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UIObject#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
331 return uiObjectcxx . . $ uiObject.;
332 };
333 };
334
335 // ----------------------------------------------------------------------------
336 // UIGadget
337 // A gadget is a user interface item which a mouse or keyboard may interact with.
338 // Gadgets typically are managed by their parent interface.
339 // All buttons, checkboxes, listboxes, etc use tUIGadget as their parent.
340
341 // flags
342 #define UIF_CENTERcxx . . $ `ui/ui.h:342:9`! 0x01
343 #define UIF_FITcxx . . $ `ui/ui.h:343:9`! 0x02
344 #define UIF_BORDERcxx . . $ `ui/ui.h:344:9`! 0x04 // for certain gadgets specifies that the border be drawn.
345 #define UIF_SLAVEcxx . . $ `ui/ui.h:345:9`! 0x10 // gadget never gets focus from ui system directly (child gadgets).
346 #define UIF_NOTIFYMASTERSELcxx . . $ `ui/ui.h:346:9`! 0x20 // when slave gadget is selected, the master will know.
347 #define UIF_PROCESS_MENUcxx . . $ `ui/ui.h:347:9`! 0x40 // use this to create a 'menu style' window (Options menu)
348 #define UIF_PROCESS_ALLcxx . . $ `ui/ui.h:348:9`! UIF_PROCESS_MENUcxx . . $ `ui/ui.h:347:9`! // to maintain compatibility with older code.
349 #define UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`! 0x80 // starts a group of gadgets that use the up and down arrows to move between
350 #define UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`! 0x100 // ends a group
351
352 #define UIF_CUSTOMFcxx . . $ `ui/ui.h:352:9`! 0x200 // use this flag and any higher for custom gadget flags, a list of predefs below
353
354 #define UILB_NOSCROLLcxx . . $ `ui/ui.h:354:9`! 0x800 // turns off automatic scroll buttons on UIListBox
355 #define UILB_AUTOSELECTcxx . . $ `ui/ui.h:355:9`! 0x1000 // turns on automatic change of SelectedIndex if scrolled out of view
356 #define UILB_NOSORTcxx . . $ `ui/ui.h:356:9`! 0x2000 // disables sorting in a listbox
357 #define UILB_CASESENSITIVEcxx . . $ `ui/ui.h:357:9`! 0x4000 // only if !UILB_NOSORT. Makes the sorting case sensitive
358
359 #define UIRB_NOBUTTONcxx . . $ `ui/ui.h:359:9`! 0x800 // disables the drawing of the button on the left of the text of a radio button
360
361 #define UIED_PASSWORDcxx . . $ `ui/ui.h:361:9`! 0x800 // special password masking for edit box text (*)
362 #define UIED_NUMBERScxx . . $ `ui/ui.h:362:9`! 0x1000 // only accept numbers for input!
363 #define UIED_AUTOSELECTcxx . . $ `ui/ui.h:363:9`! 0x2000 // selects when input reaches buffer length.
364
365 // any flags after 0x10000-0x40000000 are reserved internal to gadget controls
366
367 // ids
368 #define UID_OKcxx . . $ `ui/ui.h:368:9`! 0xEE
369 #define UID_CANCELcxx . . $ `ui/ui.h:369:9`! 0xEF
370
371 class UIGadgetcxx . . $ UIGadget# : public UIObjectcxx . . $ UIObject# {
372 friend class UIWindowcxx . . $ UIWindow#;
373
374 UIGadgetcxx . . $ UIGadget# *m_Prevcxx . . $ UIGadget#m_Prev.;
375 UIGadgetcxx . . $ UIGadget# *m_Nextcxx . . $ UIGadget#m_Next.; // for maintaining list of linked gadgets.
376
377 // master gadgets
378 UIGadgetcxx . . $ UIGadget# *m_MasterGadgetcxx . . $ UIGadget#m_MasterGadget.; // select target
379 UIGadgetcxx . . $ UIGadget# *m_CurrentSlavecxx . . $ UIGadget#m_CurrentSlave.; // current slave gadget in master.
380
381 // slave gadgets
382 UIGadgetcxx . . $ UIGadget# *m_SlaveGadgetscxx . . $ UIGadget#m_SlaveGadgets.; // contains a list of slave gadgets.
383 UIGadgetcxx . . $ UIGadget# *m_NextSlavecxx . . $ UIGadget#m_NextSlave.;
384 UIGadgetcxx . . $ UIGadget# *m_PrevSlavecxx . . $ UIGadget#m_PrevSlave.;
385
386 // information for gadgets
387 private:
388 int m_IDcxx . . $ UIGadget#m_ID.; // id value of gadget.
389 int16_tcxx . . $ int16_t# m_Datumcxx . . $ UIGadget#m_Datum.; // used to pass info around.
390 uint16_tcxx . . $ uint16_t# m_Hotkeycxx . . $ UIGadget#m_Hotkey.;
391 int m_SavedWcxx . . $ UIGadget#m_SavedW., m_SavedHcxx . . $ UIGadget#m_SavedH.; // saved values of width and height.
392 bool m_Disabledcxx . . $ UIGadget#m_Disabled.; // is gadget disabled?
393
394 static int m_LastKeycxx . . $ UIGadget#m_LastKey.; // the last key pressed.
395 static int m_LastKeyCountcxx . . $ UIGadget#m_LastKeyCount.; // number of times last key was pressed.
396 static float m_LastKeyTimecxx . . $ UIGadget#m_LastKeyTime.; // last key time.
397
398 bool TrapKeycxx . . $ UIGadget#TrapKey(83c267b20bac841a).(int key); // used to manage keypresses so repeating isn't quick.
399 void UntrapKeycxx . . $ UIGadget#UntrapKey(d4f767463ce0a6b3).(int key);
400 void CheckFocusOnSlavescxx . . $ UIGadget#CheckFocusOnSlaves(3e454b8ccf442868).(int mx, int my);
401
402 // universal variables
403 #if defined(POSIXcxx . . $ `<built-in>:478:9`!) // gcc has a hard time tracing through some of the derived classes that access m_Wnd
404 public:
405 #else
406 protected:
407 #endif
408 UIWindowcxx . . $ UIWindow# *m_Wndcxx . . $ UIGadget#m_Wnd.; // the gadget's parent window
409
410 protected:
411 int m_Flagscxx . . $ UIGadget#m_Flags.; // flags
412 bool m_infocuscxx . . $ UIGadget#m_infocus.; // gadget has focus.
413
414 int GetSavedWcxx . . $ UIGadget#GetSavedW(455f465bc33b4cdf).() const { return m_SavedWcxx . . $ UIGadget#m_SavedW.; };
415 int GetSavedHcxx . . $ UIGadget#GetSavedH(455f465bc33b4cdf).() const { return m_SavedHcxx . . $ UIGadget#m_SavedH.; };
416 inline bool HasFocuscxx . . $ UIGadget#HasFocus(50ce9a9e25b4a850).() const;
417 UIGadgetcxx . . $ UIGadget# *GetPrevUsableGadgetcxx . . $ UIGadget#GetPrevUsableGadget(42baa2535cd0f5f7).(); // gets next gadget lower in chain that's not disabled
418 UIGadgetcxx . . $ UIGadget# *GetNextUsableGadgetcxx . . $ UIGadget#GetNextUsableGadget(42baa2535cd0f5f7).(); // gets next gadget higher in chain that's not disabled
419 void LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).(); // called by window system
420 void GainFocuscxx . . $ UIGadget#GainFocus(49f6e7a06ebc5aa8).(); // called by window system
421 void LockFocuscxx . . $ UIGadget#LockFocus(49f6e7a06ebc5aa8).(); // forces input to this gadget
422 void UnlockFocuscxx . . $ UIGadget#UnlockFocus(49f6e7a06ebc5aa8).(); // releases lock on input to gadget.
423
424 // called from outside gadget hierarchy.
425 #if defined(POSIXcxx . . $ `<built-in>:480:9`!) // gcc has a hard time tracing through the dervived classes of newuiButton and thinks it can't access
426 // OnFormat()
427 public:
428 #else
429 protected:
430 #endif
431 virtual void OnFormatcxx . . $ UIGadget#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
432
433 protected:
434 virtual void OnLostFocuscxx . . $ UIGadget#OnLostFocus(49f6e7a06ebc5aa8).(){}; // override: behavior when gadget loses input focus.
435 virtual void OnGainFocuscxx . . $ UIGadget#OnGainFocus(49f6e7a06ebc5aa8).(){}; // override: behavior when gadget gains input focus.
436 virtual void OnAttachToWindowcxx . . $ UIGadget#OnAttachToWindow(49f6e7a06ebc5aa8).(){}; // override: when gadget is attached to window, this is called.
437 virtual void OnDetachFromWindowcxx . . $ UIGadget#OnDetachFromWindow(49f6e7a06ebc5aa8).(){}; // override: when gadget is detached from window, this is called.
438 virtual void OnDrawcxx . . $ UIGadget#OnDraw(49f6e7a06ebc5aa8).() = 0; // MUST override: behavior when gadget is being drawn.
439
440 // called by Process.
441 protected:
442 virtual void OnKeyDowncxx . . $ UIGadget#OnKeyDown(d4f767463ce0a6b3).(int key){}; // override: behavior when key is pressed.
443 virtual void OnKeyUpcxx . . $ UIGadget#OnKeyUp(d4f767463ce0a6b3).(int key){}; // override: behavior when key is released.
444 virtual void OnMouseBtnDowncxx . . $ UIGadget#OnMouseBtnDown(d4f767463ce0a6b3).(int btn){}; // override: behavior when mouse button is pressed.
445 virtual void OnMouseBtnUpcxx . . $ UIGadget#OnMouseBtnUp(d4f767463ce0a6b3).(int btn){}; // override: behavior when mouse button is released.
446 virtual void OnDestroycxx . . $ UIGadget#OnDestroy(49f6e7a06ebc5aa8).(){}; // override: behavior when gadget is destroyed.
447 virtual void OnUserProcesscxx . . $ UIGadget#OnUserProcess(49f6e7a06ebc5aa8).(){}; // override: behavior when gadget is processed
448 virtual void OnNotifySelectcxx . . $ UIGadget#OnNotifySelect(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *sender){}; // override: send gadget select message to another gadget.
449
450 // typically this function is called by a child class when we want
451 // to tell the caller that this gadget was selected for something.
452 virtual void OnSelectcxx . . $ UIGadget#OnSelect(49f6e7a06ebc5aa8).(); // override: behavior when gadget is selected.
453
454 public:
455 virtual void OnNotifycxx . . $ UIGadget#OnNotify(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *){}; // usually called by a child gadget of a gadget.
456
457 public:
458 UIGadgetcxx . . $ UIGadget#UIGadget(49f6e7a06ebc5aa8).();
459 virtual ~cxx . . $ UIGadget#`~UIGadget`(ced63f7c635d850d).UIGadgetcxx . . $ UIGadget#();
460
461 UIWindowcxx . . $ UIWindow# *GetWindowcxx . . $ UIGadget#GetWindow(97182dad698053bc).() { // returns the parent window for a gadget.
462 return m_Wndcxx . . $ UIGadget#m_Wnd.;
463 };
464
465 // returns link in gadget chain.
466 UIGadgetcxx . . $ UIGadget# *Nextcxx . . $ UIGadget#Next(f96d92d51f9f63fb).() const { return m_Nextcxx . . $ UIGadget#m_Next.; };
467 UIGadgetcxx . . $ UIGadget# *Prevcxx . . $ UIGadget#Prev(f96d92d51f9f63fb).() const { return m_Prevcxx . . $ UIGadget#m_Prev.; };
468
469 // defines the graphical representation of a gadget within a window.
470 // ALL Gadgets must have a wnd.
471 void Createcxx . . $ UIGadget#Create(43707b8add2f137d).(UIWindowcxx . . $ UIWindow# *wnd, int id, int x, int y, int w, int h, int flags);
472 void Destroycxx . . $ UIGadget#Destroy(49f6e7a06ebc5aa8).();
473
474 // interprets input on this gadget. this gadget is in focus.
475 void Processcxx . . $ UIGadget#Process(9e113dd3a0d25c95).(bool do_keys = true, bool do_mouse = true, bool do_user = true);
476 bool IsLockedcxx . . $ UIGadget#IsLocked(50ce9a9e25b4a850).() const; // is this gadget's focus locked?
477
478 // settings
479 void SetHotkeycxx . . $ UIGadget#SetHotkey(d4f767463ce0a6b3).(int key); // set this when key is pressed, selects gadget.
480 int GetIDcxx . . $ UIGadget#GetID(455f465bc33b4cdf).() const { return m_IDcxx . . $ UIGadget#m_ID.; };
481 int16_tcxx . . $ int16_t# GetDatumcxx . . $ UIGadget#GetDatum(524863554b4a534e).() const { return m_Datumcxx . . $ UIGadget#m_Datum.; };
482 void SetDatumcxx . . $ UIGadget#SetDatum(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# datum) { m_Datumcxx . . $ UIGadget#m_Datum. = datum; };
483 bool IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).() { return m_Disabledcxx . . $ UIGadget#m_Disabled.; }; // returns disabled state.
484 void Disablecxx . . $ UIGadget#Disable(49f6e7a06ebc5aa8).() { m_Disabledcxx . . $ UIGadget#m_Disabled. = true; }; // disables gadget.
485 void Enablecxx . . $ UIGadget#Enable(49f6e7a06ebc5aa8).() { m_Disabledcxx . . $ UIGadget#m_Disabled. = false; }; // enables gadget.
486 int GetFlagscxx . . $ UIGadget#GetFlags(455f465bc33b4cdf).() const { return m_Flagscxx . . $ UIGadget#m_Flags.; }; // gets flags for gadget.
487 void SetFlagcxx . . $ UIGadget#SetFlag(d4f767463ce0a6b3).(int flag);
488 void ClearFlagcxx . . $ UIGadget#ClearFlag(d4f767463ce0a6b3).(int flag);
489
490 // OnSelect messages to another gadget
491 void AttachSlaveGadgetcxx . . $ UIGadget#AttachSlaveGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget);
492 void DetachSlaveGadgetcxx . . $ UIGadget#DetachSlaveGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget);
493
494 // class id
495 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UIGadget#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
496 return uiGadgetcxx . . $ uiGadget.;
497 };
498 };
499
500 // ----------------------------------------------------------------------------
501 // UIHotspot
502 // This is simply a region within the parent window that when clicked on
503 // or key pressed, does something.
504
505 class UIHotspotcxx . . $ UIHotspot# : public UIGadgetcxx . . $ UIGadget# {
506 UIItemcxx . . $ UIItem# *m_ItemOffcxx . . $ UIHotspot#m_ItemOff., *m_ItemOncxx . . $ UIHotspot#m_ItemOn.; // off and on states items.
507 UIItemcxx . . $ UIItem# *m_ItemCurcxx . . $ UIHotspot#m_ItemCur.; // current item.
508
509 protected:
510 virtual void OnKeyDowncxx . . $ UIHotspot#OnKeyDown(d4f767463ce0a6b3).(int key); // override: behavior when key is pressed.
511 virtual void OnKeyUpcxx . . $ UIHotspot#OnKeyUp(d4f767463ce0a6b3).(int key){}; // override: behavior when key is released.
512 virtual void OnMouseBtnDowncxx . . $ UIHotspot#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // override: behavior when mouse button is pressed.
513 virtual void OnMouseBtnUpcxx . . $ UIHotspot#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // override: behavior when mouse button is released.
514 virtual void OnFormatcxx . . $ UIHotspot#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
515 virtual void OnDrawcxx . . $ UIHotspot#OnDraw(49f6e7a06ebc5aa8).(); // override: behavior when gadget is being drawn.
516 virtual void OnLostFocuscxx . . $ UIHotspot#OnLostFocus(49f6e7a06ebc5aa8).(); // override: behavior when gadget loses input focus.
517 virtual void OnGainFocuscxx . . $ UIHotspot#OnGainFocus(49f6e7a06ebc5aa8).(); // override: behavior when gadget gains input focus.
518 virtual void OnDestroycxx . . $ UIHotspot#OnDestroy(49f6e7a06ebc5aa8).(); // override: behavior when gadget is destroyed.
519
520 public:
521 UIHotspotcxx . . $ UIHotspot#UIHotspot(49f6e7a06ebc5aa8).();
522 virtual ~cxx . . $ UIHotspot#`~UIHotspot`(ced63f7c635d850d).UIHotspotcxx . . $ UIHotspot#();
523
524 // optional key, when pressed, triggers hotspot.
525 void Createcxx . . $ UIHotspot#Create(ee4237d76742fc72).(UIWindowcxx . . $ UIWindow# *wnd, int id, int key, UIItemcxx . . $ UIItem# *itemoff, UIItemcxx . . $ UIItem# *itemon, int x, int y, int w, int h,
526 int flags = 0);
527
528 // sets the items for the on/off state of the hotspot
529 void SetStatescxx . . $ UIHotspot#SetStates(ca92f25ca46ed94).(UIItemcxx . . $ UIItem# *itemoff, UIItemcxx . . $ UIItem# *itemon);
530
531 // class id
532 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UIHotspot#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
533 return uiHotspotcxx . . $ uiHotspot.;
534 };
535 };
536
537 // tUIButton family
538 // this family contains buttons, radio buttons, and checkboxes
539
540 // states
541 #define UI_BTS_NUMcxx . . $ `ui/ui.h:541:9`! 4
542 #define UI_BTS_DISABLEDcxx . . $ `ui/ui.h:542:9`! 0
543 #define UI_BTS_INACTIVEcxx . . $ `ui/ui.h:543:9`! 1
544 #define UI_BTS_HILITEcxx . . $ `ui/ui.h:544:9`! 2
545 #define UI_BTS_ACTIVATEDcxx . . $ `ui/ui.h:545:9`! 3
546
547 // ----------------------------------------------------------------------------
548 // UIButton
549 // This is a simple 2 state button (push down or push up)
550 // Buttons have properties of gadgets, plus bitmap information per state.
551
552 class UIButtoncxx . . $ UIButton# : public UIGadgetcxx . . $ UIGadget# {
553 private:
554 UIItemcxx . . $ UIItem# *m_Itemscxx . . $ UIButton#m_Items.[UI_BTS_NUMcxx . . $ `ui/ui.h:541:9`!]; // UI Items for each state
555 ddgr_colorcxx . . $ ddgr_color# m_Colorscxx . . $ UIButton#m_Colors.[UI_BTS_NUMcxx . . $ `ui/ui.h:541:9`!]; // Backgrounds for states
556
557 static int m_ButtonFontcxx . . $ UIButton#m_ButtonFont.; // button fonts.
558
559 protected:
560 int m_Statecxx . . $ UIButton#m_State.; // state of button
561
562 UIItemcxx . . $ UIItem# *GetStateItemcxx . . $ UIButton#GetStateItem(6e2eddbf98f33a4f).(int state) {
563 ASSERTcxx . . $ `misc/pserror.h:246:9`!(state < UI_BTS_NUMcxx . . $ `ui/ui.h:541:9`!);
564 return m_Itemscxx . . $ UIButton#m_Items.[state];
565 };
566
567 int GetColorcxx . . $ UIButton#GetColor(7ccb52b1bfe01045).(int state) const {
568 ASSERTcxx . . $ `misc/pserror.h:246:9`!(state < UI_BTS_NUMcxx . . $ `ui/ui.h:541:9`!);
569 return m_Colorscxx . . $ UIButton#m_Colors.[state];
570 };
571
572 public:
573 static void SetDefaultFontcxx . . $ UIButton#SetDefaultFont(d4f767463ce0a6b3).(int font) { // sets the button font
574 UIButtoncxx . . $ UIButton#::m_ButtonFontcxx . . $ UIButton#m_ButtonFont. = font;
575 };
576
577 public:
578 UIButtoncxx . . $ UIButton#UIButton(49f6e7a06ebc5aa8).();
579 virtual ~cxx . . $ UIButton#`~UIButton`(ced63f7c635d850d).UIButtoncxx . . $ UIButton#();
580
581 void Createcxx . . $ UIButton#Create(55c0967870198d96).(UIWindowcxx . . $ UIWindow# *parent, int id, UIItemcxx . . $ UIItem# *title, int x, int y, int w, int h, int flags = 0);
582
583 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UIButton#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
584 return uiButtoncxx . . $ uiButton.;
585 };
586
587 // settings
588 void SetStateItemcxx . . $ UIButton#SetStateItem(be8be563f9cef951).(int state, UIItemcxx . . $ UIItem# *item); // sets the background bitmap for a specified button state
589 void SetAllStatescxx . . $ UIButton#SetAllStates(52afca12b6cce14a).(UIItemcxx . . $ UIItem# *item); // Sets text for all states
590 void SetColorcxx . . $ UIButton#SetColor(c8dafc4a64bf4a1c).(int state, ddgr_colorcxx . . $ ddgr_color# col);
591 void Disablecxx . . $ UIButton#Disable(49f6e7a06ebc5aa8).(); // this adds to the gadget equivalent
592 void Enablecxx . . $ UIButton#Enable(49f6e7a06ebc5aa8).(); // this adds to the gadget equivalent
593
594 // inheritable operations
595 protected:
596 virtual void OnLostFocuscxx . . $ UIButton#OnLostFocus(49f6e7a06ebc5aa8).(); // behavior when gadget loses input focus.
597 virtual void OnGainFocuscxx . . $ UIButton#OnGainFocus(49f6e7a06ebc5aa8).(); // behavior when gadget gains input focus.
598 virtual void OnDrawcxx . . $ UIButton#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
599 virtual void OnFormatcxx . . $ UIButton#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
600
601 // called by Process.
602 protected:
603 virtual void OnKeyDowncxx . . $ UIButton#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
604 virtual void OnKeyUpcxx . . $ UIButton#OnKeyUp(d4f767463ce0a6b3).(int key); // behavior when key is released.
605 virtual void OnMouseBtnDowncxx . . $ UIButton#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // behavior when mouse button is pressed.
606 virtual void OnMouseBtnUpcxx . . $ UIButton#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // behavior when mouse button is released.
607 virtual void OnDestroycxx . . $ UIButton#OnDestroy(49f6e7a06ebc5aa8).(); // override: behavior when gadget is destroyed.
608
609 // typically this function is called by a child class when we want
610 // to tell the caller that this gadget was selected for something.
611 // virtual void OnSelect(); // override: behavior when gadget is
612 // selected.
613 };
614
615 // check boxes use most of the behavior of default buttons.
616 // the only difference is how states are set when an item is selected.
617 class UICheckBoxcxx . . $ UICheckBox# : virtual public UIButtoncxx . . $ UIButton# {
618 public:
619 UICheckBoxcxx . . $ UICheckBox#UICheckBox(49f6e7a06ebc5aa8).();
620
621 void Createcxx . . $ UICheckBox#Create(55c0967870198d96).(UIWindowcxx . . $ UIWindow# *parent, int id, UIItemcxx . . $ UIItem# *title, int x, int y, int w, int h, int flags);
622
623 void SetCheckcxx . . $ UICheckBox#SetCheck(b45ddcbc8423892c).(bool state); // turns on button (of off)
624 bool IsCheckedcxx . . $ UICheckBox#IsChecked(50ce9a9e25b4a850).() const // returns true if button is set.
625 {
626 return (m_Statecxx . . $ UIButton#m_State. == UI_BTS_ACTIVATEDcxx . . $ `ui/ui.h:545:9`!) ? true : false;
627 };
628
629 protected:
630 virtual void OnDrawcxx . . $ UICheckBox#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
631 virtual void OnFormatcxx . . $ UICheckBox#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
632
633 virtual void OnLostFocuscxx . . $ UICheckBox#OnLostFocus(49f6e7a06ebc5aa8).(); // behavior when gadget loses input focus.
634 virtual void OnGainFocuscxx . . $ UICheckBox#OnGainFocus(49f6e7a06ebc5aa8).(); // behavior when gadget gains input focus.
635 virtual void OnKeyDowncxx . . $ UICheckBox#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
636 virtual void OnKeyUpcxx . . $ UICheckBox#OnKeyUp(d4f767463ce0a6b3).(int key); // behavior when key is released.
637 virtual void OnMouseBtnDowncxx . . $ UICheckBox#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // behavior when mouse button is pressed.
638 virtual void OnMouseBtnUpcxx . . $ UICheckBox#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // behavior when mouse button is released.
639 };
640
641 // radio buttons use most of the behavior of default buttons.
642 // the only difference is how states are set when an item is selected.
643 class UIRadioButtoncxx . . $ UIRadioButton# : virtual public UIButtoncxx . . $ UIButton# {
644 UIRadioButtoncxx . . $ UIRadioButton# *m_PrevRBcxx . . $ UIRadioButton#m_PrevRB.; // previous radio button in group.
645 UIRadioButtoncxx . . $ UIRadioButton# *m_NextRBcxx . . $ UIRadioButton#m_NextRB.; // next radio button in group.
646
647 void ActivateButtoncxx . . $ UIRadioButton#ActivateButton(49f6e7a06ebc5aa8).(); // activates this button, deactivating all others.
648
649 public:
650 UIRadioButtoncxx . . $ UIRadioButton#UIRadioButton(49f6e7a06ebc5aa8).();
651
652 // flags. the group flags are set internally by Create. if prev_rb is NULL, that's the start.
653 void Createcxx . . $ UIRadioButton#Create(2c6e3f78865b93cb).(UIWindowcxx . . $ UIWindow# *parent, UIRadioButtoncxx . . $ UIRadioButton# *prev_rb, int id, UIItemcxx . . $ UIItem# *title, int x, int y, int w, int h, int flags);
654
655 void Activatecxx . . $ UIRadioButton#Activate(49f6e7a06ebc5aa8).(); // turns on button, turns off others in group.
656 bool IsActivatedcxx . . $ UIRadioButton#IsActivated(50ce9a9e25b4a850).() const // returns true if button is set.
657 {
658 return (m_Statecxx . . $ UIButton#m_State. == UI_BTS_ACTIVATEDcxx . . $ `ui/ui.h:545:9`!) ? true : false;
659 };
660
661 protected:
662 virtual void OnDrawcxx . . $ UIRadioButton#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
663 virtual void OnFormatcxx . . $ UIRadioButton#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
664
665 virtual void OnLostFocuscxx . . $ UIRadioButton#OnLostFocus(49f6e7a06ebc5aa8).(); // behavior when gadget loses input focus.
666 virtual void OnGainFocuscxx . . $ UIRadioButton#OnGainFocus(49f6e7a06ebc5aa8).(); // behavior when gadget gains input focus.
667 virtual void OnKeyDowncxx . . $ UIRadioButton#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
668 virtual void OnKeyUpcxx . . $ UIRadioButton#OnKeyUp(d4f767463ce0a6b3).(int key); // behavior when key is released.
669 virtual void OnMouseBtnDowncxx . . $ UIRadioButton#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // behavior when mouse button is pressed.
670 virtual void OnMouseBtnUpcxx . . $ UIRadioButton#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // behavior when mouse button is released.
671 };
672
673 // ----------------------------------------------------------------------------
674 // UIStatic
675 // Just a static image/text/etc.
676
677 class UIStaticcxx . . $ UIStatic# : public UIGadgetcxx . . $ UIGadget# {
678 protected:
679 UIPrimativeItemcxx . . $ UIPrimativeItem# *m_Backgroundcxx . . $ UIStatic#m_Background.;
680 UIItemcxx . . $ UIItem# *m_Titlecxx . . $ UIStatic#m_Title.;
681
682 public:
683 UIStaticcxx . . $ UIStatic#UIStatic(49f6e7a06ebc5aa8).();
684 virtual ~cxx . . $ UIStatic#`~UIStatic`(ced63f7c635d850d).UIStaticcxx . . $ UIStatic#();
685
686 void Createcxx . . $ UIStatic#Create(8745842b033f01b8).(UIWindowcxx . . $ UIWindow# *parent, UIItemcxx . . $ UIItem# *item, int x, int y, int w, int h, int flags = 0);
687 void SetBackgroundcxx . . $ UIStatic#SetBackground(20452550650c07e7).(UIPrimativeItemcxx . . $ UIPrimativeItem# *prim);
688 void SetTitlecxx . . $ UIStatic#SetTitle(52afca12b6cce14a).(UIItemcxx . . $ UIItem# *item);
689 UIItemcxx . . $ UIItem# *GetItemcxx . . $ UIStatic#GetItem(fcbccdc2fac69c8e).() const { return m_Titlecxx . . $ UIStatic#m_Title.; };
690
691 protected:
692 virtual void OnDrawcxx . . $ UIStatic#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
693 virtual void OnFormatcxx . . $ UIStatic#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
694 virtual void OnDestroycxx . . $ UIStatic#OnDestroy(49f6e7a06ebc5aa8).(); // called when gadget is being nuked.
695 };
696
697 // ----------------------------------------------------------------------------
698 // UIText
699 // This is a simple text.
700
701 class UITextcxx . . $ UIText# : public UIStaticcxx . . $ UIStatic# {
702 public:
703 void Createcxx . . $ UIText#Create(c90f152919fa414d).(UIWindowcxx . . $ UIWindow# *parent, UITextItemcxx . . $ UITextItem# *text, int x, int y, int flags = 0);
704
705 // inheritable operations
706 protected:
707 virtual void OnFormatcxx . . $ UIText#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
708 };
709
710 // ----------------------------------------------------------------------------
711 // UIProgress
712 // Progress Bar
713
714 class UIProgresscxx . . $ UIProgress# : public UIStaticcxx . . $ UIStatic# {
715 public:
716 void Createcxx . . $ UIProgress#Create(d616eeffcc609617).(UIWindowcxx . . $ UIWindow# *parent, int x, int y, int w, int h, int flags = 0);
717 void Updatecxx . . $ UIProgress#Update(9364e6e7bff7660).(float progress); // Call with a value from 0-1.0 to specify progress
718
719 // inheritable operations
720 protected:
721 float m_Progresscxx . . $ UIProgress#m_Progress.;
722 int m_ProgressWidthcxx . . $ UIProgress#m_ProgressWidth.;
723 virtual void OnDrawcxx . . $ UIProgress#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
724 virtual void OnFormatcxx . . $ UIProgress#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
725 };
726
727 // ----------------------------------------------------------------------------
728 // UIGroup
729 // Draws a group box on to the window
730
731 class UIGroupcxx . . $ UIGroup# : public UIStaticcxx . . $ UIStatic# {
732 public:
733 UIGroupcxx . . $ UIGroup#UIGroup(49f6e7a06ebc5aa8).();
734 ~cxx . . $ UIGroup#`~UIGroup`(ced63f7c635d850d).UIGroupcxx . . $ UIGroup#();
735 void Createcxx . . $ UIGroup#Create(33c6c9652d183a8e).(UIWindowcxx . . $ UIWindow# *parent, char *label, int x, int y, int w, int h, ddgr_colorcxx . . $ ddgr_color# label_color = GR_WHITEcxx . . $ GR_WHITE.,
736 ddgr_colorcxx . . $ ddgr_color# box_color = GR_WHITEcxx . . $ GR_WHITE., int flags = 0);
737
738 // inheritable operations
739 protected:
740 bool m_bTextCreatedcxx . . $ UIGroup#m_bTextCreated.;
741 UITextcxx . . $ UIText# m_tLabelcxx . . $ UIGroup#m_tLabel.;
742 char *m_Labelcxx . . $ UIGroup#m_Label.;
743 ddgr_colorcxx . . $ ddgr_color# m_LabelColorcxx . . $ UIGroup#m_LabelColor.;
744 ddgr_colorcxx . . $ ddgr_color# m_BoxColorcxx . . $ UIGroup#m_BoxColor.;
745 virtual void OnDrawcxx . . $ UIGroup#OnDraw(49f6e7a06ebc5aa8).();
746 virtual void OnDestroycxx . . $ UIGroup#OnDestroy(49f6e7a06ebc5aa8).();
747 };
748
749 // ----------------------------------------------------------------------------
750 // UIEdit
751 // A single line edit control.
752
753 #define KEYDOWN_FIRST_DELAYcxx . . $ `ui/ui.h:753:9`! 0.5f
754 #define KEYDOWN_REPEAT_DELAYcxx . . $ `ui/ui.h:754:9`! 0.10f
755
756 class UIEditcxx . . $ UIEdit# : public UIGadgetcxx . . $ UIGadget# {
757 char *m_TextBufcxx . . $ UIEdit#m_TextBuf.; // Text buffer for edit control.
758 int m_FontHandlecxx . . $ UIEdit#m_FontHandle.; // font for edit control. (default -1 = window's font)
759 int m_BufSizecxx . . $ UIEdit#m_BufSize.; // buffersize
760 int m_Colorcxx . . $ UIEdit#m_Color.; // color of text.
761 int m_CursorPosXcxx . . $ UIEdit#m_CursorPosX.; // text cursor position within box.
762 bool m_Activecxx . . $ UIEdit#m_Active.; // active?
763 int m_CurPoscxx . . $ UIEdit#m_CurPos.; // cursor postion in buffer.
764 int m_StartPoscxx . . $ UIEdit#m_StartPos.; // active start position in buffer of what's drawn.
765 int m_X1bcxx . . $ UIEdit#m_X1b., m_X2bcxx . . $ UIEdit#m_X2b., m_Ybcxx . . $ UIEdit#m_Yb.; // x boundaries of text.
766 int m_ScrollThreshcxx . . $ UIEdit#m_ScrollThresh.; // scrolling x threshold.
767 bool m_UpdateCountcxx . . $ UIEdit#m_UpdateCount.; // used to update scroll position on next draw frame.
768
769 // called from outside gadget hierarchy.
770 protected:
771 void DrawTextcxx . . $ UIEdit#DrawText(49f6e7a06ebc5aa8).(); // draws text in box
772 void Deactivatecxx . . $ UIEdit#Deactivate(49f6e7a06ebc5aa8).(); // deactivates edit box (use if you know what you're doing.)
773 void SetTextBoundscxx . . $ UIEdit#SetTextBounds(b1146eedae1e1d0b).(int x1, int x2, int yoff); // horizontal clipping of text within editbox
774
775 // called from outside gadget hierarchy.
776 protected:
777 virtual void OnLostFocuscxx . . $ UIEdit#OnLostFocus(49f6e7a06ebc5aa8).(); // override: behavior when gadget loses input focus.
778 virtual void OnGainFocuscxx . . $ UIEdit#OnGainFocus(49f6e7a06ebc5aa8).(); // override: behavior when gadget gains input focus.
779 virtual void OnDrawcxx . . $ UIEdit#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
780
781 // called by Process.
782 protected:
783 virtual void OnKeyDowncxx . . $ UIEdit#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
784 virtual void OnKeyUpcxx . . $ UIEdit#OnKeyUp(d4f767463ce0a6b3).(int key); // behavior when key is released.
785 virtual void OnMouseBtnDowncxx . . $ UIEdit#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // behavior when mouse button is pressed.
786 virtual void OnMouseBtnUpcxx . . $ UIEdit#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // behavior when mouse button is released.
787 virtual void OnSelectcxx . . $ UIEdit#OnSelect(49f6e7a06ebc5aa8).();
788 virtual void OnDestroycxx . . $ UIEdit#OnDestroy(49f6e7a06ebc5aa8).(); // override: behavior when gadget is destroyed.
789
790 public:
791 UIEditcxx . . $ UIEdit#UIEdit(49f6e7a06ebc5aa8).();
792 virtual ~cxx . . $ UIEdit#`~UIEdit`(ced63f7c635d850d).UIEditcxx . . $ UIEdit#();
793
794 void Createcxx . . $ UIEdit#Create(43707b8add2f137d).(UIWindowcxx . . $ UIWindow# *parent, int id, int x, int y, int w, int h, int flags = 0);
795
796 // settings
797 void SetBufferLencxx . . $ UIEdit#SetBufferLen(d4f767463ce0a6b3).(int length); // sets the length of the input buffer.
798 void SetTextcxx . . $ UIEdit#SetText(85c52e162fed56f9).(const char *text); // sets the text buffer.
799 void GetTextcxx . . $ UIEdit#GetText(a07d8cccb7673f5a).(char *buffer, int len); // retrieve text in edit control.
800 void SetFontcxx . . $ UIEdit#SetFont(d4f767463ce0a6b3).(int font); // sets font of control (default is window's font.)
801 void SetColorcxx . . $ UIEdit#SetColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# col); // sets color of text.
802 void Activatecxx . . $ UIEdit#Activate(49f6e7a06ebc5aa8).(); // activates edit box manually (allows editing.)
803
804 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UIEdit#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
805 return uiEditcxx . . $ uiEdit.;
806 };
807 };
808
809 // ----------------------------------------------------------------------------
810 // UISlider
811 // A simple slider
812
813 class UISlidercxx . . $ UISlider# : public UIGadgetcxx . . $ UIGadget# {
814 void (*selectchange_fncxx . . $ UISlider#selectchange_fn.)(int); // callback when selection changes in slider
815 void (*selectchange_id_fncxx . . $ UISlider#selectchange_id_fn.)(int, void *); // callback when selection changes in slider, also returns the ID
816 void *m_callbackptrcxx . . $ UISlider#m_callbackptr.; // user defined callback pointer
817 int m_Poscxx . . $ UISlider#m_Pos.; // this is the returned value as shown in the range.
818 int m_Rangecxx . . $ UISlider#m_Range.; // returned value of slider is 0 to m_Range-1.
819 int m_PixelWidthcxx . . $ UISlider#m_PixelWidth.; // used to get the current position of slider.
820 float m_IntervalWidthcxx . . $ UISlider#m_IntervalWidth.; // width of one tick o
821 int switch_xcxx . . $ UISlider#switch_x., switch_ycxx . . $ UISlider#switch_y.; // little box width and height.
822 int switch_wcxx . . $ UISlider#switch_w., switch_hcxx . . $ UISlider#switch_h.;
823
824 UIItemcxx . . $ UIItem# *switch_itemcxx . . $ UISlider#switch_item.; // slider switch item
825 UIItemcxx . . $ UIItem# *slider_itemcxx . . $ UISlider#slider_item.; // slider item
826
827 public:
828 UISlidercxx . . $ UISlider#UISlider(49f6e7a06ebc5aa8).();
829 virtual ~cxx . . $ UISlider#`~UISlider`(ced63f7c635d850d).UISlidercxx . . $ UISlider#();
830
831 void Createcxx . . $ UISlider#Create(43707b8add2f137d).(UIWindowcxx . . $ UIWindow# *parent, int id, int x, int y, int w, int h, int flags = 0);
832
833 // sets visual characteristics of slider.
834 void SetSliderSwitchItemcxx . . $ UISlider#SetSliderSwitchItem(52afca12b6cce14a).(UIItemcxx . . $ UIItem# *item);
835 void SetSliderItemcxx . . $ UISlider#SetSliderItem(52afca12b6cce14a).(UIItemcxx . . $ UIItem# *item);
836
837 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UISlider#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
838 return uiSlidercxx . . $ uiSlider.;
839 };
840
841 // settings
842 void SetRangecxx . . $ UISlider#SetRange(d4f767463ce0a6b3).(int range); // sets range of scroll bar
843 int GetRangecxx . . $ UISlider#GetRange(455f465bc33b4cdf).() const { // range of scroll bar
844 return m_Rangecxx . . $ UISlider#m_Range.;
845 };
846 void SetPoscxx . . $ UISlider#SetPos(d4f767463ce0a6b3).(int pos) { // sets the position of the slider.
847 if (pos < 0)
848 pos = 0;
849 else if (pos >= m_Rangecxx . . $ UISlider#m_Range.)
850 pos = m_Rangecxx . . $ UISlider#m_Range. - 1;
851 m_Poscxx . . $ UISlider#m_Pos. = pos;
852 };
853 int GetPoscxx . . $ UISlider#GetPos(455f465bc33b4cdf).() const { // gets position of slider.
854 return m_Poscxx . . $ UISlider#m_Pos.;
855 };
856
857 void SetSelectChangeCallbackcxx . . $ UISlider#SetSelectChangeCallback(94eb4457dc8d4d10).(void (*fn)(int));
858 void SetSelectChangeCallbackcxx . . $ UISlider#SetSelectChangeCallback(af3d7c1df3fe7292).(void (*fn)(int, void *), void *ptr);
859
860 // called from outside gadget hierarchy.
861 protected:
862 virtual void OnFormatcxx . . $ UISlider#OnFormat(49f6e7a06ebc5aa8).(); // override: called when resized or before drawing.
863 virtual void OnLostFocuscxx . . $ UISlider#OnLostFocus(49f6e7a06ebc5aa8).(){}; // override: behavior when gadget loses input focus.
864 virtual void OnGainFocuscxx . . $ UISlider#OnGainFocus(49f6e7a06ebc5aa8).(){}; // override: behavior when gadget gains input focus.
865 virtual void OnDrawcxx . . $ UISlider#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
866 virtual void OnDestroycxx . . $ UISlider#OnDestroy(49f6e7a06ebc5aa8).(); // behavior when gadget is being destroyed.
867 virtual void OnKeyDowncxx . . $ UISlider#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
868 virtual void OnKeyUpcxx . . $ UISlider#OnKeyUp(d4f767463ce0a6b3).(int key); // behavior when key is released.
869 virtual void OnMouseBtnDowncxx . . $ UISlider#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // behavior when mouse button is pressed.
870 virtual void OnMouseBtnUpcxx . . $ UISlider#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // behavior when mouse button is released.
871 virtual void OnSelectcxx . . $ UISlider#OnSelect(49f6e7a06ebc5aa8).(); // override
872 };
873
874 // ----------------------------------------------------------------------------
875 // UIListBox
876 // A listbox may contain text items
877 // Allows the user to scroll through them too.
878
879 #define LISTBOX_BUFFER_SIZEcxx . . $ `ui/ui.h:879:9`! 20
880
881 class UIListBoxcxx . . $ UIListBox# : public UIGadgetcxx . . $ UIGadget# {
882 void (*selectchange_fncxx . . $ UIListBox#selectchange_fn.)(int); // callback when selection changes in listbox.
883 void (*selectchange_id_fncxx . . $ UIListBox#selectchange_id_fn.)(int, void *); // callback when selection changes in listbox..also return the ID
884 void *m_callbackptrcxx . . $ UIListBox#m_callbackptr.; // user defined callback pointer
885 ddgr_colorcxx . . $ ddgr_color# m_SelectColorcxx . . $ UIListBox#m_SelectColor.; // selected text color
886 ddgr_colorcxx . . $ ddgr_color# m_HiliteColorcxx . . $ UIListBox#m_HiliteColor.; // color of hilite bar
887 int m_LastMseXcxx . . $ UIListBox#m_LastMseX., m_LastMseYcxx . . $ UIListBox#m_LastMseY.; // used for double clicking.
888 uint8_tcxx . . $ uint8_t# m_Alphacxx . . $ UIListBox#m_Alpha.; // alpha value of listbox.
889
890 bool MseCheckSelectcxx . . $ UIListBox#MseCheckSelect(cf9ef193275fa6d8).(int x, int y); // check if x and y selection hits a selected item.
891 void SetInternalSelectedIndexcxx . . $ UIListBox#SetInternalSelectedIndex(d4f767463ce0a6b3).(int index); // call by listbox system.
892
893 protected:
894 int m_TextOffXcxx . . $ UIListBox#m_TextOffX., m_TextOffYcxx . . $ UIListBox#m_TextOffY.; // offset of text to border.
895 int m_ArrowWidthcxx . . $ UIListBox#m_ArrowWidth.; // with of arrow.
896 int m_CXcxx . . $ UIListBox#m_CX., m_CYcxx . . $ UIListBox#m_CY., m_CX2cxx . . $ UIListBox#m_CX2., m_CY2cxx . . $ UIListBox#m_CY2.; // clipping text.
897
898 public:
899 UIListBoxcxx . . $ UIListBox#UIListBox(49f6e7a06ebc5aa8).();
900 virtual ~cxx . . $ UIListBox#`~UIListBox`(ced63f7c635d850d).UIListBoxcxx . . $ UIListBox#();
901
902 void Createcxx . . $ UIListBox#Create(43707b8add2f137d).(UIWindowcxx . . $ UIWindow# *parent, int id, int x, int y, int w, int h, int flags = 0);
903
904 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UIListBox#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
905 return uiListBoxcxx . . $ uiListBox.;
906 };
907
908 // settings
909 void AddItemcxx . . $ UIListBox#AddItem(f57aa2fef0df48a8).(const UIItemcxx . . $ UIItem# *item); // adds an item to the list, no sorting
910 void RemoveItemcxx . . $ UIListBox#RemoveItem(f57aa2fef0df48a8).(const UIItemcxx . . $ UIItem# *item); // removes an item from the list.
911 void RemoveAllcxx . . $ UIListBox#RemoveAll(49f6e7a06ebc5aa8).(); // empties listbox
912 void SelectItemcxx . . $ UIListBox#SelectItem(f57aa2fef0df48a8).(const UIItemcxx . . $ UIItem# *item); // selects the given item in the list.
913 UIItemcxx . . $ UIItem# *GetItemcxx . . $ UIListBox#GetItem(546e15a08a69e3a5).(int index) const; // returns the item at listbox index given.
914
915 int GetListIndexcxx . . $ UIListBox#GetListIndex(455f465bc33b4cdf).() const; // returns the current listbox index
916 void SetListIndexcxx . . $ UIListBox#SetListIndex(d4f767463ce0a6b3).(int index); // sets the index of a listbox
917
918 int GetSelectedIndexcxx . . $ UIListBox#GetSelectedIndex(455f465bc33b4cdf).() const; // returns which item index is selected
919 void SetSelectedIndexcxx . . $ UIListBox#SetSelectedIndex(d4f767463ce0a6b3).(int index); // selects an item based on index and moves listbox
920 void SetSelectedColorcxx . . $ UIListBox#SetSelectedColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# col); // selected text color.
921 void SetHiliteColorcxx . . $ UIListBox#SetHiliteColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# col); // sets the hilite bar color
922
923 void SetSelectChangeCallbackcxx . . $ UIListBox#SetSelectChangeCallback(94eb4457dc8d4d10).(void (*fn)(int));
924 void SetSelectChangeCallbackcxx . . $ UIListBox#SetSelectChangeCallback(af3d7c1df3fe7292).(void (*fn)(int, void *), void *ptr);
925
926 // called from outside gadget hierarchy.
927 protected:
928 virtual void OnLostFocuscxx . . $ UIListBox#OnLostFocus(49f6e7a06ebc5aa8).(); // override: behavior when gadget loses input focus.
929 virtual void OnGainFocuscxx . . $ UIListBox#OnGainFocus(49f6e7a06ebc5aa8).(); // override: behavior when gadget gains input focus.
930 virtual void OnDrawcxx . . $ UIListBox#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
931 virtual void OnKeyDowncxx . . $ UIListBox#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
932 virtual void OnKeyUpcxx . . $ UIListBox#OnKeyUp(d4f767463ce0a6b3).(int key); // behavior when key is released.
933 virtual void OnMouseBtnDowncxx . . $ UIListBox#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // behavior when mouse button is pressed.
934 virtual void OnMouseBtnUpcxx . . $ UIListBox#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // behavior when mouse button is released.
935 virtual void OnSelectcxx . . $ UIListBox#OnSelect(49f6e7a06ebc5aa8).();
936 virtual void OnDestroycxx . . $ UIListBox#OnDestroy(49f6e7a06ebc5aa8).(); // called when destroyed.
937 virtual void OnUserProcesscxx . . $ UIListBox#OnUserProcess(49f6e7a06ebc5aa8).(); // override: behavior when gadget is processed
938
939 private:
940 UIItemcxx . . $ UIItem# **m_ItemListcxx . . $ UIListBox#m_ItemList.; // list of items in listbox
941 int *m_Virt2Realcxx . . $ UIListBox#m_Virt2Real.; // translates virtual(user) id to real index
942 int *m_Real2Virtcxx . . $ UIListBox#m_Real2Virt.; // translates real index into virtual(user) id
943
944 float m_ClickTimecxx . . $ UIListBox#m_ClickTime.; // done to check for double clicks?
945 int m_MouseStatecxx . . $ UIListBox#m_MouseState.; // done for mouse selection.
946 int m_MouseXcxx . . $ UIListBox#m_MouseX., m_MouseYcxx . . $ UIListBox#m_MouseY.;
947 int m_NumItemscxx . . $ UIListBox#m_NumItems.; // number of items in list.
948 int m_SelectedIndexcxx . . $ UIListBox#m_SelectedIndex.; // current selected index into listbox
949 int m_Indexcxx . . $ UIListBox#m_Index.; // current index of visible items.
950 bool m_ShowDowncxx . . $ UIListBox#m_ShowDown., m_ShowUpcxx . . $ UIListBox#m_ShowUp.; // whether the down and up arrows are displayed
951 int m_UpArrowY0cxx . . $ UIListBox#m_UpArrowY0., m_DownArrowY0cxx . . $ UIListBox#m_DownArrowY0.; // up and down arrow y locations.
952 int m_UpArrowY1cxx . . $ UIListBox#m_UpArrowY1., m_DownArrowY1cxx . . $ UIListBox#m_DownArrowY1.; // up and down arrow y max locations.
953 int m_NumVisibleItemscxx . . $ UIListBox#m_NumVisibleItems.; // number of visible items in list viewport.
954
955 public:
956 int GetNumItemscxx . . $ UIListBox#GetNumItems(455f465bc33b4cdf).() const { return m_NumItemscxx . . $ UIListBox#m_NumItems.; };
957 };
958
959 // ----------------------------------------------------------------------------
960 // UIComboBox
961 // A listbox may contain text items, BUT only one will be visible
962 // Allows the user to scroll through them too.
963
964 class UIComboBoxcxx . . $ UIComboBox# : public UIGadgetcxx . . $ UIGadget# {
965 public:
966 UIComboBoxcxx . . $ UIComboBox#UIComboBox(49f6e7a06ebc5aa8).();
967 virtual ~cxx . . $ UIComboBox#`~UIComboBox`(ced63f7c635d850d).UIComboBoxcxx . . $ UIComboBox#();
968
969 void Createcxx . . $ UIComboBox#Create(43707b8add2f137d).(UIWindowcxx . . $ UIWindow# *parent, int id, int x, int y, int w, int h, int flags = 0);
970
971 private:
972 UIItemcxx . . $ UIItem# **m_ItemListcxx . . $ UIComboBox#m_ItemList.; // list of items in listbox
973 int m_nItemscxx . . $ UIComboBox#m_nItems.; // number of items.
974 int m_ArrYcxx . . $ UIComboBox#m_ArrY., m_ArrHcxx . . $ UIComboBox#m_ArrH.; // up and down arrow dimensions
975 int m_UpArrXcxx . . $ UIComboBox#m_UpArrX., m_UpArrWcxx . . $ UIComboBox#m_UpArrW., m_DownArrXcxx . . $ UIComboBox#m_DownArrX., m_DownArrWcxx . . $ UIComboBox#m_DownArrW.;
976 int m_Indexcxx . . $ UIComboBox#m_Index.; // current index.
977 void (*selectchange_fncxx . . $ UIComboBox#selectchange_fn.)(int); // callback when selection changes in listbox.
978 bool m_ShowUpcxx . . $ UIComboBox#m_ShowUp., m_ShowDowncxx . . $ UIComboBox#m_ShowDown.;
979 float m_scrolltimercxx . . $ UIComboBox#m_scrolltimer.; // scroll timer for delay in mouse.
980 int m_scrollstagecxx . . $ UIComboBox#m_scrollstage.; // determines how scrolling will work.
981
982 public:
983 void AddItemcxx . . $ UIComboBox#AddItem(f57aa2fef0df48a8).(const UIItemcxx . . $ UIItem# *item);
984 void RemoveItemcxx . . $ UIComboBox#RemoveItem(f57aa2fef0df48a8).(const UIItemcxx . . $ UIItem# *item); // removes an item from the list.
985 void RemoveAllcxx . . $ UIComboBox#RemoveAll(49f6e7a06ebc5aa8).(); // empties listbox
986 void SelectItemcxx . . $ UIComboBox#SelectItem(f57aa2fef0df48a8).(const UIItemcxx . . $ UIItem# *item); // selects the given item in the list.
987 UIItemcxx . . $ UIItem# *GetItemcxx . . $ UIComboBox#GetItem(546e15a08a69e3a5).(int index) const; // returns the item at listbox index given.
988
989 int GetSelectedIndexcxx . . $ UIComboBox#GetSelectedIndex(455f465bc33b4cdf).() const { // returns which item index is selected
990 return m_Indexcxx . . $ UIComboBox#m_Index.;
991 };
992 void SetSelectedIndexcxx . . $ UIComboBox#SetSelectedIndex(d4f767463ce0a6b3).(int index); // sets the selected index.
993
994 void SetSelectChangeCallbackcxx . . $ UIComboBox#SetSelectChangeCallback(94eb4457dc8d4d10).(void (*fn)(int));
995
996 protected:
997 virtual void OnDrawcxx . . $ UIComboBox#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
998 virtual void OnKeyDowncxx . . $ UIComboBox#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
999 virtual void OnMouseBtnDowncxx . . $ UIComboBox#OnMouseBtnDown(d4f767463ce0a6b3).(int btn); // behavior when mouse button is pressed.
1000 virtual void OnMouseBtnUpcxx . . $ UIComboBox#OnMouseBtnUp(d4f767463ce0a6b3).(int btn); // behavior when mouse button is released
1001 virtual void OnSelectcxx . . $ UIComboBox#OnSelect(49f6e7a06ebc5aa8).();
1002 virtual void OnDestroycxx . . $ UIComboBox#OnDestroy(49f6e7a06ebc5aa8).(); // called when destroyed.
1003
1004 protected:
1005 int m_CXcxx . . $ UIComboBox#m_CX., m_CYcxx . . $ UIComboBox#m_CY., m_CX2cxx . . $ UIComboBox#m_CX2., m_CY2cxx . . $ UIComboBox#m_CY2.; // text clippers.
1006 };
1007
1008 // ----------------------------------------------------------------------------
1009 // UIConsoleGadget
1010 // a console that's a gadget within a window
1011
1012 class UIConsoleGadgetcxx . . $ UIConsoleGadget# : public UIGadgetcxx . . $ UIGadget# {
1013 int m_ConsoleFontcxx . . $ UIConsoleGadget#m_ConsoleFont.; // standard font for text in console
1014 ddgr_colorcxx . . $ ddgr_color# *m_ColorRowscxx . . $ UIConsoleGadget#m_ColorRows.; // color per row.
1015 char *m_ConsoleBuffercxx . . $ UIConsoleGadget#m_ConsoleBuffer.; // text buffer of console.
1016 int m_Rowscxx . . $ UIConsoleGadget#m_Rows., m_Colscxx . . $ UIConsoleGadget#m_Cols.; // dimensions in text.
1017 int m_VisRowscxx . . $ UIConsoleGadget#m_VisRows.; // visible rows and columns
1018 int m_VisRowStartcxx . . $ UIConsoleGadget#m_VisRowStart.; // scroll start of visible region of buffer.
1019 int m_CurRowcxx . . $ UIConsoleGadget#m_CurRow., m_CurColcxx . . $ UIConsoleGadget#m_CurCol.; // current row and column of text pointer
1020 int m_OffXcxx . . $ UIConsoleGadget#m_OffX., m_OffYcxx . . $ UIConsoleGadget#m_OffY.;
1021 int m_Rowsizecxx . . $ UIConsoleGadget#m_Rowsize.; // rowsize of character buffer.
1022 ddgr_colorcxx . . $ ddgr_color# m_LineColorcxx . . $ UIConsoleGadget#m_LineColor.; // color of current line.
1023 int m_LineIndexcxx . . $ UIConsoleGadget#m_LineIndex.; // index within current row memory-wise(not column wise).
1024 int m_PutsBufLencxx . . $ UIConsoleGadget#m_PutsBufLen.; // current length of puts buffer
1025 char *m_PutsBuffercxx . . $ UIConsoleGadget#m_PutsBuffer.; // puts buffer.
1026
1027 private:
1028 void PutCharcxx . . $ UIConsoleGadget#PutChar(d4f767463ce0a6b3).(int ch); // outputs a character onto the console.
1029 void Scrollcxx . . $ UIConsoleGadget#Scroll(49f6e7a06ebc5aa8).(); // scrolls window.
1030
1031 protected:
1032 virtual void OnDrawcxx . . $ UIConsoleGadget#OnDraw(49f6e7a06ebc5aa8).(); // behavior when gadget is being drawn.
1033 virtual void OnUserProcesscxx . . $ UIConsoleGadget#OnUserProcess(49f6e7a06ebc5aa8).(); // behavior when gadget is processed
1034 virtual void OnDestroycxx . . $ UIConsoleGadget#OnDestroy(49f6e7a06ebc5aa8).(); // behavior when gadget is destroyed.
1035
1036 public:
1037 UIConsoleGadgetcxx . . $ UIConsoleGadget#UIConsoleGadget(49f6e7a06ebc5aa8).();
1038 virtual ~cxx . . $ UIConsoleGadget#`~UIConsoleGadget`(ced63f7c635d850d).UIConsoleGadgetcxx . . $ UIConsoleGadget#();
1039
1040 // font = console font, NOT GADGET FONT. This font is used to proportion window
1041 void Createcxx . . $ UIConsoleGadget#Create(f586159e43e8c8b5).(UIWindowcxx . . $ UIWindow# *parent, int id, int x, int y, int font, int cols, int rows, int flags = UIF_BORDERcxx . . $ `ui/ui.h:344:9`!);
1042
1043 // functions
1044 void putscxx . . $ UIConsoleGadget#puts(d7adf5cfafc0e15a).(ddgr_colorcxx . . $ ddgr_color# color, const char *str);
1045 };
1046
1047 // ----------------------------------------------------------------------------
1048 // UIWindow
1049 // A window contains different UIGadgets.
1050 // This is where all objects will interact with the user.
1051 #define N_WINDOW_ACCELScxx . . $ `ui/ui.h:1051:9`! 48
1052
1053 class UIWindowcxx . . $ UIWindow# : public UIObjectcxx . . $ UIObject# {
1054 friend class UIGadgetcxx . . $ UIGadget#;
1055
1056 UIGadgetcxx . . $ UIGadget# *m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.; // gadget list for window
1057 UIGadgetcxx . . $ UIGadget# *m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.;
1058 UIGadgetcxx . . $ UIGadget# *m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.;
1059 UIGadgetcxx . . $ UIGadget# *m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget.; // marks a particular gadget that will always have focus
1060 UIItemcxx . . $ UIItem# *m_BackItemcxx . . $ UIWindow#m_BackItem.; // background UI item.
1061
1062 float m_KeyTimecxx . . $ UIWindow#m_KeyTime.; // time when key went down.
1063
1064 ddgr_colorcxx . . $ ddgr_color# m_BackColorcxx . . $ UIWindow#m_BackColor.; // unconditional background color
1065 int m_FontHandlecxx . . $ UIWindow#m_FontHandle.;
1066 int m_LastKeycxx . . $ UIWindow#m_LastKey.; // the last key pressed.
1067 int m_LastKeyCountcxx . . $ UIWindow#m_LastKeyCount.; // number of times last key was pressed.
1068 float m_LastKeyTimecxx . . $ UIWindow#m_LastKeyTime.; // last key time.
1069 bool m_HoldHotkeyscxx . . $ UIWindow#m_HoldHotkeys.;
1070 bool m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget.; // next process will reset current gadget to 1st valid one.
1071 bool m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup.; // is m_GadgetCur inside a group?
1072 structcxx . . $ UIWindow#$anonymous_type_0# {
1073 int keycxx . . $ UIWindow#$anonymous_type_0#key.;
1074 int idcxx . . $ UIWindow#$anonymous_type_0#id.;
1075 } m_Acceleratorscxx . . $ UIWindow#m_Accelerators.[N_WINDOW_ACCELScxx . . $ `ui/ui.h:1051:9`!]; // used for quick key press interaction
1076 int m_naccelscxx . . $ UIWindow#m_naccels.;
1077
1078 static int m_WindowFontcxx . . $ UIWindow#m_WindowFont.; // global window default font
1079
1080 private:
1081 bool TrapKeycxx . . $ UIWindow#TrapKey(83c267b20bac841a).(int key);
1082 void UntrapKeycxx . . $ UIWindow#UntrapKey(d4f767463ce0a6b3).(int key);
1083 void LockFocusOnGadgetcxx . . $ UIWindow#LockFocusOnGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget); // forces a particular gadget into focus, always until unlocked.
1084 void UnlockFocusOnGadgetcxx . . $ UIWindow#UnlockFocusOnGadget(49f6e7a06ebc5aa8).();
1085
1086 protected:
1087 ddgr_colorcxx . . $ ddgr_color# GetBackColorcxx . . $ UIWindow#GetBackColor(ddd8539a2fcdd4ce).() const { return m_BackColorcxx . . $ UIWindow#m_BackColor.; };
1088
1089 int m_Flagscxx . . $ UIWindow#m_Flags.; // window flags.
1090
1091 // inheritable actions
1092 protected:
1093 virtual void OnDrawcxx . . $ UIWindow#OnDraw(49f6e7a06ebc5aa8).(); // overridable draws the window background before gadgets
1094 virtual void OnUserProcesscxx . . $ UIWindow#OnUserProcess(49f6e7a06ebc5aa8).(); // overridable: runs after window is processed, to supplement it.
1095 virtual void OnDestroycxx . . $ UIWindow#OnDestroy(49f6e7a06ebc5aa8).(){}; // overridable: called in Destroy
1096 virtual void OnKeyDowncxx . . $ UIWindow#OnKeyDown(d4f767463ce0a6b3).(int key); // behavior when key is pressed.
1097 virtual void OnKeyUpcxx . . $ UIWindow#OnKeyUp(d4f767463ce0a6b3).(int key); // behavior when key is released.
1098
1099 public:
1100 static void SetDefaultFontcxx . . $ UIWindow#SetDefaultFont(d4f767463ce0a6b3).(int font) { // sets the default font for any window
1101 UIWindowcxx . . $ UIWindow#::m_WindowFontcxx . . $ UIWindow#m_WindowFont. = font;
1102 };
1103
1104 public:
1105 UIWindowcxx . . $ UIWindow#UIWindow(49f6e7a06ebc5aa8).();
1106 virtual ~cxx . . $ UIWindow#`~UIWindow`(ced63f7c635d850d).UIWindowcxx . . $ UIWindow#();
1107
1108 void Destroycxx . . $ UIWindow#Destroy(49f6e7a06ebc5aa8).(); // must call if you created window. will be called in destructor
1109
1110 void Createcxx . . $ UIWindow#Create(1559a299834bcdd5).(int x, int y, int w, int h, int flags = 0);
1111 int GetFlagscxx . . $ UIWindow#GetFlags(455f465bc33b4cdf).() const { return m_Flagscxx . . $ UIWindow#m_Flags.; };
1112
1113 // used to mark key pressed to id numbers
1114 void AddAcceleratorKeycxx . . $ UIWindow#AddAcceleratorKey(3e454b8ccf442868).(int key, int id);
1115 void ResetAcceleratorKeycxx . . $ UIWindow#ResetAcceleratorKey(49f6e7a06ebc5aa8).();
1116
1117 // gadget management
1118 void AddGadgetcxx . . $ UIWindow#AddGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget); // adds a gadget to the gadget list
1119 void RemoveGadgetcxx . . $ UIWindow#RemoveGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget); // removes a gadget from the list.
1120 UIGadgetcxx . . $ UIGadget# *GetGadgetFromIDcxx . . $ UIWindow#GetGadgetFromID(f9f479e70e665865).(int id); // returns the gadget pointer given an id if in window
1121 void SetFocusOnGadgetcxx . . $ UIWindow#SetFocusOnGadget(75ffd377f9406104).(UIGadgetcxx . . $ UIGadget# *gadget, bool key = false);
1122
1123 UIGadgetcxx . . $ UIGadget# *GetFocuscxx . . $ UIWindow#GetFocus(42baa2535cd0f5f7).() { return m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.; };
1124
1125 // input/output management
1126 virtual int Processcxx . . $ UIWindow#Process(b126dc7c1de90089).(); // handles gadget selection/focus and calls gadgets.
1127 void Rendercxx . . $ UIWindow#Render(49f6e7a06ebc5aa8).(); // renders one window frame.
1128 void Opencxx . . $ UIWindow#Open(49f6e7a06ebc5aa8).(); // adds window to ui list.
1129 void Closecxx . . $ UIWindow#Close(49f6e7a06ebc5aa8).(); // removes window from ui list.
1130
1131 // settings
1132 void SetFontcxx . . $ UIWindow#SetFont(d4f767463ce0a6b3).(int handle); // sets window's font.
1133 void SetBackItemcxx . . $ UIWindow#SetBackItem(52afca12b6cce14a).(UIItemcxx . . $ UIItem# *item) { // sets the background drawing item.
1134 if (m_BackItemcxx . . $ UIWindow#m_BackItem.)
1135 delete m_BackItemcxx . . $ UIWindow#m_BackItem.;
1136 m_BackItemcxx . . $ UIWindow#m_BackItem. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1137 if (item)
1138 m_BackItemcxx . . $ UIWindow#m_BackItem. = item->CopyUIItemcxx . . $ UIItem#CopyUIItem(ff7db2a2e5605676).();
1139 }; //
1140 void SetBackColorcxx . . $ UIWindow#SetBackColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# col) { // sets the background color. this is ALWAYS first, then the backitem
1141 m_BackColorcxx . . $ UIWindow#m_BackColor. = col;
1142 };
1143
1144 void HoldHotkeyscxx . . $ UIWindow#HoldHotkeys(49f6e7a06ebc5aa8).() { m_HoldHotkeyscxx . . $ UIWindow#m_HoldHotkeys. = true; }; // no hotkeys will be processed until ResumeHotkeys is called.
1145 void ResumeHotkeyscxx . . $ UIWindow#ResumeHotkeys(49f6e7a06ebc5aa8).() { m_HoldHotkeyscxx . . $ UIWindow#m_HoldHotkeys. = false; };
1146
1147 // class id
1148 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UIWindow#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
1149 return uiWindowcxx . . $ uiWindow.;
1150 };
1151
1152 // OBSOLETE
1153 void LockKeyFocusOnGadgetcxx . . $ UIWindow#LockKeyFocusOnGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget); // forces all keyinput onto one gadget. (be wary)
1154 };
1155
1156 // Special windows
1157 // titled window (functions as a standard dialog box.), without modality though.
1158
1159 class UITitledWindowcxx . . $ UITitledWindow# : public UIWindowcxx . . $ UIWindow# {
1160 UITextItemcxx . . $ UITextItem# m_Titlecxx . . $ UITitledWindow#m_Title.; // title of window
1161 int m_CaptionColorcxx . . $ UITitledWindow#m_CaptionColor.; // caption's color.
1162 int m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness.; // border thickness.
1163
1164 public:
1165 UITitledWindowcxx . . $ UITitledWindow#UITitledWindow(49f6e7a06ebc5aa8).();
1166 virtual ~cxx . . $ UITitledWindow#`~UITitledWindow`(ced63f7c635d850d).UITitledWindowcxx . . $ UITitledWindow#();
1167
1168 void Createcxx . . $ UITitledWindow#Create(1bd756661ca4f8fa).(UITextItemcxx . . $ UITextItem# &title, int x, int y, int w, int h);
1169
1170 // class id
1171 virtual tUIClasscxx . . $ tUIClass# Classcxx . . $ UITitledWindow#Class(ddd8539a2fcdd4ce).() const { // Overide this function to name the class
1172 return uiTitledWindowcxx . . $ uiTitledWindow.;
1173 };
1174
1175 // settings
1176 void SetTextcxx . . $ UITitledWindow#SetText(928d68114d1c3373).(UITextItemcxx . . $ UITextItem# &text) { // sets the text for a window title.
1177 m_Titlecxx . . $ UITitledWindow#m_Title. =cxx . . $ UITextItem#`operator=`(5ad635489e71ed3b). text;
1178 };
1179 void SetCaptionColorcxx . . $ UITitledWindow#SetCaptionColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# col) { // sets the color of the caption region
1180 m_CaptionColorcxx . . $ UITitledWindow#m_CaptionColor. = col;
1181 };
1182 void SetBorderThicknesscxx . . $ UITitledWindow#SetBorderThickness(d4f767463ce0a6b3).(int thickness) { // sets the pixel thickness of the border
1183 m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness. = thickness;
1184 };
1185
1186 int GetBorderThicknesscxx . . $ UITitledWindow#GetBorderThickness(455f465bc33b4cdf).() const { return m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness.; }; // returns border thickness.
1187
1188 // inheritable actions
1189 protected:
1190 virtual void OnDrawcxx . . $ UITitledWindow#OnDraw(49f6e7a06ebc5aa8).(); // overridable draws the window background before gadgets
1191 };
1192
1193 // UIConsole
1194 // should display a simple console window where anyone can dump text into
1195
1196 class UIConsolecxx . . $ UIConsole# : public UIWindowcxx . . $ UIWindow# {
1197 UIConsoleGadgetcxx . . $ UIConsoleGadget# m_Consolecxx . . $ UIConsole#m_Console.;
1198
1199 protected:
1200 virtual void OnDrawcxx . . $ UIConsole#OnDraw(49f6e7a06ebc5aa8).();
1201
1202 public:
1203 UIConsolecxx . . $ UIConsole#UIConsole(49f6e7a06ebc5aa8).();
1204 virtual ~cxx . . $ UIConsole#`~UIConsole`(ced63f7c635d850d).UIConsolecxx . . $ UIConsole#();
1205
1206 // font = console font, NOT GADGET FONT. This font is used to proportion window
1207 void Createcxx . . $ UIConsole#Create(1559a299834bcdd5).(int x, int y, int font, int cols, int rows);
1208 void Destroycxx . . $ UIConsole#Destroy(49f6e7a06ebc5aa8).();
1209
1210 // functions
1211 void putscxx . . $ UIConsole#puts(85c52e162fed56f9).(const char *str);
1212 void putscxx . . $ UIConsole#puts(d7adf5cfafc0e15a).(ddgr_colorcxx . . $ ddgr_color# col, const char *str);
1213 };
1214
1215 // other inline functions
1216 inline bool UIGadgetcxx . . $ UIGadget#::HasFocuscxx . . $ UIGadget#HasFocus(50ce9a9e25b4a850).() const { return ((m_Wndcxx . . $ UIGadget#m_Wnd.->GetFocuscxx . . $ UIWindow#GetFocus(42baa2535cd0f5f7).() == this) ? true : false); };
1217
1218 #include "uisys.h"cxx . . $ `<file>/ui/uisys.h`/
1219 #include "uidraw.h"cxx . . $ `<file>/ui/uidraw.h`/
1220
1221 #endif