STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
WM.h
Go to the documentation of this file.
1 /*********************************************************************
2 * SEGGER Microcontroller GmbH & Co. KG *
3 * Solutions for real time microcontroller applications *
4 **********************************************************************
5 * *
6 * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
7 * *
8 * Internet: www.segger.com Support: support@segger.com *
9 * *
10 **********************************************************************
11 
12 ** emWin V5.28 - Graphical user interface for embedded applications **
13 All Intellectual Property rights in the Software belongs to SEGGER.
14 emWin is protected by international copyright laws. Knowledge of the
15 source code may not be used to write a similar product. This file may
16 only be used in accordance with the following terms:
17 
18 The software has been licensed to STMicroelectronics International
19 N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
20 les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
21 purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
22 troller products commercialized by Licensee only, sublicensed and dis_
23 tributed under the terms and conditions of the End User License Agree_
24 ment supplied by STMicroelectronics International N.V.
25 Full source code is available at: www.segger.com
26 
27 We appreciate your understanding and fairness.
28 ----------------------------------------------------------------------
29 File : WM.h
30 Purpose : Windows manager include
31 ----------------------------------------------------------------------
32 */
33 
34 #ifndef WM_H /* Make sure we only include it once */
35 #define WM_H
36 
37 
38 #include "GUI_ConfDefaults.h"
39 #include "GUI_Type.h" /* Needed because of typedefs only */
40 #include "WM_GUI.h" /* Some functions needed by GUI routines */
41 #include "GUI.h"
42 
43 #if defined(__cplusplus)
44 extern "C" { /* Make sure we have C-declarations in C++ programs */
45 #endif
46 
47 /* Static memory devices */
48 #ifndef WM_SUPPORT_STATIC_MEMDEV
49  #define WM_SUPPORT_STATIC_MEMDEV GUI_SUPPORT_MEMDEV
50 #endif
51 
52 /* Support for transparency. Switching it off makes Wm smaller and faster */
53 #ifndef WM_SUPPORT_TRANSPARENCY
54  #define WM_SUPPORT_TRANSPARENCY 1 /* Should be defined outside of GUI_WINSUPPORT because of '#if GUI_WINSUPPORT && WM_SUPPORT_TRANSPARENCY' in some files */
55 #endif
56 
57 /* This is for tests only. It will fill the invalid area of a window.
58  Can be used for debugging. */
59 #ifndef WM_SUPPORT_DIAG
60  #ifdef WIN32 /* In simulation */
61  #define WM_SUPPORT_DIAG GUI_WINSUPPORT
62  #else
63  #define WM_SUPPORT_DIAG 0
64  #endif
65 #endif
66 
67 /* Make sure we actually have configured windows. If we have not,
68  there is no point for a windows manager and it will therefor not
69  generate any code !
70 */
71 
72 #if GUI_WINSUPPORT
73 
74 /*********************************************************************
75 *
76 * Config defaults
77 */
78 #ifndef WM_ASSERT
79  #define WM_ASSERT(expr) GUI_DEBUG_ASSERT(expr)
80 #endif
81 
82 #ifndef WM_SUPPORT_TOUCH
83  #define WM_SUPPORT_TOUCH GUI_SUPPORT_TOUCH
84 #endif
85 
86 /* Allow older API calls */
87 #ifndef WM_COMPATIBLE_MODE
88  #define WM_COMPATIBLE_MODE 1
89 #endif
90 
91 /* Send a message if visibility of a window has changed */
92 #ifndef WM_SUPPORT_NOTIFY_VIS_CHANGED
93  #define WM_SUPPORT_NOTIFY_VIS_CHANGED 0
94 #endif
95 
96 #ifndef WM_SUPPORT_CPP
97  #if defined (_MSC_VER)
98  #define WM_SUPPORT_CPP 1
99  #else
100  #define WM_SUPPORT_CPP 0
101  #endif
102 #endif
103 
104 /*********************************************************************
105 *
106 * Locking macros
107 */
108 #define WM_LOCK() GUI_LOCK()
109 #define WM_UNLOCK() GUI_UNLOCK()
110 
111 #define WM_LOCK_H(hWin) (WM_Obj *)GUI_LOCK_H(hWin)
112 
113 /*********************************************************************
114 *
115 * Data types
116 */
117 typedef struct WM_WINDOW_INFO WM_WINDOW_INFO;
118 
119 struct WM_WINDOW_INFO {
120  GUI_HMEM hWin;
121  GUI_HMEM hParent;
122  GUI_HMEM hFirstChild;
123  GUI_HMEM hNext;
124  GUI_RECT Rect;
125  U32 Status;
126  U32 DebugId;
127  WM_WINDOW_INFO * pNext;
128 };
129 
130 typedef struct {
131  int Key, PressedCnt;
132 } WM_KEY_INFO;
133 
134 typedef struct {
135  int NumItems, v, PageSize;
136 } WM_SCROLL_STATE;
137 
138 typedef struct {
139  int Done;
140  int ReturnValue;
141 } WM_DIALOG_STATUS;
142 
143 typedef struct {
144  int x,y;
145  U8 State;
146  U8 StatePrev;
147 } WM_PID_STATE_CHANGED_INFO;
148 
149 typedef struct {
150  int Cmd;
151  int dx, dy, da;
152  int xPos, yPos;
153  int Period;
154  int SnapX;
155  int SnapY;
156  int FinalMove;
157  U32 Flags;
158  GUI_PID_STATE * pState;
159  GUI_HMEM hContext;
160 } WM_MOTION_INFO;
161 
162 typedef struct {
163  I32 FactorMin; // Minimum factor to be used (<< 16)
164  I32 FactorMax; // Maximum factor to be used (<< 16)
165  U32 xSize; // Native xSize of window to be zoomed in pixels
166  U32 ySize; // Native ySize of window to be zoomed in pixels
167  U32 xSizeParent; // xSize of parent window
168  U32 ySizeParent; // ySize of parent window
169  I32 Factor0; // Primary factor when starting zoom gesture (<< 16)
170  int xPos0; // Primary window position in x when starting the gesture
171  int yPos0; // Primary window position in y when starting the gesture
172  GUI_POINT Center0; // Primary center point when starting the gesture
173 } WM_ZOOM_INFO;
174 
175 typedef struct {
176  int Flags; // Information regarding gesture type
177  GUI_POINT Point; // Relative movement
178  GUI_POINT Center; // Center point for zooming
179  I32 Angle; // Angle between the touch points
180  I32 Factor; // Current zoom factor
181  WM_ZOOM_INFO * pZoomInfo; // Pointer to WM_ZOOM_INFO structure
182 } WM_GESTURE_INFO;
183 
184 typedef struct {
185  int dx, dy;
186 } WM_MOVE_INFO;
187 
188 /*********************************************************************
189 *
190 * Gesture flags for multi touch support
191 */
192 #define WM_GF_BEGIN (1 << 0)
193 #define WM_GF_END (1 << 1)
194 #define WM_GF_PAN (1 << 2)
195 #define WM_GF_ZOOM (1 << 3)
196 #define WM_GF_ROTATE (1 << 4)
197 
198 /*********************************************************************
199 *
200 * Messages Ids
201 *
202 * The following is the list of windows messages.
203 */
204 #define WM_CREATE 0x0001 /* The first message received, right after client has actually been created */
205 #define WM_MOVE 0x0003 /* window has been moved (Same as WIN32) */
206 
207 #define WM_SIZE 0x0005 /* Is sent to a window after its size has changed (Same as WIN32, do not change !) */
208 
209 #define WM_DELETE 11 /* Delete (Destroy) command: This tells the client to free its data strutures since the window
210  it is associates with no longer exists.*/
211 #define WM_TOUCH 0x0240 /* Touch screen message */
212 #define WM_TOUCH_CHILD 13 /* Touch screen message to ancestors */
213 #define WM_KEY 14 /* Key has been pressed */
214 
215 #define WM_PAINT 0x000F /* Repaint window (because content is (partially) invalid */
216 
217 #if GUI_SUPPORT_MOUSE
218 #define WM_MOUSEOVER 16 /* Mouse has moved, no key pressed */
219 #define WM_MOUSEOVER_END 18 /* Mouse has moved, no key pressed */
220 #endif
221 
222 #define WM_PID_STATE_CHANGED 17 /* Pointer input device state has changed */
223 
224 #define WM_GET_INSIDE_RECT 20 /* get inside rectangle: client rectangle minus pixels lost to effect */
225 #define WM_GET_ID 21 /* Get id of widget */
226 #define WM_SET_ID 22 /* Set id of widget */
227 #define WM_GET_CLIENT_WINDOW 23 /* Get window handle of client window. Default is the same as window */
228 #define WM_CAPTURE_RELEASED 24 /* Let window know that mouse capture is over */
229 
230 #define WM_INIT_DIALOG 29 /* Inform dialog that it is ready for init */
231 
232 #define WM_SET_FOCUS 30 /* Inform window that it has gotten or lost the focus */
233 #define WM_GET_ACCEPT_FOCUS 31 /* Find out if window can accept the focus */
234 #define WM_NOTIFY_CHILD_HAS_FOCUS 32 /* Sent to parent when child receives / loses focus */
235 
236 #define WM_NOTIFY_OWNER_KEY 33 /* Some widgets (e.g. listbox) notify owner when receiving key messages */
237 
238 #define WM_GET_BKCOLOR 34 /* Return back ground color (only frame window and similar) */
239 #define WM_GET_SCROLL_STATE 35 /* Query state of scroll bar */
240 
241 #define WM_SET_SCROLL_STATE 36 /* Set scroll info ... only effective for scrollbars */
242 
243 #define WM_NOTIFY_CLIENTCHANGE 37 /* Client area may have changed */
244 #define WM_NOTIFY_PARENT 38 /* Notify parent. Information is detailed as notification code */
245 #define WM_NOTIFY_PARENT_REFLECTION 39 /* Notify parent reflection.
246  Sometimes send back as a result of the WM_NOTIFY_PARENT message
247  to let child react on behalf of its parent.
248  Information is detailed as notification code */
249 #define WM_NOTIFY_ENABLE 40 /* Enable or disable widget */
250 #define WM_NOTIFY_VIS_CHANGED 41 /* Visibility of a window has or may have changed */
251 
252 #define WM_HANDLE_DIALOG_STATUS 42 /* Set or get dialog status */
253 #define WM_GET_RADIOGROUP 43 /* Send to all siblings and children of a radio control when
254  selection changed */
255 #define WM_MENU 44 /* Send to owner window of menu widget */
256 #define WM_SCREENSIZE_CHANGED 45 /* Send to all windows when size of screen has changed */
257 #define WM_PRE_PAINT 46 /* Send to a window before it receives a WM_PAINT message */
258 #define WM_POST_PAINT 47 /* Send to a window after (the last) WM_PAINT message */
259 
260 #define WM_MOTION 48 /* Automatic motion messages */
261 
262 #define WM_GET_WINDOW_ID 49 /* Return widget type specific Id (DebugId) */
263 
264 #define WM_GESTURE 0x0119 /* Gesture message */
265 
266 #define WM_TIMER 0x0113 /* Timer has expired (Keep the same as WIN32) */
267 #define WM_WIDGET 0x0300 /* 256 messages reserved for Widget messages */
268 #define WM_USER 0x0400 /* Reserved for user messages ... (Keep the same as WIN32) */
269 
270 /*********************************************************************
271 *
272 * Motion messages
273 */
274 #define WM_MOTION_INIT 0
275 #define WM_MOTION_MOVE 1
276 #define WM_MOTION_GETPOS 2
277 #define WM_MOTION_GETCONTEXT 3
278 
279 /*********************************************************************
280 *
281 * Motion flags
282 */
283 #define WM_MOTION_MANAGE_BY_WINDOW (1 << 0) // Window movement is managed by window itself
284 
285 /*********************************************************************
286 *
287 * Notification codes
288 *
289 * The following is the list of notification codes send
290 * with the WM_NOTIFY_PARENT message
291 */
292 #define WM_NOTIFICATION_CLICKED 1
293 #define WM_NOTIFICATION_RELEASED 2
294 #define WM_NOTIFICATION_MOVED_OUT 3
295 #define WM_NOTIFICATION_SEL_CHANGED 4
296 #define WM_NOTIFICATION_VALUE_CHANGED 5
297 #define WM_NOTIFICATION_SCROLLBAR_ADDED 6 /* Scroller added */
298 #define WM_NOTIFICATION_CHILD_DELETED 7 /* Inform window that child is about to be deleted */
299 #define WM_NOTIFICATION_GOT_FOCUS 8
300 #define WM_NOTIFICATION_LOST_FOCUS 9
301 #define WM_NOTIFICATION_SCROLL_CHANGED 10
302 
303 #define WM_NOTIFICATION_WIDGET 11 /* Space for widget defined notifications */
304 #define WM_NOTIFICATION_USER 16 /* Space for application (user) defined notifications */
305 
306 /*********************************************************************
307 *
308 * Memory management
309 */
310 #define WM_HWIN GUI_HWIN
311 #define WM_HWIN_NULL GUI_HMEM_NULL
312 #define WM_HMEM GUI_HMEM
313 #define WM_HMEM_NULL GUI_HMEM_NULL
314 #define WM_HTIMER GUI_HMEM
315 
316 /*********************************************************************
317 *
318 * Window defines
319 */
320 #define WM_HBKWIN WM_GetDesktopWindow() /* Handle of background window */
321 #define WM_UNATTACHED ((WM_HMEM) - 1) /* Do not attach to a window */
322 
323 /*********************************************************************
324 *
325 * Window create flags.
326 *
327 * These flags can be passed to the create window
328 * function as flag-parameter. The flags are combinable using the
329 * binary or operator.
330 */
331 #define WM_CF_HASTRANS (1UL << 0) /* Has transparency. Needs to be defined for windows which do not fill the entire
332  section of their (client) rectangle. */
333 #define WM_CF_HIDE (0UL << 1) /* Hide window after creation (default !) */
334 #define WM_CF_SHOW (1UL << 1) /* Show window after creation */
335 #define WM_CF_MEMDEV (1UL << 2) /* Use memory device for redraws */
336 #define WM_CF_STAYONTOP (1UL << 3) /* Stay on top */
337 #define WM_CF_DISABLED (1UL << 4) /* Disabled: Does not receive PID (mouse & touch) input */
338 
339 /* Create only flags ... Not available as status flags */
340 #define WM_CF_ACTIVATE (1UL << 5) /* If automatic activation upon creation of window is desired */
341 #define WM_CF_FGND (0UL << 6) /* Put window in foreground after creation (default !) */
342 #define WM_CF_BGND (1UL << 6) /* Put window in background after creation */
343 
344 /* Anchor flags */
345 #define WM_CF_ANCHOR_RIGHT (1UL << 7) /* Right anchor ... If parent is resized, distance to right will remain const (left is default) */
346 #define WM_CF_ANCHOR_BOTTOM (1UL << 8) /* Bottom anchor ... If parent is resized, distance to bottom will remain const (top is default) */
347 #define WM_CF_ANCHOR_LEFT (1UL << 9) /* Left anchor ... If parent is resized, distance to left will remain const (left is default) */
348 #define WM_CF_ANCHOR_TOP (1UL << 10) /* Top anchor ... If parent is resized, distance to top will remain const (top is default) */
349 
350 #define WM_CF_CONST_OUTLINE (1UL << 11) /* Constant outline. This is relevant for transparent windows only. If a window is transparent
351  and does not have a constant outline, its background is invalided instead of the window itself.
352  This causes add. computation time when redrawing. */
353 #define WM_CF_LATE_CLIP (1UL << 12)
354 #define WM_CF_MEMDEV_ON_REDRAW (1UL << 13)
355 
356 #define WM_SF_INVALID_DRAW (1UL << 14)
357 #define WM_SF_DELETE (1UL << 15) /* Marks the window to be deleted within WM_Exec() when no callback routine is executed */
358 
359 #define WM_CF_STATIC (1UL << 16) /* Use static memory device for redraws */
360 
361 #define WM_CF_MOTION_X (1UL << 17) /* Window can be moved automatically in X axis */
362 #define WM_CF_MOTION_Y (1UL << 18) /* Window can be moved automatically in Y axis */
363 
364 #define WM_CF_GESTURE (1UL << 19) /* Marks the window to be a able to receive gesture messages */
365 
366 #define WM_CF_ZOOM (1UL << 20) /* Window can be scaled automatically by multi touch gesture input */
367 
368 #define WM_CF_MOTION_R (1UL << 21) // Window can be rotated
369 
370 /*********************************************************************
371 *
372 * Window manager types
373 */
374 typedef struct WM_Obj WM_Obj;
375 typedef struct WM_MESSAGE WM_MESSAGE;
376 
377 typedef void WM_CALLBACK( WM_MESSAGE * pMsg);
378 
379 struct WM_MESSAGE {
380  int MsgId; /* type of message */
381  WM_HWIN hWin; /* Destination window */
382  WM_HWIN hWinSrc; /* Source window */
383  union {
384  const void * p; /* Some messages need more info ... Pointer is declared "const" because some systems (M16C) have 4 byte const, byte 2 byte default ptrs */
385  int v;
386  GUI_COLOR Color;
387  } Data;
388 };
389 
390 struct WM_Obj {
391  GUI_RECT Rect; /* Outer dimensions of window */
392  GUI_RECT InvalidRect; /* Invalid rectangle */
393  WM_CALLBACK* cb; /* Ptr to notification callback */
394  WM_HWIN hNextLin; /* Next window in linear list */
395  WM_HWIN hParent;
396  WM_HWIN hFirstChild;
397  WM_HWIN hNext;
398  #if WM_SUPPORT_STATIC_MEMDEV
399  GUI_MEMDEV_Handle hMem; /* Static memory device */
400  #endif
401  U32 Status; /* Status flags */
402  #if WM_SUPPORT_CPP
403  void * ObjPtr;
404  #endif
405 };
406 
407 typedef void WM_tfPollPID(void);
408 typedef void WM_tfForEach(WM_HWIN hWin, void * pData);
409 
410 typedef void (* WM_tfInvalidateParent) (const GUI_RECT * pInvalidRect, WM_HWIN hParent, WM_HWIN hStop);
411 typedef void (* WM_tfInvalidateDrawFunc)(WM_HWIN hWin);
412 typedef void (* WM_tfPaint1Func) (WM_HWIN hWin);
413 
414 typedef struct {
415  WM_HMEM hTimer;
416  WM_HWIN hWin;
417  int UserId;
418 } WM_TIMER_OBJ;
419 
420 /*********************************************************************
421 *
422 * General control routines
423 */
424 void WM_Activate (void);
425 void WM_Deactivate(void);
426 void WM_Init (void);
427 int WM_Exec (void); /* Execute all jobs ... Return 0 if nothing was done. */
428 U32 WM_SetCreateFlags(U32 Flags);
429 WM_tfPollPID * WM_SetpfPollPID(WM_tfPollPID * pf);
430 
431 /*********************************************************************
432 *
433 * Window manager interface
434 */
435 void WM_AttachWindow (WM_HWIN hWin, WM_HWIN hParent);
436 void WM_AttachWindowAt (WM_HWIN hWin, WM_HWIN hParent, int x, int y);
437 int WM_CheckScrollPos (WM_SCROLL_STATE * pScrollState, int Pos, int LowerDist, int UpperDist); /* not to be documented (may change in future version) */
438 void WM_ClrHasTrans (WM_HWIN hWin);
439 WM_HWIN WM_CreateWindow (int x0, int y0, int xSize, int ySize, U32 Style, WM_CALLBACK * cb, int NumExtraBytes);
440 WM_HWIN WM_CreateWindowAsChild (int x0, int y0, int xSize, int ySize, WM_HWIN hWinParent, U32 Style, WM_CALLBACK* cb, int NumExtraBytes);
441 void WM_DeleteWindow (WM_HWIN hWin);
442 void WM_DetachWindow (WM_HWIN hWin);
443 void WM_EnableGestures (WM_HWIN hWin, int OnOff);
444 int WM_GetHasTrans (WM_HWIN hWin);
445 WM_HWIN WM_GetFocussedWindow (void);
446 int WM_GetInvalidRect (WM_HWIN hWin, GUI_RECT * pRect);
447 int WM_GetStayOnTop (WM_HWIN hWin);
448 void WM_HideWindow (WM_HWIN hWin);
449 void WM_InvalidateArea (const GUI_RECT * pRect);
450 void WM_InvalidateRect (WM_HWIN hWin, const GUI_RECT * pRect);
451 void WM_InvalidateWindow (WM_HWIN hWin);
452 void WM_InvalidateWindowAndDescsEx(WM_HWIN hWin, const GUI_RECT * pInvalidRect, U16 Flags);
453 void WM_InvalidateWindowAndDescs (WM_HWIN hWin); /* not to be documented (may change in future version) */
454 int WM_IsEnabled (WM_HWIN hObj);
455 char WM_IsCompletelyCovered (WM_HWIN hWin); /* Checks if the window is completely covered by other windows */
456 char WM_IsCompletelyVisible (WM_HWIN hWin); /* Is the window completely visible ? */
457 int WM_IsFocussable (WM_HWIN hWin);
458 int WM_IsVisible (WM_HWIN hWin);
459 int WM_IsWindow (WM_HWIN hWin); /* Check validity */
460 void WM_SetAnchor (WM_HWIN hWin, U16 AnchorFlags);
461 void WM_SetHasTrans (WM_HWIN hWin);
462 void WM_SetId (WM_HWIN hObj, int Id);
463 void WM_SetStayOnTop (WM_HWIN hWin, int OnOff);
464 void WM_SetTransState (WM_HWIN hWin, unsigned State);
465 void WM_ShowWindow (WM_HWIN hWin);
466 void WM_ValidateRect (WM_HWIN hWin, const GUI_RECT * pRect);
467 void WM_ValidateWindow (WM_HWIN hWin);
468 
469 /* Gesture support */
470 void WM_GESTURE_Enable (int OnOff);
471 int WM_GESTURE_EnableEx(int OnOff, int MaxFactor);
472 void WM_GESTURE_Exec (void);
473 I32 WM_GESTURE_SetThresholdAngle(I32 ThresholdAngle);
474 I32 WM_GESTURE_SetThresholdDist (I32 ThresholdDist);
475 
476 /* Motion support */
477 void WM_MOTION_Enable (int OnOff);
478 void WM_MOTION_SetMovement (WM_HWIN hWin, int Axis, I32 Velocity, I32 Dist);
479 void WM_MOTION_SetMotion (WM_HWIN hWin, int Axis, I32 Velocity, I32 Deceleration);
480 void WM_MOTION_SetMoveable (WM_HWIN hWin, U32 Flags, int OnOff);
481 void WM_MOTION_SetDeceleration (WM_HWIN hWin, int Axis, I32 Deceleration);
482 unsigned WM_MOTION_SetDefaultPeriod(unsigned Period);
483 void WM_MOTION_SetSpeed (WM_HWIN hWin, int Axis, I32 Velocity);
484 
485 /* Motion support, private interface */
486 WM_HMEM WM_MOTION__CreateContext(void);
487 void WM_MOTION__DeleteContext(WM_HMEM hContext);
488 
489 /* Motion support, private function(s) */
490 void WM__SetMotionCallback (void(* cbMotion) (GUI_PID_STATE * pState, void * p));
491 
492 /* Static memory devices */
493 #if (GUI_SUPPORT_MEMDEV)
494  #define GUI_MEMDEV_EDGE_LEFT 0
495  #define GUI_MEMDEV_EDGE_RIGHT 1
496  #define GUI_MEMDEV_EDGE_TOP 2
497  #define GUI_MEMDEV_EDGE_BOTTOM 3
498 
499  int GUI_MEMDEV_BlendWinBk (WM_HWIN hWin, int Period, U32 BlendColor, U8 BlendIntens);
500  int GUI_MEMDEV_BlurAndBlendWinBk(WM_HWIN hWin, int Period, U8 BlurDepth, U32 BlendColor, U8 BlendIntens);
501  int GUI_MEMDEV_BlurWinBk (WM_HWIN hWin, int Period, U8 BlurDepth);
502  void GUI_MEMDEV_CreateStatic (WM_HWIN hWin);
503  int GUI_MEMDEV_FadeInWindow (WM_HWIN hWin, int Period);
504  int GUI_MEMDEV_FadeOutWindow (WM_HWIN hWin, int Period);
505  GUI_MEMDEV_Handle GUI_MEMDEV_GetStaticDevice (WM_HWIN hWin);
506  GUI_MEMDEV_Handle GUI_MEMDEV_GetWindowDevice (WM_HWIN hWin);
507  int GUI_MEMDEV_MoveInWindow (WM_HWIN hWin, int x, int y, int a180, int Period);
508  int GUI_MEMDEV_MoveOutWindow (WM_HWIN hWin, int x, int y, int a180, int Period);
509  void GUI_MEMDEV_Paint1Static (WM_HWIN hWin); /* not to be documented */
510  int GUI_MEMDEV_ShiftInWindow (WM_HWIN hWin, int Period, int Direction);
511  int GUI_MEMDEV_ShiftOutWindow (WM_HWIN hWin, int Period, int Direction);
512  int GUI_MEMDEV_SwapWindow (WM_HWIN hWin, int Period, int Edge);
513 
514 #endif
515 
516 /* Move/resize windows */
517 void WM_MoveWindow (WM_HWIN hWin, int dx, int dy);
518 void WM_ResizeWindow (WM_HWIN hWin, int dx, int dy);
519 void WM_MoveTo (WM_HWIN hWin, int x, int y);
520 void WM_MoveChildTo (WM_HWIN hWin, int x, int y);
521 void WM_SetSize (WM_HWIN hWin, int XSize, int YSize);
522 void WM_SetWindowPos (WM_HWIN hWin, int xPos, int yPos, int xSize, int ySize);
523 int WM_SetXSize (WM_HWIN hWin, int xSize);
524 int WM_SetYSize (WM_HWIN hWin, int ySize);
525 int WM_SetScrollbarH (WM_HWIN hWin, int OnOff); /* not to be documented (may change in future version) */
526 int WM_SetScrollbarV (WM_HWIN hWin, int OnOff); /* not to be documented (may change in future version) */
527 
528 /* ToolTip support */
529 #define WM_TOOLTIP_PI_FIRST 0
530 #define WM_TOOLTIP_PI_SHOW 1
531 #define WM_TOOLTIP_PI_NEXT 2
532 
533 #define WM_TOOLTIP_CI_BK 0
534 #define WM_TOOLTIP_CI_FRAME 1
535 #define WM_TOOLTIP_CI_TEXT 2
536 
537 typedef WM_HMEM WM_TOOLTIP_HANDLE;
538 
539 typedef struct {
540  int Id;
541  const char * pText;
542 } TOOLTIP_INFO;
543 
544 int WM_TOOLTIP_AddTool (WM_TOOLTIP_HANDLE hToolTip, WM_HWIN hTool, const char * pText);
545 WM_TOOLTIP_HANDLE WM_TOOLTIP_Create (WM_HWIN hDlg, const TOOLTIP_INFO * pInfo, unsigned NumItems);
546 void WM_TOOLTIP_Delete (WM_TOOLTIP_HANDLE hToolTip);
547 GUI_COLOR WM_TOOLTIP_SetDefaultColor (unsigned Index, GUI_COLOR Color);
548 const GUI_FONT * WM_TOOLTIP_SetDefaultFont (const GUI_FONT * pFont);
549 unsigned WM_TOOLTIP_SetDefaultPeriod(unsigned Index, unsigned Period);
550 
551 /* ToolTip support, private */
552 void WM__SetToolTipCallback(void(* cbToolTip)(GUI_PID_STATE * pState, WM_HWIN));
553 
554 /* Timer */
555 #ifdef GUI_X_CREATE_TIMER
556  int WM_CreateTimer (WM_HWIN hWin, int UserID, int Period, int Mode); /* not to be documented (may change in future version) */
557  void WM_DeleteTimer (WM_HWIN hWin, int UserId); /* not to be documented (may change in future version) */
558 #else
559  WM_HMEM WM_CreateTimer (WM_HWIN hWin, int UserID, int Period, int Mode); /* not to be documented (may change in future version) */
560  void WM_DeleteTimer (WM_HMEM hTimer); /* not to be documented (may change in future version) */
561  void WM_RestartTimer(WM_HMEM hTimer, int Period);
562 #endif
563 int WM_GetTimerId(WM_HTIMER hTimer);
564 
565 /* Diagnostics */
566 int WM_GetNumWindows(void);
567 int WM_GetNumInvalidWindows(void);
568 
569 /* Scroll state related functions */
570 void WM_CheckScrollBounds(WM_SCROLL_STATE * pScrollState); /* not to be documented (may change in future version) */
571 int WM_GetScrollPosH (WM_HWIN hWin);
572 int WM_GetScrollPosV (WM_HWIN hWin);
573 void WM_SetScrollPosH (WM_HWIN hWin, unsigned ScrollPos);
574 void WM_SetScrollPosV (WM_HWIN hWin, unsigned ScrollPos);
575 int WM_SetScrollValue (WM_SCROLL_STATE * pScrollState, int v); /* not to be documented (may change in future version) */
576 
577 /* Get / Set (new) callback function */
578 WM_CALLBACK * WM_SetCallback(WM_HWIN hWin, WM_CALLBACK * cb);
579 WM_CALLBACK * WM_GetCallback(WM_HWIN hWin);
580 
581 /* Get size/origin of a window */
582 void WM_GetClientRect (GUI_RECT * pRect);
583 void WM_GetClientRectEx (WM_HWIN hWin, GUI_RECT * pRect);
584 void WM_GetInsideRect (GUI_RECT * pRect);
585 void WM_GetInsideRectEx (WM_HWIN hWin, GUI_RECT * pRect);
586 void WM_GetInsideRectExScrollbar(WM_HWIN hWin, GUI_RECT * pRect); /* not to be documented (may change in future version) */
587 void WM_GetWindowRect (GUI_RECT * pRect);
588 void WM_GetWindowRectEx (WM_HWIN hWin, GUI_RECT * pRect);
589 int WM_GetOrgX (void);
590 int WM_GetOrgY (void);
591 int WM_GetWindowOrgX (WM_HWIN hWin);
592 int WM_GetWindowOrgY (WM_HWIN hWin);
593 int WM_GetWindowSizeX (WM_HWIN hWin);
594 int WM_GetWindowSizeY (WM_HWIN hWin);
595 WM_HWIN WM_GetFirstChild (WM_HWIN hWin);
596 WM_HWIN WM_GetNextSibling (WM_HWIN hWin);
597 WM_HWIN WM_GetParent (WM_HWIN hWin);
598 WM_HWIN WM_GetPrevSibling (WM_HWIN hWin);
599 int WM_GetId (WM_HWIN hWin);
600 WM_HWIN WM_GetScrollbarV (WM_HWIN hWin);
601 WM_HWIN WM_GetScrollbarH (WM_HWIN hWin);
602 WM_HWIN WM_GetScrollPartner (WM_HWIN hWin);
603 WM_HWIN WM_GetClientWindow (WM_HWIN hObj);
604 GUI_COLOR WM_GetBkColor (WM_HWIN hObj);
605 
606 /* Change Z-Order of windows */
607 void WM_BringToBottom(WM_HWIN hWin);
608 void WM_BringToTop(WM_HWIN hWin);
609 
610 GUI_COLOR WM_SetDesktopColor (GUI_COLOR Color);
611 GUI_COLOR WM_SetDesktopColorEx(GUI_COLOR Color, unsigned int LayerIndex);
612 void WM_SetDesktopColors (GUI_COLOR Color);
613 
614 /* Select window used for drawing operations */
615 WM_HWIN WM_SelectWindow (WM_HWIN hWin);
616 WM_HWIN WM_GetActiveWindow (void);
617 void WM_Paint (WM_HWIN hObj);
618 void WM_Update (WM_HWIN hWin);
619 void WM_PaintWindowAndDescs (WM_HWIN hWin);
620 void WM_UpdateWindowAndDescs (WM_HWIN hWin);
621 
622 /* Get foreground/background windows */
623 WM_HWIN WM_GetDesktopWindow (void);
624 WM_HWIN WM_GetDesktopWindowEx(unsigned int LayerIndex);
625 
626 /* Reduce clipping area of a window */
627 const GUI_RECT * WM_SetUserClipRect(const GUI_RECT * pRect);
628 void WM_SetDefault (void);
629 
630 /* Use of memory devices */
631 void WM_EnableMemdev (WM_HWIN hWin);
632 void WM_DisableMemdev (WM_HWIN hWin);
633 
634 /* Automatic use of multiple buffers */
635 int WM_MULTIBUF_Enable(int OnOff);
636 
637 extern const GUI_MULTIBUF_API * WM_MULTIBUF__pAPI;
638 
639 typedef void (* T_WM_EXEC_GESTURE)(void);
640 
641 extern T_WM_EXEC_GESTURE WM__pExecGestures;
642 
643 /* ... */
644 int WM_OnKey(int Key, int Pressed);
645 void WM_MakeModal(WM_HWIN hWin);
646 int WM_SetModalLayer(int LayerIndex);
647 int WM_GetModalLayer(void);
648 
649 /*********************************************************************
650 *
651 * Message related functions
652 *
653 * Please note that some of these functions do not yet show up in the
654 * documentation, as they should not be required by application program.
655 */
656 void WM_NotifyParent (WM_HWIN hWin, int Notification);
657 void WM_SendMessage (WM_HWIN hWin, WM_MESSAGE * p);
658 void WM_SendMessageNoPara (WM_HWIN hWin, int MsgId); /* not to be documented (may change in future */
659 void WM_DefaultProc (WM_MESSAGE * pMsg);
660 int WM_BroadcastMessage (WM_MESSAGE * pMsg);
661 void WM_SetScrollState (WM_HWIN hWin, const WM_SCROLL_STATE * pState);
662 void WM_SetEnableState (WM_HWIN hItem, int State);
663 void WM_SendToParent (WM_HWIN hWin, WM_MESSAGE * pMsg);
664 int WM_HasFocus (WM_HWIN hWin);
665 int WM_SetFocus (WM_HWIN hWin);
666 WM_HWIN WM_SetFocusOnNextChild (WM_HWIN hParent); /* Set the focus to the next child */
667 WM_HWIN WM_SetFocusOnPrevChild (WM_HWIN hParent); /* Set the focus to the previous child */
668 WM_HWIN WM_GetDialogItem (WM_HWIN hWin, int Id);
669 void WM_EnableWindow (WM_HWIN hWin);
670 void WM_DisableWindow (WM_HWIN hWin);
671 void WM_GetScrollState (WM_HWIN hObj, WM_SCROLL_STATE * pScrollState);
672 
673 /*********************************************************************
674 *
675 * Managing user data
676 */
677 int WM_GetUserData (WM_HWIN hWin, void * pDest, int SizeOfBuffer);
678 int WM_SetUserData (WM_HWIN hWin, const void * pSrc, int SizeOfBuffer);
679 int WM__GetUserDataEx(WM_HWIN hWin, void * pDest, int NumBytes, int SizeOfObject);
680 int WM__SetUserDataEx(WM_HWIN hWin, const void * pSrc, int NumBytes, int SizeOfObject);
681 
682 /*********************************************************************
683 *
684 * Capturing input focus
685 */
686 int WM_HasCaptured (WM_HWIN hWin);
687 void WM_SetCapture (WM_HWIN hObj, int AutoRelease);
688 void WM_SetCaptureMove(WM_HWIN hWin, const GUI_PID_STATE * pState, int MinVisibility, int LimitTop); /* Not yet documented */
689 void WM_ReleaseCapture(void);
690 
691 /*********************************************************************
692 *
693 * Misc routines
694 */
695 int WM_HandlePID (void);
696 WM_HWIN WM_Screen2hWin (int x, int y);
697 WM_HWIN WM_Screen2hWinEx (WM_HWIN hStop, int x, int y);
698 void WM_ForEachDesc (WM_HWIN hWin, WM_tfForEach * pcb, void * pData);
699 void WM_SetScreenSize (int xSize, int ySize);
700 int WM_PollSimMsg (void);
701 int WM_GetWindowInfo (WM_WINDOW_INFO * pInfo, int FirstWindow);
702 
703 /*********************************************************************
704 *
705 * Diagnostics routines
706 */
707 #if (WM_SUPPORT_DIAG)
708 void WM_DIAG_EnableInvalidationColoring(int OnOff);
709 #endif
710 
711 /*********************************************************************
712 *
713 * Macros for compatibility with older versions
714 */
715 #if WM_COMPATIBLE_MODE
716  #define HBWIN WM_HWIN
717  #define HBWIN_NULL WM_HWIN_NULL
718 
719  #define WM_HideWin WM_HideWindow
720  #define WM_ShowWin WM_ShowWindow
721  #define WM_GetKey GUI_GetKey
722  #define WM_WaitKey GUI_WaitKey
723 
724  #define WM_ExecIdle WM_Exec
725  #define WM_ExecIdle1 WM_Exec1
726 
727  #define WM_Invalidate WM_InvalidateWindow
728  #define WM_GetWinRect WM_GetWindowRect
729  #define WM_GetWinOrgX WM_GetWindowOrgX
730  #define WM_GetWinOrgY WM_GetWindowOrgY
731  #define WM_GetWinSizeX WM_GetWindowSizeX
732  #define WM_GetWinSizeY WM_GetWindowSizeY
733  #define WM_GetXSize WM_GetWindowSizeX
734  #define WM_GetYSize WM_GetWindowSizeY
735  #define WM_SelWin WM_SelectWindow
736  #define WM_GetBackgroundWindow WM_GetDesktopWindow
737  #define WM_GetForegroundWindow 0
738  #define WM_SetForegroundWindow WM_BringToTop
739  #define WM_SetUserClipArea WM_SetUserClipRect
740 
741 
742  #define WM_Start()
743  #define WM_Stop()
744  #define WM_SetBkWindowColor(Color) WM_SetDesktopColor(Color)
745 
746 #endif
747 
748 
749 #endif /* GUI_WINSUPPORT */
750 
751 #if defined(__cplusplus)
752 }
753 #endif
754 
755 #endif /* WM_H */
756 
757 /*************************** End of file ****************************/
#define U32
Definition: Global.h:50
Definition: LCD.h:101
Definition: LCD.h:102
LCD Drawing point (pixel) geometric definition.
GUI_HMEM GUI_MEMDEV_Handle
Definition: GUI.h:889
LCD_COLOR GUI_COLOR
Definition: GUI_Type.h:50
#define GUI_HMEM
Definition: GUI_Type.h:565
#define U16
Definition: Global.h:47
#define I32
Definition: Global.h:59
#define U8
Definition: Global.h:44