RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WM.h Source File

WM.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH & Co. KG                *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2016  SEGGER Microcontroller GmbH & Co. KG       *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.38 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software has been licensed to  NXP Semiconductors USA, Inc.  whose
00019 registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose,
00020 CA 95134, USA  solely for  the  purposes  of  creating  libraries  for
00021 NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and
00022 distributed under the terms and conditions of the NXP End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 
00030 Licensor:                 SEGGER Microcontroller Systems LLC
00031 Licensed to:              NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
00032 Licensed SEGGER software: emWin
00033 License number:           GUI-00186
00034 License model:            emWin License Agreement, dated August 20th 2011
00035 Licensed product:         -
00036 Licensed platform:        NXP's ARM 7/9, Cortex-M0,M3,M4
00037 Licensed number of seats: -
00038 ----------------------------------------------------------------------
00039 File        : WM.h
00040 Purpose     : Windows manager include
00041 ----------------------------------------------------------------------
00042 */
00043 
00044 #ifndef WM_H            /* Make sure we only include it once */
00045 #define WM_H
00046 
00047 
00048 #include "GUI_ConfDefaults.h"
00049 #include "GUI_Type.h"      /* Needed because of typedefs only */
00050 #include "WM_GUI.h"       /* Some functions needed by GUI routines */
00051 #include "GUI.h"
00052 
00053 #if defined(__cplusplus)
00054 extern "C" {     /* Make sure we have C-declarations in C++ programs */
00055 #endif
00056 
00057 /* Static memory devices */
00058 #ifndef   WM_SUPPORT_STATIC_MEMDEV
00059   #define WM_SUPPORT_STATIC_MEMDEV GUI_SUPPORT_MEMDEV
00060 #endif
00061 
00062 /* Support for transparency. Switching it off makes Wm smaller and faster */
00063 #ifndef   WM_SUPPORT_TRANSPARENCY
00064   #define WM_SUPPORT_TRANSPARENCY 1 /* Should be defined outside of GUI_WINSUPPORT because of '#if GUI_WINSUPPORT && WM_SUPPORT_TRANSPARENCY' in some files */
00065 #endif
00066 
00067 /* This is for tests only. It will fill the invalid area of a window.
00068    Can be used for debugging. */
00069 #ifndef WM_SUPPORT_DIAG
00070   #ifdef WIN32   /* In simulation */
00071     #define WM_SUPPORT_DIAG GUI_WINSUPPORT
00072   #else
00073     #define WM_SUPPORT_DIAG 0
00074   #endif
00075 #endif
00076 
00077 /* Make sure we actually have configured windows. If we have not,
00078   there is no point for a windows manager and it will therefor not
00079   generate any code !
00080 */
00081 
00082 #if GUI_WINSUPPORT
00083 
00084 /*********************************************************************
00085 *
00086 *       Config defaults
00087 */
00088 #ifndef   WM_ASSERT
00089   #define WM_ASSERT(expr) GUI_DEBUG_ASSERT(expr)
00090 #endif
00091 
00092 #ifndef   WM_SUPPORT_TOUCH
00093   #define WM_SUPPORT_TOUCH        GUI_SUPPORT_TOUCH
00094 #endif
00095 
00096 /* Allow older API calls */
00097 #ifndef   WM_COMPATIBLE_MODE
00098   #define WM_COMPATIBLE_MODE 1
00099 #endif
00100 
00101 /* Send a message if visibility of a window has changed */
00102 #ifndef   WM_SUPPORT_NOTIFY_VIS_CHANGED
00103   #define WM_SUPPORT_NOTIFY_VIS_CHANGED 0
00104 #endif
00105 
00106 #ifndef   WM_SUPPORT_CPP
00107   #if defined (_MSC_VER)
00108     #define WM_SUPPORT_CPP 1
00109   #else
00110     #define WM_SUPPORT_CPP 0
00111   #endif
00112 #endif
00113 
00114 /*********************************************************************
00115 *
00116 *       Locking macros
00117 */
00118 #define WM_LOCK()   GUI_LOCK()
00119 #define WM_UNLOCK() GUI_UNLOCK()
00120 
00121 #define WM_LOCK_H(hWin) (WM_Obj *)GUI_LOCK_H(hWin)
00122 
00123 /*********************************************************************
00124 *
00125 *       Data types
00126 */
00127 typedef struct WM_WINDOW_INFO WM_WINDOW_INFO;
00128 
00129 struct WM_WINDOW_INFO {
00130   GUI_HMEM hWin;
00131   GUI_HMEM hParent;
00132   GUI_HMEM hFirstChild;
00133   GUI_HMEM hNext;
00134   GUI_RECT Rect;
00135   U32      Status;
00136   U32      DebugId;
00137   WM_WINDOW_INFO * pNext;
00138 };
00139 
00140 typedef struct {
00141   int Key, PressedCnt;
00142 } WM_KEY_INFO;
00143 
00144 typedef struct {
00145   int NumItems, v, PageSize;
00146 } WM_SCROLL_STATE;
00147 
00148 typedef struct {
00149   int Done;
00150   int ReturnValue;
00151 } WM_DIALOG_STATUS;
00152 
00153 typedef struct {
00154   int x,y;
00155   U8  State;
00156   U8  StatePrev;
00157 } WM_PID_STATE_CHANGED_INFO;
00158 
00159 typedef struct {
00160   int Cmd;
00161   int dx, dy, da;
00162   int xPos, yPos;
00163   int Period;
00164   int SnapX;
00165   int SnapY;
00166   int FinalMove;
00167   U32 Flags;
00168   GUI_PID_STATE * pState;
00169   GUI_HMEM hContext;
00170 } WM_MOTION_INFO;
00171 
00172 typedef struct {
00173   I32       FactorMin;   // Minimum factor to be used (<< 16)
00174   I32       FactorMax;   // Maximum factor to be used (<< 16)
00175   U32       xSize;       // Native xSize of window to be zoomed in pixels
00176   U32       ySize;       // Native ySize of window to be zoomed in pixels
00177   U32       xSizeParent; // xSize of parent window
00178   U32       ySizeParent; // ySize of parent window
00179   I32       Factor0;     // Primary factor when starting zoom gesture (<< 16)
00180   int       xPos0;       // Primary window position in x when starting the gesture
00181   int       yPos0;       // Primary window position in y when starting the gesture
00182   GUI_POINT Center0;     // Primary center point when starting the gesture
00183 } WM_ZOOM_INFO;
00184 
00185 typedef struct {
00186   int            Flags;     // Information regarding gesture type
00187   GUI_POINT      Point;     // Relative movement
00188   GUI_POINT      Center;    // Center point for zooming
00189   I32            Angle;     // Angle between the touch points
00190   I32            Factor;    // Current zoom factor
00191   WM_ZOOM_INFO * pZoomInfo; // Pointer to WM_ZOOM_INFO structure
00192 } WM_GESTURE_INFO;
00193 
00194 typedef struct {
00195   int dx, dy;
00196 } WM_MOVE_INFO;
00197 
00198 /*********************************************************************
00199 *
00200 *       Gesture flags for multi touch support
00201 */
00202 #define WM_GF_BEGIN  (1 << 0)
00203 #define WM_GF_END    (1 << 1)
00204 #define WM_GF_PAN    (1 << 2)
00205 #define WM_GF_ZOOM   (1 << 3)
00206 #define WM_GF_ROTATE (1 << 4)
00207 #define WM_GF_DTAP   (1 << 5)
00208 
00209 /*********************************************************************
00210 *
00211 *       Messages Ids
00212 *
00213 * The following is the list of windows messages.
00214 */
00215 #define WM_CREATE                   0x0001  /* The first message received, right after client has actually been created */
00216 #define WM_MOVE                     0x0003  /* window has been moved (Same as WIN32) */
00217 
00218 #define WM_SIZE                     0x0005  /* Is sent to a window after its size has changed (Same as WIN32, do not change !) */
00219 
00220 #define WM_DELETE                   11      /* Delete (Destroy) command: This tells the client to free its data strutures since the window
00221                                                it is associates with no longer exists.*/
00222 #define WM_TOUCH                    0x0240  /* Touch screen message */
00223 #define WM_TOUCH_CHILD              13      /* Touch screen message to ancestors */
00224 #define WM_KEY                      14      /* Key has been pressed */
00225 
00226 #define WM_PAINT                    0x000F  /* Repaint window (because content is (partially) invalid */
00227 
00228 #if GUI_SUPPORT_MOUSE
00229 #define WM_MOUSEOVER                16      /* Mouse has moved, no key pressed */
00230 #define WM_MOUSEOVER_END            18      /* Mouse has moved, no key pressed */
00231 #endif
00232 
00233 #define WM_PID_STATE_CHANGED        17      /* Pointer input device state has changed */
00234 
00235 #define WM_GET_INSIDE_RECT          20      /* get inside rectangle: client rectangle minus pixels lost to effect */
00236 #define WM_GET_ID                   21      /* Get id of widget */
00237 #define WM_SET_ID                   22      /* Set id of widget */
00238 #define WM_GET_CLIENT_WINDOW        23      /* Get window handle of client window. Default is the same as window */
00239 #define WM_CAPTURE_RELEASED         24      /* Let window know that mouse capture is over */
00240 
00241 #define WM_INIT_DIALOG              29      /* Inform dialog that it is ready for init */
00242 
00243 #define WM_SET_FOCUS                30      /* Inform window that it has gotten or lost the focus */
00244 #define WM_GET_ACCEPT_FOCUS         31      /* Find out if window can accept the focus */
00245 #define WM_NOTIFY_CHILD_HAS_FOCUS   32      /* Sent to parent when child receives / loses focus */
00246 
00247 #define WM_NOTIFY_OWNER_KEY         33      /* Some widgets (e.g. listbox) notify owner when receiving key messages */
00248 
00249 #define WM_GET_BKCOLOR              34      /* Return back ground color (only frame window and similar) */
00250 #define WM_GET_SCROLL_STATE         35      /* Query state of scroll bar */
00251 
00252 #define WM_SET_SCROLL_STATE         36      /* Set scroll info ... only effective for scrollbars */
00253 
00254 #define WM_NOTIFY_CLIENTCHANGE      37      /* Client area may have changed */
00255 #define WM_NOTIFY_PARENT            38      /* Notify parent. Information is detailed as notification code */
00256 #define WM_NOTIFY_PARENT_REFLECTION 39      /* Notify parent reflection.
00257                                                Sometimes send back as a result of the WM_NOTIFY_PARENT message
00258                                                to let child react on behalf of its parent.
00259                                                Information is detailed as notification code */
00260 #define WM_NOTIFY_ENABLE            40      /* Enable or disable widget */
00261 #define WM_NOTIFY_VIS_CHANGED       41      /* Visibility of a window has or may have changed */
00262 
00263 #define WM_HANDLE_DIALOG_STATUS     42      /* Set or get dialog status */
00264 #define WM_GET_RADIOGROUP           43      /* Send to all siblings and children of a radio control when
00265                                                selection changed */
00266 #define WM_MENU                     44      /* Send to owner window of menu widget */
00267 #define WM_SCREENSIZE_CHANGED       45      /* Send to all windows when size of screen has changed */
00268 #define WM_PRE_PAINT                46      /* Send to a window before it receives a WM_PAINT message */
00269 #define WM_POST_PAINT               47      /* Send to a window after (the last) WM_PAINT message */
00270 
00271 #define WM_MOTION                   48      /* Automatic motion messages */
00272 
00273 #define WM_GET_WINDOW_ID            49      /* Return widget type specific Id (DebugId) */
00274 
00275 #define WM_PRE_BANDING              50
00276 #define WM_POST_BANDING             51
00277 
00278 #define WM_GESTURE                  0x0119  /* Gesture message */
00279 
00280 #define WM_TIMER                    0x0113  /* Timer has expired              (Keep the same as WIN32) */
00281 #define WM_WIDGET                   0x0300  /* 256 messages reserved for Widget messages */
00282 #define WM_USER                     0x0400  /* Reserved for user messages ... (Keep the same as WIN32) */
00283 
00284 /*********************************************************************
00285 *
00286 *       Motion messages
00287 */
00288 #define WM_MOTION_INIT    0
00289 #define WM_MOTION_MOVE    1
00290 #define WM_MOTION_GETPOS  2
00291 #define WM_MOTION_GETCONTEXT 3
00292 
00293 /*********************************************************************
00294 *
00295 *       Motion flags
00296 */
00297 #define WM_MOTION_MANAGE_BY_WINDOW   (1 << 0) // Window movement is managed by window itself
00298 
00299 /*********************************************************************
00300 *
00301 *       Notification codes
00302 *
00303 * The following is the list of notification codes send
00304 * with the WM_NOTIFY_PARENT message
00305 */
00306 #define WM_NOTIFICATION_CLICKED             1
00307 #define WM_NOTIFICATION_RELEASED            2
00308 #define WM_NOTIFICATION_MOVED_OUT           3
00309 #define WM_NOTIFICATION_SEL_CHANGED         4
00310 #define WM_NOTIFICATION_VALUE_CHANGED       5
00311 #define WM_NOTIFICATION_SCROLLBAR_ADDED     6      /* Scroller added */
00312 #define WM_NOTIFICATION_CHILD_DELETED       7      /* Inform window that child is about to be deleted */
00313 #define WM_NOTIFICATION_GOT_FOCUS           8
00314 #define WM_NOTIFICATION_LOST_FOCUS          9
00315 #define WM_NOTIFICATION_SCROLL_CHANGED     10
00316 
00317 #define WM_NOTIFICATION_WIDGET             11      /* Space for widget defined notifications */
00318 #define WM_NOTIFICATION_USER               16      /* Space for  application (user) defined notifications */
00319 
00320 /*********************************************************************
00321 *
00322 *       Memory management
00323 */
00324 #define WM_HWIN        GUI_HWIN
00325 #define WM_HWIN_NULL   GUI_HMEM_NULL
00326 #define WM_HMEM        GUI_HMEM
00327 #define WM_HMEM_NULL   GUI_HMEM_NULL
00328 #define WM_HTIMER      GUI_HMEM
00329 
00330 /*********************************************************************
00331 *
00332 *       Window defines
00333 */
00334 #define WM_HBKWIN      WM_GetDesktopWindow()                /* Handle of background window */
00335 #define WM_UNATTACHED  ((WM_HMEM) - 1)                      /* Do not attach to a window */
00336 
00337 /*********************************************************************
00338 *
00339 *       Window create flags.
00340 *
00341 * These flags can be passed to the create window
00342 * function as flag-parameter. The flags are combinable using the
00343 * binary or operator.
00344 */
00345 #define WM_CF_HASTRANS         (1UL << 0)  /* Has transparency. Needs to be defined for windows which do not fill the entire
00346                                           section of their (client) rectangle. */
00347 #define WM_CF_HIDE             (0UL << 1)  /* Hide window after creation (default !) */
00348 #define WM_CF_SHOW             (1UL << 1)  /* Show window after creation */
00349 #define WM_CF_MEMDEV           (1UL << 2)  /* Use memory device for redraws */
00350 #define WM_CF_STAYONTOP        (1UL << 3)  /* Stay on top */
00351 #define WM_CF_DISABLED         (1UL << 4)  /* Disabled: Does not receive PID (mouse & touch) input */
00352 
00353 /* Create only flags ... Not available as status flags */
00354 #define WM_CF_ACTIVATE         (1UL << 5)  /* If automatic activation upon creation of window is desired */
00355 #define WM_CF_FGND             (0UL << 6)  /* Put window in foreground after creation (default !) */
00356 #define WM_CF_BGND             (1UL << 6)  /* Put window in background after creation */
00357 
00358 /* Anchor flags */
00359 #define WM_CF_ANCHOR_RIGHT     (1UL << 7)  /* Right anchor ...  If parent is resized, distance to right  will remain const (left is default) */
00360 #define WM_CF_ANCHOR_BOTTOM    (1UL << 8)  /* Bottom anchor ... If parent is resized, distance to bottom will remain const (top  is default) */
00361 #define WM_CF_ANCHOR_LEFT      (1UL << 9)  /* Left anchor ...   If parent is resized, distance to left   will remain const (left is default) */
00362 #define WM_CF_ANCHOR_TOP       (1UL << 10) /* Top anchor ...    If parent is resized, distance to top    will remain const (top  is default) */
00363 
00364 #define WM_CF_CONST_OUTLINE    (1UL << 11) /* Constant outline. This is relevant for transparent windows only. If a window is transparent
00365                                               and does not have a constant outline, its background is invalided instead of the window itself.
00366                                               This causes add. computation time when redrawing. */
00367 #define WM_CF_LATE_CLIP        (1UL << 12)
00368 #define WM_CF_MEMDEV_ON_REDRAW (1UL << 13)
00369 
00370 #define WM_SF_INVALID_DRAW     (1UL << 14)
00371 #define WM_SF_DELETE           (1UL << 15) /* Marks the window to be deleted within WM_Exec() when no callback routine is executed */
00372 
00373 #define WM_CF_STATIC           (1UL << 16) /* Use static memory device for redraws */
00374 
00375 #define WM_CF_MOTION_X         (1UL << 17) /* Window can be moved automatically in X axis */
00376 #define WM_CF_MOTION_Y         (1UL << 18) /* Window can be moved automatically in Y axis */
00377 
00378 #define WM_CF_GESTURE          (1UL << 19) /* Marks the window to be a able to receive gesture messages */
00379 
00380 #define WM_CF_ZOOM             (1UL << 20) /* Window can be scaled automatically by multi touch gesture input */
00381 
00382 #define WM_CF_MOTION_R         (1UL << 21) // Window can be rotated
00383 
00384 /*********************************************************************
00385 *
00386 *       Window manager types
00387 */
00388 typedef struct WM_Obj     WM_Obj;
00389 typedef struct WM_MESSAGE WM_MESSAGE;
00390 
00391 typedef void WM_CALLBACK( WM_MESSAGE * pMsg);
00392 
00393 struct WM_MESSAGE {
00394   int MsgId;            /* type of message */
00395   WM_HWIN hWin;         /* Destination window */
00396   WM_HWIN hWinSrc;      /* Source window  */
00397   union {
00398     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 */
00399     int v;
00400     GUI_COLOR Color;
00401   } Data;
00402 };
00403 
00404 struct WM_Obj {
00405   GUI_RECT Rect;        /* Outer dimensions of window */
00406   GUI_RECT InvalidRect; /* Invalid rectangle */
00407   WM_CALLBACK* cb;      /* Ptr to notification callback */
00408   WM_HWIN hNextLin;     /* Next window in linear list */
00409   WM_HWIN hParent;
00410   WM_HWIN hFirstChild;
00411   WM_HWIN hNext;
00412   #if WM_SUPPORT_STATIC_MEMDEV
00413     GUI_MEMDEV_Handle hMem; /* Static memory device */
00414   #endif
00415   U32 Status;           /* Status flags */
00416   #if WM_SUPPORT_CPP
00417     void * ObjPtr;
00418   #endif
00419 };
00420 
00421 typedef void WM_tfPollPID(void);
00422 typedef void WM_tfForEach(WM_HWIN hWin, void * pData);
00423 
00424 typedef void (* WM_tfInvalidateParent)  (const GUI_RECT * pInvalidRect, WM_HWIN hParent, WM_HWIN hStop);
00425 typedef void (* WM_tfInvalidateDrawFunc)(WM_HWIN hWin);
00426 typedef void (* WM_tfPaint1Func)        (WM_HWIN hWin);
00427 
00428 typedef struct {
00429   WM_HMEM  hTimer;
00430   WM_HWIN  hWin;
00431   int      UserId;
00432 } WM_TIMER_OBJ;
00433 
00434 /*********************************************************************
00435 *
00436 *       General control routines
00437 */
00438 void WM_Activate  (void);
00439 void WM_Deactivate(void);
00440 void WM_Init      (void);
00441 int  WM_Exec      (void);    /* Execute all jobs ... Return 0 if nothing was done. */
00442 int  WM_Exec1     (void);    // Execute only one job
00443 U32  WM_SetCreateFlags(U32 Flags);
00444 WM_tfPollPID * WM_SetpfPollPID(WM_tfPollPID * pf);
00445 
00446 /*********************************************************************
00447 *
00448 *       Window manager interface
00449 */
00450 void    WM_AttachWindow              (WM_HWIN hWin, WM_HWIN hParent);
00451 void    WM_AttachWindowAt            (WM_HWIN hWin, WM_HWIN hParent, int x, int y);
00452 int     WM_CheckScrollPos            (WM_SCROLL_STATE * pScrollState, int Pos, int LowerDist, int UpperDist); /* not to be documented (may change in future version) */
00453 void    WM_ClrHasTrans               (WM_HWIN hWin);
00454 WM_HWIN WM_CreateWindow              (int x0, int y0, int xSize, int ySize, U32 Style, WM_CALLBACK * cb, int NumExtraBytes);
00455 WM_HWIN WM_CreateWindowAsChild       (int x0, int y0, int xSize, int ySize, WM_HWIN hWinParent, U32 Style, WM_CALLBACK* cb, int NumExtraBytes);
00456 void    WM_DeleteWindow              (WM_HWIN hWin);
00457 void    WM_DetachWindow              (WM_HWIN hWin);
00458 void    WM_EnableGestures            (WM_HWIN hWin, int OnOff);
00459 int     WM_GetHasTrans               (WM_HWIN hWin);
00460 WM_HWIN WM_GetFocussedWindow         (void);
00461 int     WM_GetInvalidRect            (WM_HWIN hWin, GUI_RECT * pRect);
00462 int     WM_GetStayOnTop              (WM_HWIN hWin);
00463 void    WM_HideWindow                (WM_HWIN hWin);
00464 void    WM_InvalidateArea            (const GUI_RECT * pRect);
00465 void    WM_InvalidateRect            (WM_HWIN hWin, const GUI_RECT * pRect);
00466 void    WM_InvalidateWindow          (WM_HWIN hWin);
00467 void    WM_InvalidateWindowAndDescsEx(WM_HWIN hWin, const GUI_RECT * pInvalidRect, U16 Flags);
00468 void    WM_InvalidateWindowAndDescs  (WM_HWIN hWin);    /* not to be documented (may change in future version) */
00469 int     WM_IsEnabled                 (WM_HWIN hObj);
00470 char    WM_IsCompletelyCovered       (WM_HWIN hWin);    /* Checks if the window is completely covered by other windows */
00471 char    WM_IsCompletelyVisible       (WM_HWIN hWin);    /* Is the window completely visible ? */
00472 int     WM_IsFocussable              (WM_HWIN hWin);
00473 int     WM_IsVisible                 (WM_HWIN hWin);
00474 int     WM_IsWindow                  (WM_HWIN hWin);    /* Check validity */
00475 void    WM_SetAnchor                 (WM_HWIN hWin, U16 AnchorFlags);
00476 void    WM_SetHasTrans               (WM_HWIN hWin);
00477 void    WM_SetId                     (WM_HWIN hObj, int Id);
00478 void    WM_SetStayOnTop              (WM_HWIN hWin, int OnOff);
00479 void    WM_SetTransState             (WM_HWIN hWin, unsigned State);
00480 void    WM_ShowWindow                (WM_HWIN hWin);
00481 void    WM_ValidateRect              (WM_HWIN hWin, const GUI_RECT * pRect);
00482 void    WM_ValidateWindow            (WM_HWIN hWin);
00483 
00484 /* Gesture support */
00485 void WM_GESTURE_Enable  (int OnOff);
00486 int  WM_GESTURE_EnableEx(int OnOff, int MaxFactor);
00487 void WM_GESTURE_Exec    (void);
00488 I32  WM_GESTURE_SetThresholdAngle(I32 ThresholdAngle);
00489 I32  WM_GESTURE_SetThresholdDist (I32 ThresholdDist);
00490 
00491 /* Motion support */
00492 void     WM_MOTION_Enable          (int OnOff);
00493 void     WM_MOTION_SetMovement     (WM_HWIN hWin, int Axis, I32 Speed, I32 Dist);
00494 void     WM_MOTION_SetMotion       (WM_HWIN hWin, int Axis, I32 Speed, I32 Deceleration);
00495 void     WM_MOTION_SetMoveable     (WM_HWIN hWin, U32 Flags, int OnOff);
00496 void     WM_MOTION_SetDeceleration (WM_HWIN hWin, int Axis, I32 Deceleration);
00497 unsigned WM_MOTION_SetDefaultPeriod(unsigned Period);
00498 void     WM_MOTION_SetSpeed        (WM_HWIN hWin, int Axis, I32 Velocity);
00499 
00500 /* Motion support, private interface */
00501 WM_HMEM WM_MOTION__CreateContext(void);
00502 void    WM_MOTION__DeleteContext(WM_HMEM hContext);
00503 
00504 /* Motion support, private function(s) */
00505 void     WM__SetMotionCallback (void(* cbMotion) (GUI_PID_STATE * pState, void * p));
00506 
00507 /* Static memory devices */
00508 #if (GUI_SUPPORT_MEMDEV)
00509   #define GUI_MEMDEV_EDGE_LEFT   0
00510   #define GUI_MEMDEV_EDGE_RIGHT  1
00511   #define GUI_MEMDEV_EDGE_TOP    2
00512   #define GUI_MEMDEV_EDGE_BOTTOM 3
00513 
00514   int               GUI_MEMDEV_BlendWinBk       (WM_HWIN hWin, int Period, U32 BlendColor, U8 BlendIntens);
00515   int               GUI_MEMDEV_BlurAndBlendWinBk(WM_HWIN hWin, int Period, U8 BlurDepth, U32 BlendColor, U8 BlendIntens);
00516   int               GUI_MEMDEV_BlurWinBk        (WM_HWIN hWin, int Period, U8 BlurDepth);
00517   void              GUI_MEMDEV_CreateStatic     (WM_HWIN hWin);
00518   GUI_MEMDEV_Handle GUI_MEMDEV_CreateWindowDevice(WM_HWIN hWin);
00519   int               GUI_MEMDEV_FadeInWindow     (WM_HWIN hWin, int Period);
00520   int               GUI_MEMDEV_FadeOutWindow    (WM_HWIN hWin, int Period);
00521   GUI_MEMDEV_Handle GUI_MEMDEV_GetStaticDevice  (WM_HWIN hWin);
00522   GUI_MEMDEV_Handle GUI_MEMDEV_GetWindowDevice  (WM_HWIN hWin);
00523   int               GUI_MEMDEV_MoveInWindow     (WM_HWIN hWin, int x, int y, int a180, int Period);
00524   int               GUI_MEMDEV_MoveOutWindow    (WM_HWIN hWin, int x, int y, int a180, int Period);
00525   void              GUI_MEMDEV_Paint1Static     (WM_HWIN hWin);                                     /* not to be documented */
00526   int               GUI_MEMDEV_ShiftInWindow    (WM_HWIN hWin, int Period, int Direction);
00527   int               GUI_MEMDEV_ShiftOutWindow   (WM_HWIN hWin, int Period, int Direction);
00528   int               GUI_MEMDEV_SwapWindow       (WM_HWIN hWin, int Period, int Edge);
00529 
00530   void              GUI_MEMDEV__CreateStatic    (WM_HWIN hWin);
00531 #endif
00532 
00533 /* Move/resize windows */
00534 void WM_MoveWindow                (WM_HWIN hWin, int dx, int dy);
00535 void WM_ResizeWindow              (WM_HWIN hWin, int dx, int dy);
00536 void WM_MoveTo                    (WM_HWIN hWin, int x, int y);
00537 void WM_MoveChildTo               (WM_HWIN hWin, int x, int y);
00538 void WM_SetSize                   (WM_HWIN hWin, int XSize, int YSize);
00539 void WM_SetWindowPos              (WM_HWIN hWin, int xPos, int yPos, int xSize, int ySize);
00540 int  WM_SetXSize                  (WM_HWIN hWin, int xSize);
00541 int  WM_SetYSize                  (WM_HWIN hWin, int ySize);
00542 int  WM_SetScrollbarH             (WM_HWIN hWin, int OnOff); /* not to be documented (may change in future version) */
00543 int  WM_SetScrollbarV             (WM_HWIN hWin, int OnOff); /* not to be documented (may change in future version) */
00544 
00545 /* ToolTip support */
00546 #define WM_TOOLTIP_PI_FIRST 0
00547 #define WM_TOOLTIP_PI_SHOW  1
00548 #define WM_TOOLTIP_PI_NEXT  2
00549 
00550 #define WM_TOOLTIP_CI_BK    0
00551 #define WM_TOOLTIP_CI_FRAME 1
00552 #define WM_TOOLTIP_CI_TEXT  2
00553 
00554 typedef WM_HMEM WM_TOOLTIP_HANDLE;
00555 
00556 typedef struct {
00557   int          Id;
00558   const char * pText;
00559 } TOOLTIP_INFO;
00560 
00561 int               WM_TOOLTIP_AddTool         (WM_TOOLTIP_HANDLE hToolTip, WM_HWIN hTool, const char * pText);
00562 WM_TOOLTIP_HANDLE WM_TOOLTIP_Create          (WM_HWIN hDlg, const TOOLTIP_INFO * pInfo, unsigned NumItems);
00563 void              WM_TOOLTIP_Delete          (WM_TOOLTIP_HANDLE hToolTip);
00564 GUI_COLOR         WM_TOOLTIP_SetDefaultColor (unsigned Index, GUI_COLOR Color);
00565 const GUI_FONT *  WM_TOOLTIP_SetDefaultFont  (const GUI_FONT * pFont);
00566 unsigned          WM_TOOLTIP_SetDefaultPeriod(unsigned Index, unsigned Period);
00567 
00568 /* ToolTip support, private */
00569 void WM__SetToolTipCallback(void(* cbToolTip)(GUI_PID_STATE * pState, WM_HWIN));
00570 
00571 /* Timer */
00572 #ifdef GUI_X_CREATE_TIMER
00573   int  WM_CreateTimer    (WM_HWIN hWin, int UserID, int Period, int Mode); /* not to be documented (may change in future version) */
00574   void WM_DeleteTimer    (WM_HWIN hWin, int UserId); /* not to be documented (may change in future version) */
00575 #else
00576   WM_HMEM WM_CreateTimer (WM_HWIN hWin, int UserID, int Period, int Mode); /* not to be documented (may change in future version) */
00577   void    WM_DeleteTimer (WM_HMEM hTimer); /* not to be documented (may change in future version) */
00578   void    WM_RestartTimer(WM_HMEM hTimer, int Period);
00579 #endif
00580 int WM_GetTimerId(WM_HTIMER hTimer);
00581 
00582 /* Diagnostics */
00583 int WM_GetNumWindows(void);
00584 int WM_GetNumInvalidWindows(void);
00585 
00586 /* Scroll state related functions */
00587 void WM_CheckScrollBounds(WM_SCROLL_STATE * pScrollState); /* not to be documented (may change in future version) */
00588 int  WM_GetScrollPosH    (WM_HWIN hWin);
00589 int  WM_GetScrollPosV    (WM_HWIN hWin);
00590 void WM_SetScrollPosH    (WM_HWIN hWin, unsigned ScrollPos);
00591 void WM_SetScrollPosV    (WM_HWIN hWin, unsigned ScrollPos);
00592 int  WM_SetScrollValue   (WM_SCROLL_STATE * pScrollState, int v); /* not to be documented (may change in future version) */
00593 
00594 /* Get / Set (new) callback function */
00595 WM_CALLBACK * WM_SetCallback(WM_HWIN hWin, WM_CALLBACK * cb);
00596 WM_CALLBACK * WM_GetCallback(WM_HWIN hWin);
00597 
00598 /* Get size/origin of a window */
00599 void      WM_GetClientRect           (GUI_RECT * pRect);
00600 void      WM_GetClientRectEx         (WM_HWIN hWin, GUI_RECT * pRect);
00601 void      WM_GetInsideRect           (GUI_RECT * pRect);
00602 void      WM_GetInsideRectEx         (WM_HWIN hWin, GUI_RECT * pRect);
00603 void      WM_GetInsideRectExScrollbar(WM_HWIN hWin, GUI_RECT * pRect); /* not to be documented (may change in future version) */
00604 void      WM_GetWindowRect           (GUI_RECT * pRect);
00605 void      WM_GetWindowRectEx         (WM_HWIN hWin, GUI_RECT * pRect);
00606 int       WM_GetOrgX                 (void);
00607 int       WM_GetOrgY                 (void);
00608 int       WM_GetWindowOrgX           (WM_HWIN hWin);
00609 int       WM_GetWindowOrgY           (WM_HWIN hWin);
00610 int       WM_GetWindowSizeX          (WM_HWIN hWin);
00611 int       WM_GetWindowSizeY          (WM_HWIN hWin);
00612 WM_HWIN   WM_GetFirstChild           (WM_HWIN hWin);
00613 WM_HWIN   WM_GetNextSibling          (WM_HWIN hWin);
00614 WM_HWIN   WM_GetParent               (WM_HWIN hWin);
00615 WM_HWIN   WM_GetPrevSibling          (WM_HWIN hWin);
00616 int       WM_GetId                   (WM_HWIN hWin);
00617 WM_HWIN   WM_GetScrollbarV           (WM_HWIN hWin);
00618 WM_HWIN   WM_GetScrollbarH           (WM_HWIN hWin);
00619 WM_HWIN   WM_GetScrollPartner        (WM_HWIN hWin);
00620 WM_HWIN   WM_GetClientWindow         (WM_HWIN hObj);
00621 GUI_COLOR WM_GetBkColor              (WM_HWIN hObj);
00622 
00623 /* Change Z-Order of windows */
00624 void WM_BringToBottom(WM_HWIN hWin);
00625 void WM_BringToTop(WM_HWIN hWin);
00626 
00627 GUI_COLOR WM_SetDesktopColor  (GUI_COLOR Color);
00628 GUI_COLOR WM_SetDesktopColorEx(GUI_COLOR Color, unsigned int LayerIndex);
00629 void      WM_SetDesktopColors (GUI_COLOR Color);
00630 
00631 /* Select window used for drawing operations */
00632 WM_HWIN WM_SelectWindow           (WM_HWIN  hWin);
00633 WM_HWIN WM_GetActiveWindow        (void);
00634 void    WM_Paint                  (WM_HWIN hObj);
00635 void    WM_Update                 (WM_HWIN hWin);
00636 void    WM_PaintWindowAndDescs    (WM_HWIN hWin);
00637 void    WM_UpdateWindowAndDescs   (WM_HWIN hWin);
00638 
00639 /* Get foreground/background windows */
00640 WM_HWIN WM_GetDesktopWindow  (void);
00641 WM_HWIN WM_GetDesktopWindowEx(unsigned int LayerIndex);
00642 
00643 /* Reduce clipping area of a window */
00644 const GUI_RECT * WM_SetUserClipRect(const GUI_RECT * pRect);
00645 void             WM_SetDefault     (void);
00646 
00647 /* Use of memory devices */
00648 void WM_EnableMemdev              (WM_HWIN hWin);
00649 void WM_DisableMemdev             (WM_HWIN hWin);
00650 
00651 /* Automatic use of multiple buffers */
00652 int WM_MULTIBUF_Enable  (int OnOff);
00653 int WM_MULTIBUF_EnableEx(int OnOff, U32 LayerMask);
00654 
00655 extern const GUI_MULTIBUF_API * WM_MULTIBUF__pAPI;
00656 
00657 typedef void (* T_WM_EXEC_GESTURE)(void);
00658 
00659 extern T_WM_EXEC_GESTURE WM__pExecGestures;
00660 
00661 /* ... */
00662 int WM_OnKey(int Key, int Pressed);
00663 void WM_MakeModal(WM_HWIN hWin);
00664 int WM_SetModalLayer(int LayerIndex);
00665 int WM_GetModalLayer(void);
00666 
00667 /*********************************************************************
00668 *
00669 *       Message related functions
00670 *
00671 *  Please note that some of these functions do not yet show up in the
00672 *  documentation, as they should not be required by application program.
00673 */
00674 void      WM_NotifyParent         (WM_HWIN hWin, int Notification);
00675 void      WM_SendMessage          (WM_HWIN hWin, WM_MESSAGE * p);
00676 void      WM_SendMessageNoPara    (WM_HWIN hWin, int MsgId);             /* not to be documented (may change in future */
00677 void      WM_DefaultProc          (WM_MESSAGE * pMsg);
00678 int       WM_BroadcastMessage     (WM_MESSAGE * pMsg);
00679 void      WM_SetScrollState       (WM_HWIN hWin, const WM_SCROLL_STATE * pState);
00680 void      WM_SetEnableState       (WM_HWIN hItem, int State);
00681 void      WM_SendToParent         (WM_HWIN hWin, WM_MESSAGE * pMsg);
00682 int       WM_HasFocus             (WM_HWIN hWin);
00683 int       WM_SetFocus             (WM_HWIN hWin);
00684 WM_HWIN   WM_SetFocusOnNextChild  (WM_HWIN hParent);     /* Set the focus to the next child */
00685 WM_HWIN   WM_SetFocusOnPrevChild  (WM_HWIN hParent);     /* Set the focus to the previous child */
00686 WM_HWIN   WM_GetDialogItem        (WM_HWIN hWin, int Id);
00687 void      WM_EnableWindow         (WM_HWIN hWin);
00688 void      WM_DisableWindow        (WM_HWIN hWin);
00689 void      WM_GetScrollState       (WM_HWIN hObj, WM_SCROLL_STATE * pScrollState);
00690 
00691 /*********************************************************************
00692 *
00693 *       Managing user data
00694 */
00695 int       WM_GetUserData   (WM_HWIN hWin, void * pDest, int SizeOfBuffer);
00696 int       WM_SetUserData   (WM_HWIN hWin, const void * pSrc, int SizeOfBuffer);
00697 int       WM__GetUserDataEx(WM_HWIN hWin, void * pDest, int NumBytes, int SizeOfObject);
00698 int       WM__SetUserDataEx(WM_HWIN hWin, const void * pSrc, int NumBytes, int SizeOfObject);
00699 
00700 /*********************************************************************
00701 *
00702 *       Capturing input focus
00703 */
00704 int  WM_HasCaptured   (WM_HWIN hWin);
00705 void WM_SetCapture    (WM_HWIN hObj, int AutoRelease);
00706 void WM_SetCaptureMove(WM_HWIN hWin, const GUI_PID_STATE * pState, int MinVisibility, int LimitTop); /* Not yet documented */
00707 void WM_ReleaseCapture(void);
00708 
00709 /*********************************************************************
00710 *
00711 *       Misc routines
00712 */
00713 int       WM_HandlePID      (void);
00714 WM_HWIN   WM_Screen2hWin    (int x, int y);
00715 WM_HWIN   WM_Screen2hWinEx  (WM_HWIN hStop, int x, int y);
00716 void      WM_ForEachDesc    (WM_HWIN hWin, WM_tfForEach * pcb, void * pData);
00717 void      WM_SetScreenSize  (int xSize, int ySize);
00718 int       WM_PollSimMsg     (void);
00719 int       WM_GetWindowInfo  (WM_WINDOW_INFO * pInfo, int FirstWindow);
00720 
00721 /*********************************************************************
00722 *
00723 *       Diagnostics routines
00724 */
00725 #if (WM_SUPPORT_DIAG)
00726 void WM_DIAG_EnableInvalidationColoring(int OnOff);
00727 #endif
00728 
00729 /*********************************************************************
00730 *
00731 *       Macros for compatibility with older versions
00732 */
00733 #if WM_COMPATIBLE_MODE
00734   #define HBWIN             WM_HWIN
00735   #define HBWIN_NULL        WM_HWIN_NULL
00736 
00737   #define WM_HideWin        WM_HideWindow
00738   #define WM_ShowWin        WM_ShowWindow
00739   #define WM_GetKey         GUI_GetKey
00740   #define WM_WaitKey        GUI_WaitKey
00741 
00742   #define WM_ExecIdle       WM_Exec
00743   #define WM_ExecIdle1      WM_Exec1
00744 
00745   #define WM_Invalidate     WM_InvalidateWindow
00746   #define WM_GetWinRect     WM_GetWindowRect
00747   #define WM_GetWinOrgX     WM_GetWindowOrgX
00748   #define WM_GetWinOrgY     WM_GetWindowOrgY
00749   #define WM_GetWinSizeX    WM_GetWindowSizeX
00750   #define WM_GetWinSizeY    WM_GetWindowSizeY
00751   #define WM_GetXSize       WM_GetWindowSizeX
00752   #define WM_GetYSize       WM_GetWindowSizeY
00753   #define WM_SelWin         WM_SelectWindow
00754   #define WM_GetBackgroundWindow  WM_GetDesktopWindow
00755   #define WM_GetForegroundWindow    0
00756   #define WM_SetForegroundWindow    WM_BringToTop
00757   #define WM_SetUserClipArea WM_SetUserClipRect
00758 
00759 
00760   #define WM_Start()
00761   #define WM_Stop()
00762   #define WM_SetBkWindowColor(Color)  WM_SetDesktopColor(Color)
00763 
00764 #endif
00765 
00766 
00767 #endif   /* GUI_WINSUPPORT */
00768 
00769 #if defined(__cplusplus)
00770 }
00771 #endif
00772 
00773 #endif   /* WM_H */
00774 
00775 /*************************** End of file ****************************/