Chris Womack / emwin

Dependents:   DISCO-F746NG_rtos_test

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