📄 wm.h
字号:
/*********************************************************************************************************** uC/GUI* Universal graphic software for embedded applications** (c) Copyright 2002, Micrium Inc., Weston, FL* (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH** 礐/GUI is protected by international copyright laws. Knowledge of the* source code may not be used to write a similar product. This file may* only be used in accordance with a license and should not be redistributed* in any way. We appreciate your understanding and fairness.*----------------------------------------------------------------------
File : WM.H
Purpose : Windows manager include
----------------------------------------------------------------------
*/
#ifndef WM_H /* Make sure we only include it once */
#ifndef GUI_H
#include "GUI.H" /* Needed because of typedefs only */
#endif
#ifndef WM_H /* Make sure circular reference do not lead
to multiple-inclusion problem */
#define WM_H
/* Make sure we actually have configured windows. If we have not,
there is no point for a windows manager and it will therefor not
generate any code !
*/
#if GUI_WINSUPPORT
/*
*************************************************************
* *
* Defaults for configuration switches *
* *
*************************************************************
*/
#ifndef WM_ASSERT
#define WM_ASSERT(expr) GUI_DEBUG_ASSERT(expr)
#endif
#ifndef WM_RESULT
#define WM_RESULT void
#endif
#ifndef WM_SUPPORT_TOUCH
#define WM_SUPPORT_TOUCH GUI_SUPPORT_TOUCH
#endif
#ifndef WM_SUPPORT_OBSTRUCT
#define WM_SUPPORT_OBSTRUCT 1
#endif
#ifndef WM_COMPATIBLE_MODE
#define WM_COMPATIBLE_MODE 1
#endif
/*
*************************************************************
* *
* Configuration check *
* *
*************************************************************
*/
/*
*************************************************************
* *
* Locking macros *
* *
*************************************************************
For performance reasons, the windows manager user the same locking mechanisms
as the GUI layer. The advantage is that wiht a single call to GUI_LOCK both
the graphic level and the WM level are covered.
*/
#define WM_LOCK() GUI_LOCK()
#define WM_UNLOCK() GUI_UNLOCK()
/* Memory allocation locking is seperate from Windows managers in
order to be able to use different resource semaphores. Per
default, the same one is used.
*/
#ifndef WMALLOC_LOCK
#define WMALLOC_LOCK() WM_LOCK()
#define WMALLOC_UNLOCK() WM_UNLOCK()
#endif
/************************************************************
*
* Public data (just for inline functions
* in form of macros)
*
*************************************************************
*/
extern U8 WM_IsActive;
/************************************************************
*
* Data types
*
*************************************************************
*/
typedef struct {
int Key, PressedCnt;
} WM_KEY_INFO;
typedef struct {
int NumItems, v, PageSize;
} WM_SCROLL_STATE;
/*
*************************************************************
* *
* Function replacement macros *
* *
*************************************************************
*/
#define WM_GetIsActive() WM_IsActive
#define WM_GetNumWindows() WM__NumWindows
#define WM_GetNumInvalidWindows() WM__NumInvalidWindows
/*********************************************************************
*
* Messages Ids
The following is the list of windows messages.
*/
#ifndef _WINUSER_ /* Conflicts with winuser.h ... */
#define WM_PAINT 1 /* Repaint window (because content is (partially) invalid */
#define WM_COVER 2 /* Window has been partially covered. Normally, there is no reaction to this event. */
#define WM_CREATE 3 /* The first message received, right after client has actually been created */
#define WM_DELETE 4 /* Delete (Destroy) command: This tells the client to free its data strutures since the window
it is associates with no longer exists.*/
#define WM_SIZE 6 /* Is sent to a window after its size has changed */
#define WM_MOVE 7 /* window has been moved */
#define WM_SHOW 8 /* windows has just received the show command */
#define WM_HIDE 9 /* windows has just received the hide command */
#define WM_FGND 10 /* window has been made top of window stack */
#define WM_BGND 11 /* window has just been put to bottom of stack */
#define WM_TOUCH 12 /* touch screen message */
#define WM_KEY 13 /* Key has been pressed */
#define WM_GETCLIENTRECT 100 /* get client rectangle in window coordinates*/
#define WM_GETCLIENTRECT_ABS 101 /* get client rectangle in absolute coordinates*/
#define WM_GET_INSIDE_RECT 102 /* get inside rectangle: client rectangle minus pixels lost to effect */
#define WM_GETORG 104
#define WM_GET_ID 105 /* Get id of widget */
#define WM_GET_CLIENT_WINDOW 106 /* Get window handle of client window. Default is the same as window */
#define WM_CAPTURE_RELEASED 107 /* Let window know that mouse capture is over */
#define WM_INIT_DIALOG 109 /* Inform dialog that it is ready for init */
#define WM_SET_FOCUS 110 /* Inform window that it has gotten or lost the focus */
#define WM_GET_ACCEPT_FOCUS 111 /* Find out if window can accept the focus */
#define WM_GET_FOCUSSED_CHILD 112 /* Which child currently has the focus */
#define WM_GET_HAS_FOCUS 113 /* Does this window have the focus ? */
#define WM_GET_BKCOLOR 114 /* Return back ground color (only frame window and similar) */
#define WM_SET_ENABLE 115 /* Enable or disable widget */
#define WM_GET_SCROLL_STATE 116 /* Query state of scroll bar */
#define WM_ADD_SCROLLBAR 118 /* Scroller added */
#define WM_SET_SCROLL_STATE 119 /* Set scroll info ... only effective for scrollbars */
#define WM_NOTIFY_CHILD_HAS_FOCUS 120
#define WM_NOTIFY_PARENT 121
#define WM_USER 200 /* Reserved for user messages */
#endif
/*********************************************************************
*
* Notification codes
The following is the list of notification codes send
with the WM_NOTIFY message
*/
#define WM_NOTIFICATION_CLICKED 1
#define WM_NOTIFICATION_RELEASED 2
#define WM_NOTIFICATION_MOVED_OUT 3
#define WM_NOTIFICATION_SEL_CHANGED 4
#define WM_NOTIFICATION_VALUE_CHANGED 5
/*
*******************************************************************
* *
* Memory management *
* *
*******************************************************************
*/
#define WM_FREE(h) GUI_ALLOC_FREE(h)
#define WM_ALLOC(h) GUI_ALLOC_ALLOC(h)
#define WM_HWIN GUI_HWIN
#define WM_HWIN_NULL GUI_HWIN_NULL
#define WM_HMEM GUI_HMEM
#define WM_HMEM2Ptr GUI_ALLOC_H2P
#define WM_FREEPTR(ph) GUI_ALLOC_FreePtr(ph)
#define WM_HMEM_NULL GUI_HMEM_NULL
#define WM_HBKWIN 1 /* Handle of background window */
/*
*******************************************************************
* *
* Windows manager types *
* *
*******************************************************************
*/
/* Windows create flags. These flags can be passed to the create window
function as flag-parameter. The flags are combinable using the
binary or operator.
*/
#define WM_CF_HASTRANS (1<<0) /* Has transparency. Needs to be defined
for windows which do not fill the entire
section of their (client) rectangle. */
#define WM_CF_HIDE (0<<1) /* Hide window after creation (default !) */
#define WM_CF_SHOW (1<<1) /* Show window after creation */
#define WM_CF_FGND (0<<2) /* Put window in foreground after creation
(default !) */
#define WM_CF_BGND (1<<2) /* Put window in background after creation */
#define WM_CF_MEMDEV (1<<3) /* Use memory device for redraws */
#define WM_CF_STAYONTOP (1<<4) /* Stay on top */
#define WM_CF_ACTIVATE (1<<5) /* If automatic activation upon creation of
window is desired */
typedef struct {
int MsgId; /* type of message */
WM_HWIN hWin; /* Destination window */
WM_HWIN hWinSrc; /* Source window */
union {
void* p; /* Some messages need more info ... */
int v;
GUI_COLOR Color;
} Data;
} WM_MESSAGE;
typedef void WM_CALLBACK( WM_MESSAGE* pMsg);
typedef struct WM_OBJ_struct WM_Obj;
struct WM_OBJ_struct {
GUI_RECT Rect; /* outer dimensions of window */
GUI_RECT InvalidRect; /* invalid rectangle */
WM_CALLBACK* cb; /* ptr to notification callback */
WM_HWIN hNextLin; /* Next window in linear list */
WM_HWIN hParent, hFirstChild, hNext;
U16 Status; /* Some status flags */
};
/*
**********************************************************************
*
* General control routines
*
**********************************************************************
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -