Debian Codegraph @

ui/UIWindow.cpp

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/ui/UIWindow.cpp $
21 * $Revision: 39 $
22 * $Date: 5/02/99 2:09a $
23 * $Author: Samir $
24 *
25 * Interface code.
26 *
27 * $Log: /DescentIII/Main/ui/UIWindow.cpp $
28 *
29 * 39 5/02/99 2:09a Samir
30 * don't process input on disabled gadgets.
31 *
32 * 38 4/26/99 9:11p Matt
33 * Took out saturation used by old newui.
34 *
35 * 37 4/22/99 4:28p Samir
36 * made gadget clip check include the right and bottom boundaries of the
37 * screen.
38 *
39 * 36 4/21/99 12:42p Samir
40 * clip gadgets on screen.
41 *
42 * 35 4/14/99 1:54a Jeff
43 * fixed case mismatched #includes
44 *
45 * 34 3/01/99 6:56p Samir
46 * saturate text for old ui menus (UIF_PROCESS_ALL)
47 *
48 * 32 3/01/99 5:00a Samir
49 * whenever m_GadgetCur is being NULLed, do a lose focus on it first.
50 *
51 * 31 2/26/99 2:10a Samir
52 * added accelerator table.
53 *
54 * 30 2/22/99 8:13p Samir
55 * added slave gadget system that only uses mouse input from window, but
56 * defers keys to its master.
57 *
58 * 29 2/21/99 6:36p Samir
59 * focusing changes and key input changes to ui.,
60 *
61 * 28 2/17/99 8:32p Samir
62 * fixed bugs in remove gadget, added callbacks for attaching and
63 * detaching gadgets.
64 *
65 * 27 2/16/99 11:58a Samir
66 * small fixes and added gadget notification.
67 *
68 * 26 10/19/98 12:18p Samir
69 * made tabbing between edit controls possible.
70 *
71 * 25 10/13/98 8:23p Samir
72 * communication between gadget and window and edit system to work
73 * together.
74 *
75 * 24 10/06/98 7:31p Samir
76 * both tab keys and arrow keys scroll through gadgets.
77 *
78 * 23 9/10/98 10:20a Samir
79 * when removing a gadget from a window, check if it's being used by the
80 * user intefrace, if it is then remove it from that.
81 *
82 * 22 8/31/98 12:36p Samir
83 * implemented dialogversion of window.
84 *
85 * 21 8/27/98 2:52p Samir
86 * changing window system to work in two modes.
87 *
88 * 20 8/26/98 12:25p Samir
89 * fixed the whole editbox, keyboard access mess.
90 *
91 * 19 8/25/98 7:08p Samir
92 * select how keys are sent to a gadget.
93 *
94 * 18 8/25/98 6:33p Kevin
95 * PXO screens
96 *
97 * 17 8/25/98 5:27p Samir
98 * new focusing rules for keyboard.
99 *
100 * 16 6/05/98 5:35p Samir
101 * massive improvement in UI keyboard interface.
102 *
103 * 15 3/10/98 12:48p Samir
104 * Added window centering ability.
105 *
106 * 14 3/09/98 2:57p Samir
107 * Remove gadget from window called from gadget destroy.
108 *
109 * 13 3/05/98 6:38p Samir
110 * Fixed key presses within windows.
111 *
112 * 12 2/15/98 7:07p Samir
113 * Revamped way keys like up and down are handled in window system.
114 *
115 * 11 2/13/98 6:35p Samir
116 * Fixed some gadget creation/destruction inconsistancies
117 *
118 * 10 2/02/98 7:36p Samir
119 * Added UIObject::Destroy.
120 *
121 * 9 1/30/98 7:05p Samir
122 * Each gadget now has their own coordinate system.
123 *
124 * 8 1/26/98 10:54a Samir
125 * Fixed bug in UIWindow returning -2 always.
126 *
127 * 7 1/23/98 5:45p Samir
128 * Call OnUserProcess after default Window Process.
129 *
130 * 6 1/18/98 4:23p Samir
131 * Moved object destruction code to a virtual OnDestroy function for
132 * gadgets. Must destroy window too.
133 *
134 * 5 1/13/98 4:26p Samir
135 * Changed process of setting and getting focus.
136 *
137 * 4 1/08/98 12:17p Samir
138 * Added TitledWindow and modified the UI interface for polling.
139 *
140 * 3 1/05/98 11:10a Jason
141 * FROM SAMIR: Draw background rectangle for menus
142 *
143 * 2 1/02/98 12:48p Samir
144 * Redid setting and releasing keyboard/mouse focus for gadgets.
145 *
146 * 1 12/30/97 4:36p Samir
147 * Initial revision
148 *
149 * $NoKeywords: $
150 */
151
152 #include "UIlib.h"cxx . . $ `<file>/ui/UIlib.h`/
153 #include "Macros.h"cxx . . $ `<file>/lib/Macros.h`/
154
155 // the window font for all windows
156 int UIWindowcxx . . $ UIWindow#::m_WindowFontcxx . . $ UIWindow#m_WindowFont. = 0;
157
158 // ----------------------------------------------------------------------------
159 // UIWindow class
160
161 UIWindowcxx . . $ UIWindow#::UIWindowcxx . . $ UIWindow#UIWindow(49f6e7a06ebc5aa8).() : UIObjectcxx . . $ UIObject#UIObject(49f6e7a06ebc5aa8).() {
162 m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
163 m_GadgetTailcxx . . $ UIWindow#m_GadgetTail. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
164 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
165 m_BackItemcxx . . $ UIWindow#m_BackItem. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
166 m_HoldHotkeyscxx . . $ UIWindow#m_HoldHotkeys. = false;
167 m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup. = false;
168 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = false;
169 m_naccelscxx . . $ UIWindow#m_naccels. = 0;
170 }
171
172 UIWindowcxx . . $ UIWindow#::~cxx . . $ UIWindow#`~UIWindow`(ced63f7c635d850d).UIWindowcxx . . $ UIWindow#() {
173 if (m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.) {
174 Destroycxx . . $ UIWindow#Destroy(49f6e7a06ebc5aa8).();
175 }
176 }
177
178 // create a window at the specified coords.
179 void UIWindowcxx . . $ UIWindow#::Createcxx . . $ UIWindow#Create(1559a299834bcdd5).(int x, int y, int w, int h, int flags) {
180 m_FontHandlecxx . . $ UIWindow#m_FontHandle. = m_WindowFontcxx . . $ UIWindow#m_WindowFont.;
181 m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
182 m_BackItemcxx . . $ UIWindow#m_BackItem. = UIPrimativeItemcxx . . $ UIPrimativeItem#(TRANSPARENT_COLOR32cxx . . $ `lib/grdefs.h:70:9`!).CopyUIItemcxx . . $ UIPrimativeItem#CopyUIItem(ff7db2a2e5605676).();
183 m_BackColorcxx . . $ UIWindow#m_BackColor. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 0, 0);
184 m_Flagscxx . . $ UIWindow#m_Flags. = flags;
185 m_GadgetTailcxx . . $ UIWindow#m_GadgetTail. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
186 m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
187 m_LastKeycxx . . $ UIWindow#m_LastKey. = 0;
188 m_LastKeyTimecxx . . $ UIWindow#m_LastKeyTime. = 0.0f;
189 m_HoldHotkeyscxx . . $ UIWindow#m_HoldHotkeys. = false;
190 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = false;
191 m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup. = false;
192 m_naccelscxx . . $ UIWindow#m_naccels. = 0;
193
194 if (m_Flagscxx . . $ UIWindow#m_Flags. & UIF_CENTERcxx . . $ `ui/ui.h:342:9`!) {
195 x = UI_screen_widthcxx . . $ UI_screen_width. / 2 - w / 2;
196 y = UI_screen_heightcxx . . $ UI_screen_height. / 2 - h / 2;
197 }
198
199 UIObjectcxx . . $ UIObject#::Createcxx . . $ UIObject#Create(748afa4755bc9595).(x, y, w, h);
200 }
201
202 void UIWindowcxx . . $ UIWindow#::Destroycxx . . $ UIWindow#Destroy(49f6e7a06ebc5aa8).() {
203 OnDestroycxx . . $ UIWindow#OnDestroy(49f6e7a06ebc5aa8).();
204
205 while (m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.) {
206 UIGadgetcxx . . $ UIGadget# *gadget = m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.;
207 gadget->Destroycxx . . $ UIGadget#Destroy(49f6e7a06ebc5aa8).(); // gadget must be destroyed AFTER it's removed from list.
208 }
209 m_GadgetTailcxx . . $ UIWindow#m_GadgetTail. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
210 m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
211
212 SetBackItemcxx . . $ UIWindow#SetBackItem(52afca12b6cce14a).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
213
214 UIObjectcxx . . $ UIObject#::Destroycxx . . $ UIObject#Destroy(49f6e7a06ebc5aa8).();
215 }
216
217 // interface functions
218 // adds a UIObject to the interface's draw list.
219 void UIWindowcxx . . $ UIWindow#::AddGadgetcxx . . $ UIWindow#AddGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget) {
220 ASSERTcxx . . $ `misc/pserror.h:246:9`!(IsCreated());
221 ASSERTcxx . . $ `misc/pserror.h:246:9`!(gadget->IsCreated());
222
223 // perform a linked list add.
224 if (!m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.) {
225 m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead. = gadget;
226 m_GadgetTailcxx . . $ UIWindow#m_GadgetTail. = m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.;
227 } else {
228 m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.->m_Nextcxx . . $ UIGadget#m_Next. = gadget;
229 gadget->m_Prevcxx . . $ UIGadget#m_Prev. = m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.;
230 gadget->m_Nextcxx . . $ UIGadget#m_Next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
231 m_GadgetTailcxx . . $ UIWindow#m_GadgetTail. = gadget;
232 }
233
234 if (m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
235 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
236 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
237 }
238 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = true;
239 m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup. = false;
240
241 gadget->m_Wndcxx . . $ UIGadget#m_Wnd. = this;
242
243 gadget->OnAttachToWindowcxx . . $ UIGadget#OnAttachToWindow(49f6e7a06ebc5aa8).();
244 }
245
246 // removes a UIObject from the draw list.
247 void UIWindowcxx . . $ UIWindow#::RemoveGadgetcxx . . $ UIWindow#RemoveGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget) {
248 if (!gadget)
249 return;
250
251 ASSERTcxx . . $ `misc/pserror.h:246:9`!(IsCreated());
252 ASSERTcxx . . $ `misc/pserror.h:246:9`!(gadget->IsCreated());
253 ASSERTcxx . . $ `misc/pserror.h:246:9`!(gadget->m_Wnd == this);
254
255 gadget->OnDetachFromWindowcxx . . $ UIGadget#OnDetachFromWindow(49f6e7a06ebc5aa8).();
256
257 // remove object from list.
258 if (gadget->m_Prevcxx . . $ UIGadget#m_Prev.)
259 gadget->m_Prevcxx . . $ UIGadget#m_Prev.->m_Nextcxx . . $ UIGadget#m_Next. = gadget->m_Nextcxx . . $ UIGadget#m_Next.;
260 if (gadget->m_Nextcxx . . $ UIGadget#m_Next.)
261 gadget->m_Nextcxx . . $ UIGadget#m_Next.->m_Prevcxx . . $ UIGadget#m_Prev. = gadget->m_Prevcxx . . $ UIGadget#m_Prev.;
262
263 if (gadget == m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.)
264 m_GadgetTailcxx . . $ UIWindow#m_GadgetTail. = gadget->m_Prevcxx . . $ UIGadget#m_Prev.;
265
266 if (gadget == m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.)
267 m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead. = gadget->m_Nextcxx . . $ UIGadget#m_Next.;
268
269 if (gadget == m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
270 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
271 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
272 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = true;
273 m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup. = false;
274 }
275
276 if (gadget == m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget.)
277 m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
278
279 // break link.
280 gadget->m_Prevcxx . . $ UIGadget#m_Prev. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
281 gadget->m_Nextcxx . . $ UIGadget#m_Next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
282 gadget->m_Wndcxx . . $ UIGadget#m_Wnd. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
283 }
284
285 // forces a particular gadget into focus, always until unlocked.
286 void UIWindowcxx . . $ UIWindow#::LockFocusOnGadgetcxx . . $ UIWindow#LockFocusOnGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget) { m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget. = gadget; }
287
288 void UIWindowcxx . . $ UIWindow#::UnlockFocusOnGadgetcxx . . $ UIWindow#UnlockFocusOnGadget(49f6e7a06ebc5aa8).() { m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; }
289
290 // forces all keyinput onto one gadget.
291 void UIWindowcxx . . $ UIWindow#::LockKeyFocusOnGadgetcxx . . $ UIWindow#LockKeyFocusOnGadget(627f6e6cf27f18b7).(UIGadgetcxx . . $ UIGadget# *gadget) {}
292
293 // Process
294 // run this to handle user input inside an interface
295 // sets focus on a control
296 // m_GadgetCur is gadget in focus.
297
298 int UIWindowcxx . . $ UIWindow#::Processcxx . . $ UIWindow#Process(b126dc7c1de90089).() {
299 ASSERTcxx . . $ `misc/pserror.h:246:9`!(IsCreated());
300 bool no_process = false; // don't do input for disabled gadgets.
301
302 if (m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget.) {
303 // find first valid gadget to set focus to.
304 UIGadgetcxx . . $ UIGadget# *start_gadget, *gadget;
305 start_gadget = gadget = m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.;
306 if (gadget) {
307 bool in_group = false;
308 do {
309 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`!)) {
310 in_group = true;
311 }
312 if (!gadget->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).() && !CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_SLAVEcxx . . $ `ui/ui.h:345:9`!)) {
313 if (m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
314 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
315 }
316 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = gadget;
317 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->GainFocuscxx . . $ UIGadget#GainFocus(49f6e7a06ebc5aa8).();
318 m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup. = in_group;
319 break;
320 }
321 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`!)) {
322 in_group = false;
323 }
324 gadget = (gadget->m_Nextcxx . . $ UIGadget#m_Next.) ? gadget->m_Nextcxx . . $ UIGadget#m_Next. : m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.;
325 } while (gadget != start_gadget);
326 }
327
328 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = false;
329 }
330
331 // setup default output values
332 UI_outputcxx . . $ UI_output..gadgetcxx . . $ tUIOutput#gadget. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
333 UI_outputcxx . . $ UI_output..idcxx . . $ tUIOutput#id. = -1;
334
335 // we can do focus processing if no one gadget has locked the keyboard, mouse focus.
336 if (!m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget.) {
337 UIGadgetcxx . . $ UIGadget# *test_gadget = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
338 if (UI_inputcxx . . $ UI_input..b1_statuscxx . . $ tUIInput#b1_status. == UIMSEBTN_PRESSEDcxx . . $ `ui/uisys.h:27:9`! || UI_inputcxx . . $ UI_input..b1_statuscxx . . $ tUIInput#b1_status. == UIMSEBTN_CLICKEDcxx . . $ `ui/uisys.h:29:9`!) {
339 // start from top most gadget down for mouse focus check.
340 bool in_group = false;
341 for (test_gadget = m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.; test_gadget != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; test_gadget = test_gadget->m_Prevcxx . . $ UIGadget#m_Prev.) {
342 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(test_gadget->GetFlags(), UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`!)) { // going from end of list to start, so reverse
343 in_group = true;
344 }
345 if (PT_IN_GADGETcxx . . $ PT_IN_GADGET(55d2799d541f12b5).(this, test_gadget, UI_inputcxx . . $ UI_input..mxcxx . . $ tUIInput#mx., UI_inputcxx . . $ UI_input..mycxx . . $ tUIInput#my.)) {
346 if (!CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(test_gadget->GetFlags(), UIF_SLAVEcxx . . $ `ui/ui.h:345:9`!)) {
347 if (!test_gadget->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).()) {
348 break;
349 } else {
350 test_gadget = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
351 no_process = true;
352 break;
353 }
354 }
355 }
356
357 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(test_gadget->GetFlags(), UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`!)) {
358 in_group = false;
359 }
360 }
361
362 // switch focus from old gadget to new.
363 if (test_gadget) {
364 if (m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. && m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. != test_gadget) {
365 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
366 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
367 }
368 if (!m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
369 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = test_gadget;
370 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->GainFocuscxx . . $ UIGadget#GainFocus(49f6e7a06ebc5aa8).();
371 m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup. = in_group;
372 }
373 test_gadget->CheckFocusOnSlavescxx . . $ UIGadget#CheckFocusOnSlaves(3e454b8ccf442868).(UI_inputcxx . . $ UI_input..mxcxx . . $ tUIInput#mx., UI_inputcxx . . $ UI_input..mycxx . . $ tUIInput#my.);
374 }
375
376 } else {
377 // check for keyboard switching.
378 if (UI_inputcxx . . $ UI_input..key_statuscxx . . $ tUIInput#key_status. == UIKEY_PRESSEDcxx . . $ `ui/uisys.h:31:9`!) {
379 if (TrapKeycxx . . $ UIWindow#TrapKey(83c267b20bac841a).(UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key.)) {
380 OnKeyDowncxx . . $ UIWindow#OnKeyDown(d4f767463ce0a6b3).(UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key.);
381 }
382 } else if (UI_inputcxx . . $ UI_input..key_statuscxx . . $ tUIInput#key_status. == UIKEY_RELEASEDcxx . . $ `ui/uisys.h:32:9`!) {
383 UntrapKeycxx . . $ UIWindow#UntrapKey(d4f767463ce0a6b3).(UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key.);
384 OnKeyUpcxx . . $ UIWindow#OnKeyUp(d4f767463ce0a6b3).(UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key.);
385 } else if (UI_inputcxx . . $ UI_input..key_statuscxx . . $ tUIInput#key_status. == UIKEY_CLICKEDcxx . . $ `ui/uisys.h:33:9`!) {
386 if (TrapKeycxx . . $ UIWindow#TrapKey(83c267b20bac841a).(UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key.)) {
387 OnKeyDowncxx . . $ UIWindow#OnKeyDown(d4f767463ce0a6b3).(UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key.);
388 }
389 UntrapKeycxx . . $ UIWindow#UntrapKey(d4f767463ce0a6b3).(UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key.);
390 OnKeyUpcxx . . $ UIWindow#OnKeyUp(d4f767463ce0a6b3).(UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key.);
391 }
392 }
393 } else {
394 // always assert that current gadget is locked gadget.
395 // if not, then m_CurGadgetInGroup can be wrong.
396 // ASSERT(m_GadgetCur == m_LockedGadget);
397 // m_GadgetCur = m_LockedGadget;
398 }
399
400 // process input for current gadget in focus.
401 if (m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget.) {
402 m_LockedGadgetcxx . . $ UIWindow#m_LockedGadget.->Processcxx . . $ UIGadget#Process(9e113dd3a0d25c95).(true);
403 } else if (m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. && !m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).()) {
404 // check what slave gadget a mouse event occurs inside m_GadgetCur
405 if (!no_process) {
406 if (m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->m_CurrentSlavecxx . . $ UIGadget#m_CurrentSlave.) {
407 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->m_CurrentSlavecxx . . $ UIGadget#m_CurrentSlave.->Processcxx . . $ UIGadget#Process(9e113dd3a0d25c95).(false, true);
408 }
409 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->Processcxx . . $ UIGadget#Process(9e113dd3a0d25c95).(true, m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->m_CurrentSlavecxx . . $ UIGadget#m_CurrentSlave. ? false : true);
410 }
411 }
412
413 // perform user processing of window input.
414 OnUserProcesscxx . . $ UIWindow#OnUserProcess(49f6e7a06ebc5aa8).();
415
416 return UI_outputcxx . . $ UI_output..idcxx . . $ tUIOutput#id.;
417 }
418
419 // overridable: runs after window is processed, to supplement it.
420 void UIWindowcxx . . $ UIWindow#::OnUserProcesscxx . . $ UIWindow#OnUserProcess(49f6e7a06ebc5aa8).() {}
421
422 // behavior when key is pressed.
423 void UIWindowcxx . . $ UIWindow#::OnKeyDowncxx . . $ UIWindow#OnKeyDown(d4f767463ce0a6b3).(int key) {
424 UIGadgetcxx . . $ UIGadget# *gadget, *start_gadget;
425 bool in_group;
426
427 // advance down gadget list.
428 if (key == KEY_TABcxx . . $ `ddio/ddio_common.h:270:9`!) {
429 if (!m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
430 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = true;
431 return;
432 }
433 start_gadget = gadget = m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.;
434 in_group = m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup.;
435 do {
436 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`!)) {
437 in_group = true;
438 }
439 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`!)) {
440 in_group = false;
441 }
442 gadget = (gadget->m_Nextcxx . . $ UIGadget#m_Next.) ? gadget->m_Nextcxx . . $ UIGadget#m_Next. : m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.;
443 if (!gadget->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).() && !CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_SLAVEcxx . . $ `ui/ui.h:345:9`!) && !in_group) {
444 start_gadget->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
445 gadget->GainFocuscxx . . $ UIGadget#GainFocus(49f6e7a06ebc5aa8).();
446 m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup. = (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`!) > 0);
447 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = gadget;
448 break;
449 }
450 } while (gadget != start_gadget);
451 }
452 if (key == (KEY_SHIFTEDcxx . . $ `ddio/ddio_common.h:208:9`! + KEY_TABcxx . . $ `ddio/ddio_common.h:270:9`!)) {
453 if (!m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
454 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = true;
455 return;
456 }
457 start_gadget = gadget = m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.;
458 in_group = m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup.;
459 do {
460 gadget = (gadget->m_Prevcxx . . $ UIGadget#m_Prev.) ? gadget->m_Prevcxx . . $ UIGadget#m_Prev. : m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.;
461 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`!)) {
462 in_group = true;
463 }
464 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`!)) {
465 in_group = false;
466 }
467 if (!gadget->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).() && !CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_SLAVEcxx . . $ `ui/ui.h:345:9`!) && !in_group) {
468 start_gadget->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
469 gadget->GainFocuscxx . . $ UIGadget#GainFocus(49f6e7a06ebc5aa8).();
470 m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup. =
471 (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`!)) || (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`!));
472 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = gadget;
473 break;
474 }
475 } while (gadget != start_gadget);
476 }
477
478 // handle direction keys only in a group
479 if (m_CurGadgetInGroupcxx . . $ UIWindow#m_CurGadgetInGroup.) {
480
481 if (key == KEY_UPcxx . . $ `ddio/ddio_common.h:318:9`! || key == KEY_LEFTcxx . . $ `ddio/ddio_common.h:320:9`!) {
482 if (!m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
483 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = true;
484 return;
485 }
486 start_gadget = gadget = m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.;
487 do {
488 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`!)) {
489 break;
490 }
491 gadget = (gadget->m_Prevcxx . . $ UIGadget#m_Prev.) ? gadget->m_Prevcxx . . $ UIGadget#m_Prev. : m_GadgetTailcxx . . $ UIWindow#m_GadgetTail.;
492 if (!gadget->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).() && !CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_SLAVEcxx . . $ `ui/ui.h:345:9`!)) {
493 start_gadget->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
494 gadget->GainFocuscxx . . $ UIGadget#GainFocus(49f6e7a06ebc5aa8).();
495 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = gadget;
496 break;
497 }
498 } while (start_gadget != gadget);
499 }
500 if (key == KEY_DOWNcxx . . $ `ddio/ddio_common.h:319:9`! || key == KEY_RIGHTcxx . . $ `ddio/ddio_common.h:321:9`!) {
501 if (!m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
502 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = true;
503 return;
504 }
505 start_gadget = gadget = m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.;
506 do {
507 if (CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`!)) {
508 break;
509 }
510 gadget = (gadget->m_Nextcxx . . $ UIGadget#m_Next.) ? gadget->m_Nextcxx . . $ UIGadget#m_Next. : m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.;
511 if (!gadget->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).() && !CHECK_FLAGcxx . . $ `lib/Macros.h:63:9`!(gadget->GetFlags(), UIF_SLAVEcxx . . $ `ui/ui.h:345:9`!)) {
512 start_gadget->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
513 gadget->GainFocuscxx . . $ UIGadget#GainFocus(49f6e7a06ebc5aa8).();
514 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = gadget;
515 break;
516 }
517 } while (start_gadget != gadget);
518 }
519 }
520
521 // determine if any hotkey was pressed
522 if (!m_HoldHotkeyscxx . . $ UIWindow#m_HoldHotkeys.) {
523 int i;
524
525 for (gadget = m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.; gadget != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; gadget = gadget->m_Nextcxx . . $ UIGadget#m_Next.) {
526 if (!gadget->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).()) {
527 if (gadget->GetIDcxx . . $ UIGadget#GetID(455f465bc33b4cdf).() == UID_CANCELcxx . . $ `ui/ui.h:369:9`! && key == KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!)
528 gadget->OnSelectcxx . . $ UIGadget#OnSelect(49f6e7a06ebc5aa8).();
529 }
530 }
531
532 // do hotkeys
533 for (gadget = m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.; gadget != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; gadget = gadget->m_Nextcxx . . $ UIGadget#m_Next.) {
534 if (!gadget->IsDisabledcxx . . $ UIGadget#IsDisabled(c9857a73d68e59ba).() && UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key. && ISKEYPRESSEDcxx . . $ `ui/uisys.h:72:9`!(gadget->m_Hotkey))
535 gadget->OnSelectcxx . . $ UIGadget#OnSelect(49f6e7a06ebc5aa8).();
536 }
537
538 // do window accelerators.
539 for (i = 0; i < m_naccelscxx . . $ UIWindow#m_naccels.; i++) {
540 if (UI_inputcxx . . $ UI_input..keycxx . . $ tUIInput#key. && ISKEYPRESSEDcxx . . $ `ui/uisys.h:72:9`!(m_Accelerators[i].key) && UI_outputcxx . . $ UI_output..idcxx . . $ tUIOutput#id. < 0) {
541 UI_outputcxx . . $ UI_output..gadgetcxx . . $ tUIOutput#gadget. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
542 UI_outputcxx . . $ UI_output..idcxx . . $ tUIOutput#id. = m_Acceleratorscxx . . $ UIWindow#m_Accelerators.[i].idcxx . . $ UIWindow#$anonymous_type_0#id.;
543 break;
544 }
545 }
546 }
547 }
548
549 // behavior when key is released.
550 void UIWindowcxx . . $ UIWindow#::OnKeyUpcxx . . $ UIWindow#OnKeyUp(d4f767463ce0a6b3).(int key) {}
551
552 // redraw all gadgets
553 void UIWindowcxx . . $ UIWindow#::Rendercxx . . $ UIWindow#Render(49f6e7a06ebc5aa8).() {
554 UIGadgetcxx . . $ UIGadget# *gadget = m_GadgetHeadcxx . . $ UIWindow#m_GadgetHead.;
555
556 // draw background of window.
557 ui_StartDrawcxx . . $ ui_StartDraw(748afa4755bc9595).(m_Xcxx . . $ UIObject#m_X., m_Ycxx . . $ UIObject#m_Y., m_Xcxx . . $ UIObject#m_X. + m_Wcxx . . $ UIObject#m_W., m_Ycxx . . $ UIObject#m_Y. + m_Hcxx . . $ UIObject#m_H.);
558 ui_DrawSetFontcxx . . $ ui_DrawSetFont(d4f767463ce0a6b3).(m_FontHandlecxx . . $ UIWindow#m_FontHandle.);
559
560 OnDrawcxx . . $ UIWindow#OnDraw(49f6e7a06ebc5aa8).();
561 ui_EndDrawcxx . . $ ui_EndDraw(49f6e7a06ebc5aa8).();
562
563 while (gadget) {
564 int l = m_Xcxx . . $ UIObject#m_X. + gadget->Xcxx . . $ UIObject#X(455f465bc33b4cdf).();
565 int t = m_Ycxx . . $ UIObject#m_Y. + gadget->Ycxx . . $ UIObject#Y(455f465bc33b4cdf).();
566 int r = l + gadget->Wcxx . . $ UIObject#W(455f465bc33b4cdf).();
567 int b = t + gadget->Hcxx . . $ UIObject#H(455f465bc33b4cdf).();
568
569 // reformat gadget
570 gadget->OnFormatcxx . . $ UIGadget#OnFormat(49f6e7a06ebc5aa8).();
571
572 // draw gadget
573 if (l >= 0 && r <= UI_screen_widthcxx . . $ UI_screen_width. && t >= 0 && b <= UI_screen_heightcxx . . $ UI_screen_height.) {
574 ui_StartDrawcxx . . $ ui_StartDraw(748afa4755bc9595).(l, t, r, b);
575 ui_DrawSetFontcxx . . $ ui_DrawSetFont(d4f767463ce0a6b3).(m_FontHandlecxx . . $ UIWindow#m_FontHandle.);
576 gadget->OnDrawcxx . . $ UIGadget#OnDraw(49f6e7a06ebc5aa8).();
577 ui_EndDrawcxx . . $ ui_EndDraw(49f6e7a06ebc5aa8).();
578 } else {
579 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "WINDOW: Gadget clipped on screen border (%d,%d,%d,%d)\n", l, t, r, b);
580 // Int3();
581 }
582
583 // proeceed...
584 gadget = gadget->m_Nextcxx . . $ UIGadget#m_Next.;
585 }
586
587 UITextItemcxx . . $ UITextItem#::SetSaturationFactorcxx . . $ UITextItem#SetSaturationFactor(d4f767463ce0a6b3).(0);
588
589 // draw ugly looking focus box around current gadget.
590 #if 0
591 if (m_GadgetCur && !CHECK_FLAG(m_GadgetCur->m_Flags, UIF_SLAVE) ) {
592 int l = m_X+m_GadgetCur->X();
593 int t = m_Y+m_GadgetCur->Y();
594 int r = l+m_GadgetCur->W();
595 int b = t+m_GadgetCur->H();
596
597 l--; t--; r++; b++;
598 if (l < 0) l = 0;
599 if (t < 0) t = 0;
600 if (r >(m_X+m_W)) r = m_X+m_W;
601 if (b >(m_Y+m_H)) b = m_Y+m_H;
602 ui_StartDraw(l,t,r,b);
603 ui_DrawBox(GR_RGB(128,128,128),0,0,(r-l),(b-t));
604 ui_EndDraw();
605 }
606 #endif
607 }
608
609 // adds window to ui list.
610 void UIWindowcxx . . $ UIWindow#::Opencxx . . $ UIWindow#Open(49f6e7a06ebc5aa8).() { ui_AddWindowcxx . . $ ui_AddWindow(e2cbbde2a2931ad2).(this); }
611
612 // removes window from ui list.
613 void UIWindowcxx . . $ UIWindow#::Closecxx . . $ UIWindow#Close(49f6e7a06ebc5aa8).() { ui_RemoveWindowcxx . . $ ui_RemoveWindow(e2cbbde2a2931ad2).(this); }
614
615 // settings
616 void UIWindowcxx . . $ UIWindow#::SetFontcxx . . $ UIWindow#SetFont(d4f767463ce0a6b3).(int handle) { m_FontHandlecxx . . $ UIWindow#m_FontHandle. = handle; }
617
618 // overridable draws the window background before gadgets
619 void UIWindowcxx . . $ UIWindow#::OnDrawcxx . . $ UIWindow#OnDraw(49f6e7a06ebc5aa8).() {
620 if (m_BackItemcxx . . $ UIWindow#m_BackItem.)
621 m_BackItemcxx . . $ UIWindow#m_BackItem.->drawcxx . . $ UIItem#draw(a1642a0ee405ca20).(0, 0, m_Wcxx . . $ UIObject#m_W., m_Hcxx . . $ UIObject#m_H.);
622 }
623
624 // used to manage keypresses so repeating isn't quick.
625 bool UIWindowcxx . . $ UIWindow#::TrapKeycxx . . $ UIWindow#TrapKey(83c267b20bac841a).(int key) {
626 float time;
627 time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
628
629 // take care of multiple keypresses and key down repeats. handle timing
630 // so it feels 'natural'
631 if (m_LastKeycxx . . $ UIWindow#m_LastKey. && m_LastKeycxx . . $ UIWindow#m_LastKey. == key) {
632 if (m_LastKeyCountcxx . . $ UIWindow#m_LastKeyCount. == 1) {
633 if ((time - m_LastKeyTimecxx . . $ UIWindow#m_LastKeyTime.) < KEYDOWN_FIRST_DELAYcxx . . $ `ui/ui.h:753:9`!)
634 return false;
635 m_LastKeyCountcxx . . $ UIWindow#m_LastKeyCount.++;
636 } else if ((time - m_LastKeyTimecxx . . $ UIWindow#m_LastKeyTime.) < KEYDOWN_REPEAT_DELAYcxx . . $ `ui/ui.h:754:9`!) {
637 return false;
638 }
639 m_LastKeyCountcxx . . $ UIWindow#m_LastKeyCount.++;
640 } else {
641 m_LastKeyCountcxx . . $ UIWindow#m_LastKeyCount. = 1;
642 }
643
644 m_LastKeycxx . . $ UIWindow#m_LastKey. = key;
645 m_LastKeyTimecxx . . $ UIWindow#m_LastKeyTime. = time;
646
647 return true;
648 }
649
650 void UIWindowcxx . . $ UIWindow#::UntrapKeycxx . . $ UIWindow#UntrapKey(d4f767463ce0a6b3).(int key) {
651 // if the key previously pressed went up, then
652 // turn off key repeat management.
653 if (key == m_LastKeycxx . . $ UIWindow#m_LastKey.) {
654 m_LastKeyCountcxx . . $ UIWindow#m_LastKeyCount. = 0;
655 m_LastKeycxx . . $ UIWindow#m_LastKey. = 0;
656 }
657 }
658
659 void UIWindowcxx . . $ UIWindow#::SetFocusOnGadgetcxx . . $ UIWindow#SetFocusOnGadget(75ffd377f9406104).(UIGadgetcxx . . $ UIGadget# *gadget, bool key) {
660 if (m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
661 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->LostFocuscxx . . $ UIGadget#LostFocus(49f6e7a06ebc5aa8).();
662 }
663 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur. = gadget;
664 if (m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.) {
665 m_GadgetCurcxx . . $ UIWindow#m_GadgetCur.->GainFocuscxx . . $ UIGadget#GainFocus(49f6e7a06ebc5aa8).();
666 m_ResetCurGadgetcxx . . $ UIWindow#m_ResetCurGadget. = false;
667 }
668 }
669
670 // used to mark key pressed to id numbers
671 void UIWindowcxx . . $ UIWindow#::AddAcceleratorKeycxx . . $ UIWindow#AddAcceleratorKey(3e454b8ccf442868).(int key, int id) {
672 if (m_naccelscxx . . $ UIWindow#m_naccels. == N_WINDOW_ACCELScxx . . $ `ui/ui.h:1051:9`!) {
673 // window has asked for too many accelerators. will not add this one. it's okay to continue, but tell someone
674 Int3cxx . . $ `misc/pserror.h:247:9`!();
675 return;
676 }
677 m_Acceleratorscxx . . $ UIWindow#m_Accelerators.[m_naccelscxx . . $ UIWindow#m_naccels.].idcxx . . $ UIWindow#$anonymous_type_0#id. = id;
678 m_Acceleratorscxx . . $ UIWindow#m_Accelerators.[m_naccelscxx . . $ UIWindow#m_naccels.].keycxx . . $ UIWindow#$anonymous_type_0#key. = key;
679 m_naccelscxx . . $ UIWindow#m_naccels.++;
680 }
681
682 void UIWindowcxx . . $ UIWindow#::ResetAcceleratorKeycxx . . $ UIWindow#ResetAcceleratorKey(49f6e7a06ebc5aa8).() { m_naccelscxx . . $ UIWindow#m_naccels. = 0; }
683
684 // ----------------------------------------------------------------------------
685 // UITitledWindow class
686
687 UITitledWindowcxx . . $ UITitledWindow#::UITitledWindowcxx . . $ UITitledWindow#UITitledWindow(49f6e7a06ebc5aa8).() {}
688
689 UITitledWindowcxx . . $ UITitledWindow#::~cxx . . $ UITitledWindow#`~UITitledWindow`(ced63f7c635d850d).UITitledWindowcxx . . $ UITitledWindow#() {}
690
691 void UITitledWindowcxx . . $ UITitledWindow#::Createcxx . . $ UITitledWindow#Create(1bd756661ca4f8fa).(UITextItemcxx . . $ UITextItem# &title, int x, int y, int w, int h) {
692 m_Titlecxx . . $ UITitledWindow#m_Title. =cxx . . $ UITextItem#`operator=`(5ad635489e71ed3b). title;
693 m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness. = 2;
694 m_CaptionColorcxx . . $ UITitledWindow#m_CaptionColor. = GR_DARKGRAYcxx . . $ GR_DARKGRAY.;
695
696 UIWindowcxx . . $ UIWindow#::Createcxx . . $ UIWindow#Create(1559a299834bcdd5).(x, y, w, h);
697 UIPrimativeItemcxx . . $ UIPrimativeItem# itemcxx . . $ UIPrimativeItem#UIPrimativeItem(cc289a6b3dfc48da).{GR_LIGHTGRAYcxx . . $ GR_LIGHTGRAY.};
698 UIWindowcxx . . $ UIWindow#::SetBackItemcxx . . $ UIWindow#SetBackItem(52afca12b6cce14a).(&item);
699 }
700
701 // inheritable actions
702
703 // draws the window background before gadgets
704 void UITitledWindowcxx . . $ UITitledWindow#::OnDrawcxx . . $ UITitledWindow#OnDraw(49f6e7a06ebc5aa8).() {
705 UIWindowcxx . . $ UIWindow#::OnDrawcxx . . $ UIWindow#OnDraw(49f6e7a06ebc5aa8).();
706 int m_CaptionHeight; // caption height
707
708 // set font for title.
709 if (m_Titlecxx . . $ UITitledWindow#m_Title..get_fontcxx . . $ UITextItem#get_font(455f465bc33b4cdf).() > -1)
710 ui_DrawSetFontcxx . . $ ui_DrawSetFont(d4f767463ce0a6b3).(m_Titlecxx . . $ UITitledWindow#m_Title..get_fontcxx . . $ UITextItem#get_font(455f465bc33b4cdf).());
711
712 m_CaptionHeight = ui_GetFontHeightcxx . . $ ui_GetFontHeight(b126dc7c1de90089).() + ui_GetFontHeightcxx . . $ ui_GetFontHeight(b126dc7c1de90089).() / 2;
713
714 // draw border.
715 for (int i = 0; i < m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness.; i++)
716 ui_DrawBoxcxx . . $ ui_DrawBox(fe09a4b73d8d396f).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 0, 0), m_Xcxx . . $ UIObject#m_X. + i, m_Ycxx . . $ UIObject#m_Y. + i, m_Xcxx . . $ UIObject#m_X. + m_Wcxx . . $ UIObject#m_W. - i, m_Ycxx . . $ UIObject#m_Y. + m_Hcxx . . $ UIObject#m_H. - i);
717
718 // draw caption.
719 int x, y;
720 ui_DrawRectcxx . . $ ui_DrawRect(fe09a4b73d8d396f).(m_CaptionColorcxx . . $ UITitledWindow#m_CaptionColor., m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness., m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness., m_Wcxx . . $ UIObject#m_W. - m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness., m_CaptionHeight);
721 x = m_Wcxx . . $ UIObject#m_W. / 2 - ui_GetTextWidthcxx . . $ ui_GetTextWidth(5c4306d8553b3696).(m_Titlecxx . . $ UITitledWindow#m_Title.) / 2;
722 y = m_BorderThicknesscxx . . $ UITitledWindow#m_BorderThickness. + m_CaptionHeight / 2 - ui_GetFontHeightcxx . . $ ui_GetFontHeight(b126dc7c1de90089).() / 2;
723
724 ui_SetCharAlphacxx . . $ ui_SetCharAlpha(ac50b47256ae7414).(m_Titlecxx . . $ UITitledWindow#m_Title..get_alphacxx . . $ UITextItem#get_alpha(bd807b21b9713a30).());
725 ui_DrawStringcxx . . $ ui_DrawString(c261e420eb73c8b5).(m_Titlecxx . . $ UITitledWindow#m_Title..get_colorcxx . . $ UITextItem#get_color(ddd8539a2fcdd4ce).(), x, y, m_Titlecxx . . $ UITitledWindow#m_Title.);
726 }