Debian Codegraph @

RSPiX/Src/GREEN/Hot/hot.h

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////cxx . . $ `<file>/RSPiX/Src/GREEN/Hot/hot.h`/
2 //
3 // Copyright 2016 RWS Inc, All Rights Reserved
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of version 2 of the GNU General Public License as published by
7 // the Free Software Foundation
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License along
15 // with this program; if not, write to the Free Software Foundation, Inc.,
16 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 //
18 //////////////////////////////////////////////////////////////////////////////
19 //
20 // Hot.h
21 //
22 // History:
23 // 01/18/97 JMI Started tracking history of this file.
24 // Added version of Do() that takes an RInputEvent*.
25 //
26 // 01/21/97 JMI The main Do() now returns the priority of the RHot that
27 // got the event. Now, Do(RInputEvent* pie) can set
28 // pie->sUsed = TRUE discriminantly.
29 //
30 // 01/22/97 JMI Added DoChildren() to process an event for this hotbox's
31 // children with two overloads (sPosX,sPosY,sEvent & pie).
32 //
33 // 01/23/97 JMI Got rid of the whole implied root with the static lists.
34 // Now each hotbox can service its children via a Do() call.
35 // More of a typical child-parent relationship. Note that
36 // this got rid of the Do(short sUseQueue) static that
37 // dequeued or polled events, but it was getting stale any-
38 // ways.
39 //
40 // 01/26/97 JMI Changed callbacks' first parms to RHot* instead of uint32_t.
41 //
42 // 03/19/97 JMI Added InputEventCall and made Do(pie) the main RHot
43 // interface.
44 // Also, added new constructor overload to handle new call-
45 // back type.
46 //
47 //////////////////////////////////////////////////////////////////////////////
48 //
49 // See CPP for description.
50 //
51 //////////////////////////////////////////////////////////////////////////////
52
53 #ifndef HOT_H
54 #define HOT_Hcxx . . $ `RSPiX/Src/GREEN/Hot/hot.h:54:9`!
55 // Orange /////////////////////////////////////////////////////////////////////
56 // If PATHS_IN_INCLUDES macro is defined, we can utilize relative
57 // paths to a header file. In this case we generally go off of our
58 // RSPiX root directory. System.h MUST be included before this macro
59 // is evaluated. System.h is the header that, based on the current
60 // platform (or more so in this case on the compiler), defines
61 // PATHS_IN_INCLUDES. Blue.h includes system.h so you can include that
62 // instead.
63 #ifdef PATHS_IN_INCLUDEScxx . . $ `RSPiX/Src/BLUE/unix/UnixSystem.h:65:9`!
64 #include "GREEN/InputEvent/InputEvent.h"cxx . . $ `<file>/RSPiX/Src/GREEN/InputEvent/InputEvent.h`/
65 #include "ORANGE/CDT/slist.h"cxx . . $ `<file>/RSPiX/Src/ORANGE/CDT/slist.h`/
66 #include "ORANGE/CDT/List.h"cxx . . $ `<file>/RSPiX/Src/ORANGE/CDT/List.h`/
67 #else
68 #include "slist.h"
69 #include "List.h"
70 #include "InputEvent.h"
71 #endif // PATHS_IN_INCLUDES
72
73 ///////////////////////////////////////////////////////////////////////////////
74 // Macros.
75 ///////////////////////////////////////////////////////////////////////////////
76
77 // This, when used in place of a priority, indicates that the item has no
78 // priority (i.e., it is to be considered non-prioritized).
79 #define RHOT_NO_PRIORITYcxx . . $ `RSPiX/Src/GREEN/Hot/hot.h:79:9`! ( (short)0x8000)
80
81 ///////////////////////////////////////////////////////////////////////////////
82 // Types.
83 ///////////////////////////////////////////////////////////////////////////////
84 class RHotcxx . . $ RHot#
85 {
86 public: // Typedefs.
87 typedef void (*REventCallcxx . . $ RHot#REventCall#)( // Returns nothing.
88 RHotcxx . . $ RHot#* phot, // Ptr to the RHot that generated the
89 // callback.
90 int16_t sEvent); // Event that occurred.
91 // Uses blue.h macros (RSP_MB?_*).
92
93 typedef void (*REventPosCallcxx . . $ RHot#REventPosCall#)( // Returns nothing.
94 RHotcxx . . $ RHot#* phot, // Ptr to the RHot that generated the
95 // callback.
96 int16_t sEvent, // Event that occurred.
97 // Uses blue.h macros (RSP_MB?_*).
98 int16_t sPosX, // Mouse x position at button event
99 // relative to hotbox's upper, left
100 // corner.
101 int16_t sPosY); // Mouse y position at button event
102 // relative to hotbox's upper, left
103 // corner.
104
105 typedef void (*InputEventCallcxx . . $ RHot#InputEventCall#)( // Returns nothing.
106 RHotcxx . . $ RHot#* phot, // In: Ptr to RHot that generated the
107 // callback.
108 RInputEventcxx . . $ RInputEvent#* pie); // In: Ptr to input event that generated
109 // the callback. Note that the coordinates
110 // of this event are relative to hotbox's
111 // upper, left corner.
112 // Out: Set members as you see fit. Note
113 // that changes to pie->sPosX,sPosY should
114 // be made relative to this RHot's upper,
115 // left corner. This can affect further
116 // RHot callbacks and will certainly affect
117 // the RInputEvent passed to RHot::Do().
118
119 typedef RSListcxx . . $ RSList# <RHotcxx . . $ RHot#, int16_t> SListHotscxx . . $ RHot#SListHots#; // Sorted list of RHots.
120 typedef RListcxx . . $ RList# <RHotcxx . . $ RHot#> ListHotscxx . . $ RHot#ListHots#; // List of RHots.
121
122 public:
123 // Default constructor.
124 RHotcxx . . $ RHot#RHot(49f6e7a06ebc5aa8).();
125
126 // Constructura Especial that sets some intial values.
127 RHotcxx . . $ RHot#RHot(d126f2221653b47d).(
128 int16_t sX, // X position of new hotbox.
129 int16_t sY, // Y position of new hotbox.
130 int16_t sW, // Width of new hotbox.
131 int16_t sH, // Height of new hotbox.
132 REventCallcxx . . $ RHot#REventCall# fnEventCall = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, // Callback on mouse event.
133 int16_t sActive = FALSEcxx . . $ `RSPiX/Src/BLUE/unix/UnixSystem.h:150:9`!, // Initially active, if TRUE.
134 uint32_tcxx . . $ uint32_t# ulUser = 0, // User value.
135 int16_t sPriority = RHOT_NO_PRIORITYcxx . . $ `RSPiX/Src/GREEN/Hot/hot.h:79:9`!);// Priority. Default == non-prioritized.
136
137 // Constructura Especial el Segundario or something that sets some
138 // intial values.
139 RHotcxx . . $ RHot#RHot(969ea3c1fc603cd8).(
140 int16_t sX, // X position of new hotbox.
141 int16_t sY, // Y position of new hotbox.
142 int16_t sW, // Width of new hotbox.
143 int16_t sH, // Height of new hotbox.
144 REventPosCallcxx . . $ RHot#REventPosCall# fnEventPosCall, // Callback on mouse event.
145 int16_t sActive = FALSEcxx . . $ `RSPiX/Src/BLUE/unix/UnixSystem.h:150:9`!, // Initially active, if TRUE.
146 uint32_tcxx . . $ uint32_t# ulUser = 0, // User value.
147 int16_t sPriority = RHOT_NO_PRIORITYcxx . . $ `RSPiX/Src/GREEN/Hot/hot.h:79:9`!);// Priority. Default == non-prioritized.
148
149 // Constructura Especial el Tres or something that sets some
150 // intial values.
151 RHotcxx . . $ RHot#RHot(3638a3ff0fa4d98d).(
152 int16_t sX, // X position of new hotbox.
153 int16_t sY, // Y position of new hotbox.
154 int16_t sW, // Width of new hotbox.
155 int16_t sH, // Height of new hotbox.
156 InputEventCallcxx . . $ RHot#InputEventCall# fnInputEventCall, // Callback on mouse event.
157 int16_t sActive = FALSEcxx . . $ `RSPiX/Src/BLUE/unix/UnixSystem.h:150:9`!, // Initially active, if TRUE.
158 uint32_tcxx . . $ uint32_t# ulUser = 0, // User value.
159 int16_t sPriority = RHOT_NO_PRIORITYcxx . . $ `RSPiX/Src/GREEN/Hot/hot.h:79:9`!);// Priority. Default == non-prioritized.
160
161 // Destructor.
162 ~cxx . . $ RHot#`~RHot`(49f6e7a06ebc5aa8).RHotcxx . . $ RHot#();
163
164 public: // Manipulations.
165 // Activates/Deactivates hotbox. When active, the hotbox
166 // calls the callback(s) when mouse events occur within its
167 // area.
168 void SetActivecxx . . $ RHot#SetActive(68e3ae50fe6578a9).( // Returns nothing.
169 int16_t sActive); // TRUE to activate, FALSE otherwise.
170
171 // Sets the priority of this hotbox.
172 // If hotbox is already active, it is repositioned in the prioritized
173 // list so that the new priorty is recognized.
174 // See CPP comment header in regards to specifics of this value.
175 void SetPrioritycxx . . $ RHot#SetPriority(68e3ae50fe6578a9).( // Returns nothing.
176 int16_t sPriority); // New priority for hotbox. Lower value
177 // equals higher priority.
178 // RHOT_NO_PRIORITY(default) indicates non-prioritized.
179
180 // Sets this hotbox's parent to the specified hotbox.
181 // This has the effect of having the hotbox scanned relative to the
182 // parent and only within the area of the parent.
183 void SetParentcxx . . $ RHot#SetParent(bd2128985e29b30).( // Returns nothing.
184 RHotcxx . . $ RHot#* photParent); // Hotbox to be parent of this hotbox or NULL
185 // for none.
186
187 // Activates/Deactivates capturing for this hotbox.
188 // When capturing is active, this hotbox always receives
189 // events. Sort of a cursor event capture mode.
190 void SetCapturecxx . . $ RHot#SetCapture(68e3ae50fe6578a9).( // Returns nothing.
191 int16_t sActive); // TRUE to activate, FALSE otherwise.
192
193 // Processes a single event for all child hotboxes.
194 // Non mouse events are ignored.
195 // It is now up to the callback to check whether the input event
196 // is used and decide whether to utilize the event.
197 // Recurses on children.
198 // This is called by the other Do().
199 int16_t Docxx . . $ RHot#Do(313f2fc9c0e20095).( // Returns priority of item that used event
200 // or RHOT_NO_PRIORITY if none.
201 RInputEventcxx . . $ RInputEvent#* pie); // In: Most recent user input event.
202 // Out: Depends on callbacks. Generally,
203 // pie->sUsed = TRUE, if used.
204
205 // Processes a single event for all child hotboxes.
206 // Interface to above function that simply accepts Blue mouse event data.
207 // NOTE: If you use this Do() the RInputEvent passed to callbacks that
208 // take such input, will have its lTime, sButtons, and sUsed set to 0.
209 // If you do not use that type of callback, then there's no problem.
210 // This is purely provided for backward compatibility.
211 int16_t Docxx . . $ RHot#Do(9a3fce0d34302b3b).( // Returns priority of item that used event
212 // or RHOT_NO_PRIORITY if none.
213 int16_t sPosX, // In: X position for event.
214 int16_t sPosY, // In: Y position for event.
215 int16_t sEvent) // In: A RSPiX Blue mouse button event
216 // (see <Mac/Win/Etc>Blue.h).
217 {
218 // Create an event.
219 RInputEventcxx . . $ RInputEvent# ie;
220 ie.typecxx . . $ $anonymous_type_d98dd6da999e9263_0#type. = RInputEventcxx . . $ RInputEvent#::Mousecxx . . $ $anonymous_type_d98dd6da999e9263_0#Mouse.;
221 ie.sPosXcxx . . $ $anonymous_type_d98dd6da999e9263_0#$anonymous_type_2#$anonymous_type_3#sPosX. = sPosX;
222 ie.sPosYcxx . . $ $anonymous_type_d98dd6da999e9263_0#$anonymous_type_2#$anonymous_type_3#sPosY. = sPosY;
223 ie.sButtonscxx . . $ $anonymous_type_d98dd6da999e9263_0#$anonymous_type_2#$anonymous_type_3#sButtons. = 0;
224 ie.sEventcxx . . $ $anonymous_type_d98dd6da999e9263_0#$anonymous_type_2#$anonymous_type_3#sEvent. = sEvent;
225 ie.lTimecxx . . $ $anonymous_type_d98dd6da999e9263_0#lTime. = 0;
226 ie.sUsedcxx . . $ $anonymous_type_d98dd6da999e9263_0#sUsed. = FALSEcxx . . $ `RSPiX/Src/BLUE/unix/UnixSystem.h:150:9`!;
227
228 return Docxx . . $ RHot#Do(313f2fc9c0e20095).(&ie);
229 }
230
231 public: // Querries.
232
233 int16_t IsActivecxx . . $ RHot#IsActive(4c3706f7850cf040).(void) // Returns TRUE if active, FALSE otherwise.
234 {
235 return m_sActivecxx . . $ RHot#m_sActive.;
236 }
237
238 int16_t IsCapturingcxx . . $ RHot#IsCapturing(4c3706f7850cf040).(void) // Returns TRUE if capturing events, FALSE
239 // otherwise.
240 {
241 return m_sCapturecxx . . $ RHot#m_sCapture.;
242 }
243
244 // Get the child position equivalent coordinates.
245 void GetChildPoscxx . . $ RHot#GetChildPos(53d13eeaf7c767a9).( // Returns nothing.
246 int16_t* psX, // In: Top-level position.
247 // Out: Child position.
248 int16_t* psY); // In: Top-level position.
249 // Out: Child position.
250
251 // Get the top position equivalent coordinates.
252 void GetTopPoscxx . . $ RHot#GetTopPos(53d13eeaf7c767a9).( // Returns nothing.
253 int16_t* psX, // In: Child position.
254 // Out: Top-level position.
255 int16_t* psY); // In: Child position.
256 // Out: Top-level position.
257
258 RHotcxx . . $ RHot#* GetParentcxx . . $ RHot#GetParent(5358dfced655ec57).(void) // Returns ptr to RHot that is parent to this Rhot.
259 {
260 return m_photParentcxx . . $ RHot#m_photParent.;
261 }
262
263 public: // Static functions.
264
265 public: // Internal public functions.
266
267 protected: // Internal functions.
268 // Resets all members of this RHot.
269 // Returns nothing.
270 void Initcxx . . $ RHot#Init(49f6e7a06ebc5aa8).(void);
271
272 // Gets the list appropriate for this hotbox.
273 ListHotscxx . . $ RHot#ListHots#* GetCaptureListcxx . . $ RHot#GetCaptureList(eeb8bc8c2f55e3a5).(void); // Returns Capture list appropriate for this hotbox.
274
275 public: // Static members.
276
277 protected: // Instantiable members.
278 int16_t m_sActivecxx . . $ RHot#m_sActive.; // TRUE if active, FALSE otherwise.
279 int16_t m_sCapturecxx . . $ RHot#m_sCapture.; // TRUE, if capturing events.
280 int16_t m_sPrioritycxx . . $ RHot#m_sPriority.; // Priority for hotbox. Lower value
281 // equals closer to front (higher priority).
282 // RHOT_NO_PRIORITY(default) indicates non-prioritized.
283 // See CPP comment header in regards to specifics
284 // of this value.
285 RHotcxx . . $ RHot#* m_photParentcxx . . $ RHot#m_photParent.; // Pointer to parent RHot or NULL, if none.
286
287
288 public: // To be modified by the User.
289 int16_t m_sXcxx . . $ RHot#m_sX.; // The x-coordinate of this hotbox relative to
290 // its parent.
291 int16_t m_sYcxx . . $ RHot#m_sY.; // The y-coordinate of this hotbox relative to
292 // its parent.
293 int16_t m_sWcxx . . $ RHot#m_sW.; // The width of this hotbox.
294 int16_t m_sHcxx . . $ RHot#m_sH.; // The height of this hotbox.
295
296 REventCallcxx . . $ RHot#REventCall# m_ecUsercxx . . $ RHot#m_ecUser.; // User callback on button events.
297 // All callbacks can be used simultaneously.
298 REventPosCallcxx . . $ RHot#REventPosCall# m_epcUsercxx . . $ RHot#m_epcUser.; // User callback on button events. Includes
299 // mouse position.
300 // All callbacks can be used simultaneously.
301 InputEventCallcxx . . $ RHot#InputEventCall# m_iecUsercxx . . $ RHot#m_iecUser.; // User callback on input events. Includes
302 // a full RInputEvent.
303 // All callbacks can be used simultaneously.
304 uint32_tcxx . . $ uint32_t# m_ulUsercxx . . $ RHot#m_ulUser.; // User value passed to callbacks.
305
306 SListHotscxx . . $ RHot#SListHots# m_slistActiveChildrencxx . . $ RHot#m_slistActiveChildren.; // List of active child RHots.
307 ListHotscxx . . $ RHot#ListHots# m_listChildrencxx . . $ RHot#m_listChildren.; // List of all child RHots.
308 // List of hots that always receive events.
309 ListHotscxx . . $ RHot#ListHots# m_listCapturingcxx . . $ RHot#m_listCapturing.; // List of all capturing child RHots
310 // and self, if capturing.
311
312
313
314 public: // Static members.
315
316 };
317
318 #endif // HOT_H
319 //////////////////////////////////////////////////////////////////////////////
320 // EOF
321 //////////////////////////////////////////////////////////////////////////////