NuMaker emWin HMI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WM.h Source File

WM.h

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