window.h
资源名称:GPRS_work.rar [点击查看]
上传用户:sdaoma
上传日期:2013-08-07
资源大小:3838k
文件大小:200k
源码类别:
GPS编程
开发平台:
C/C++
- /**
- * file window.h
- * author Wei Yongming <ymwei@minigui.org>
- * date 2002/01/26
- *
- * This file includes windowing interfaces of MiniGUI.
- *
- verbatim
- Copyright (C) 1998-2002 Wei Yongming.
- Copyright (C) 2002-2004 Feynman Software.
- This file is part of MiniGUI, a compact cross-platform Graphics
- User Interface (GUI) support system for real-time embedded systems.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- endverbatim
- */
- /*
- * $Id: window.h,v 1.132 2004/09/16 06:53:35 snig Exp $
- *
- * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks version 1.6.x
- * Copyright (C) 1998-2002 Wei Yongming.
- * Copyright (C) 2002-2004 Feynman Software.
- */
- #ifndef _MGUI_WINDOW_H
- #define _MGUI_WINDOW_H
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
- /**
- * defgroup msgs Messages
- * @{
- */
- /* definitions of common messages. */
- #define MSG_SYNCMSG 0x0000
- #define MSG_NULLMSG 0x0000
- /**
- * defgroup mouse_msgs Mouse event messages
- * @{
- */
- /* Group 1 from 0x0001 to 0x000F, the mouse messages. */
- #define MSG_FIRSTMOUSEMSG 0x0001
- /**
- * def MSG_LBUTTONDOWN
- * brief Left mouse button down message.
- *
- * This message is posted to the window when the user presses down
- * the left button of the mouse in the client area of the window.
- *
- * code
- * MSG_LBUTTONDOWN
- * DWORD key_flags = (DWORD)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param key_flags The shift key status when this message occurred.
- * param x_pos,y_pos The position of the mouse in client coordinates.
- *
- * sa MSG_LBUTTONUP, key_defs
- *
- * Example:
- * include buttondown.c
- */
- #define MSG_LBUTTONDOWN 0x0001
- /**
- * def MSG_LBUTTONUP
- * brief Left mouse button up message.
- *
- * This message is posted to the window when the user releases up
- * the left button of the mouse in the client area of the window.
- *
- * code
- * MSG_LBUTTONUP
- * DWORD key_flags = (DWORD)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param key_flags The shift key status when this message occurred.
- * param x_pos,y_pos The position of the mouse in client coordinates.
- *
- * sa MSG_LBUTTONDOWN, key_defs
- */
- #define MSG_LBUTTONUP 0x0002
- /**
- * def MSG_LBUTTONDBLCLK
- * brief Left mouse button double clicked message.
- *
- * This message is posted to the window when the user double clicks
- * the left button of the mouse in the client area of the window.
- *
- * code
- * MSG_LBUTTONDBLCLK
- * DWORD key_flags = (DWORD)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param key_flags The shift key status when this message occurred.
- * param x_pos,y_pos The position of the mouse in client coordinates.
- *
- * sa MSG_RBUTTONDBLCLK, key_defs
- */
- #define MSG_LBUTTONDBLCLK 0x0003
- /**
- * def MSG_MOUSEMOVE
- * brief The mouse moved message.
- *
- * This message is posted to the window when the user moves the mouse
- * in the client area of the window.
- *
- * code
- * MSG_MOUSEMOVE
- * DWORD key_flags = (DWORD)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param key_flags The shift key status when this message occurred.
- * param x_pos,y_pos The position of the mouse in client coordinates.
- *
- * sa key_defs
- */
- #define MSG_MOUSEMOVE 0x0004
- /**
- * def MSG_RBUTTONDOWN
- * brief Right mouse button down message.
- *
- * This message is posted to the window when the user presses down
- * the right button of the mouse in the client area of the window.
- *
- * code
- * MSG_RBUTTONDOWN
- * DWORD key_flags = (DWORD)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param key_flags The shift key status when this message occurred.
- * param x_pos,y_pos The position of the mouse in client coordinates.
- *
- * sa MSG_RBUTTONUP, key_defs
- *
- * Example:
- * include buttondown.c
- */
- #define MSG_RBUTTONDOWN 0x0005
- /**
- * def MSG_RBUTTONUP
- * brief Right mouse button up message.
- *
- * This message is posted to the window when the user releases up
- * the right button of the mouse in the client area of the window.
- *
- * code
- * MSG_RBUTTONUP
- * DWORD key_flags = (DWORD)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param key_flags The shift key status when this message occurred.
- * param x_pos,y_pos The position of the mouse in client coordinates.
- *
- * sa MSG_RBUTTONDOWN, key_defs
- */
- #define MSG_RBUTTONUP 0x0006
- /**
- * def MSG_RBUTTONDBLCLK
- * brief Right mouse button double clicked message.
- *
- * This message is posted to the window when the user double clicks
- * the right button of the mouse in the client area of the window.
- *
- * code
- * MSG_RBUTTONDBLCLK
- * DWORD key_flags = (DWORD)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param key_flags The shift key status when this message occurred.
- * param x_pos,y_pos The position of the mouse in client coordinates.
- *
- * sa MSG_LBUTTONDBLCLK, key_defs
- */
- #define MSG_RBUTTONDBLCLK 0x0007
- #define MSG_NCMOUSEOFF 0x0007
- /**
- * def MSG_NCLBUTTONDOWN
- * brief Left mouse button down message in the non-client area.
- *
- * This message is posted to the window when the user presses down
- * the left button of the mouse in the non-client area of the window.
- *
- * code
- * MSG_NCLBUTTONDOWN
- * int hit_code = (int)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param hit_code The hit test code which tells the area of the mouse.
- * param x_pos,y_pos The position of the mouse in window coordinates.
- *
- * sa MSG_NCLBUTTONUP, MSG_NCHITTEST
- */
- #define MSG_NCLBUTTONDOWN 0x0008
- /**
- * def MSG_NCLBUTTONUP
- * brief Left mouse button up message in the non-client area.
- *
- * This message is posted to the window when the user releases up
- * the left button of the mouse in the non-client area of the window.
- *
- * code
- * MSG_NCLBUTTONUP
- * int hit_code = (int)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param hit_code The hit test code which tells the area of the mouse.
- * param x_pos,y_pos The position of the mouse in window coordinates.
- *
- * sa MSG_NCLBUTTONDOWN, MSG_NCHITTEST
- */
- #define MSG_NCLBUTTONUP 0x0009
- /**
- * def MSG_NCLBUTTONDBLCLK
- * brief Left mouse button double clicked in the non-client area.
- *
- * This message is posted to the window when the user double clicks
- * the left button of the mouse in the non-client area of the window.
- *
- * code
- * MSG_NCLBUTTONDBLCLK
- * int hit_code = (int)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param hit_code The hit test code which tells the area of the mouse.
- * param x_pos,y_pos The position of the mouse in window coordinates.
- *
- * sa MSG_NCRBUTTONDBLCLK, MSG_NCHITTEST
- */
- #define MSG_NCLBUTTONDBLCLK 0x000A
- /**
- * def MSG_NCMOUSEMOVE
- * brief Mouse moves in the non-client area.
- *
- * This message is posted to the window when the user moves the mouse
- * in the non-client area of the window.
- *
- * code
- * MSG_NCMOUSEMOVE
- * int hit_code = (int)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param hit_code The hit test code which tells the area of the mouse.
- * param x_pos,y_pos The position of the mouse in window coordinates.
- *
- * sa MSG_NCHITTEST
- */
- #define MSG_NCMOUSEMOVE 0x000B
- /**
- * def MSG_NCRBUTTONDOWN
- * brief Right mouse button down message in the non-client area.
- *
- * This message is posted to the window when the user presses down
- * the right button of the mouse in the non-client area of the window.
- *
- * code
- * MSG_NCRBUTTONDOWN
- * int hit_code = (int)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param hit_code The hit test code which tells the area of the mouse.
- * param x_pos,y_pos The position of the mouse in window coordinates.
- *
- * sa MSG_NCRBUTTONUP, MSG_NCHITTEST
- */
- #define MSG_NCRBUTTONDOWN 0x000C
- /**
- * def MSG_NCRBUTTONUP
- * brief Right mouse button up message in the non-client area.
- *
- * This message is posted to the window when the user releases up
- * the right button of the mouse in the non-client area of the window.
- *
- * code
- * MSG_NCRBUTTONUP
- * int hit_code = (int)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param hit_code The hit test code which tells the area of the mouse.
- * param x_pos,y_pos The position of the mouse in window coordinates.
- *
- * sa MSG_NCRBUTTONDOWN, MSG_NCHITTEST
- */
- #define MSG_NCRBUTTONUP 0x000D
- /**
- * def MSG_NCRBUTTONDBLCLK
- * brief Right mouse button double clicked in the non-client area.
- *
- * This message is posted to the window when the user double clicks
- * the right button of the mouse in the non-client area of the window.
- *
- * code
- * MSG_NCRBUTTONDBLCLK
- * int hit_code = (int)wParam;
- * int x_pos = LOSWORD (lParam);
- * int y_pos = HISWORD (lParam);
- * endcode
- *
- * param hit_code The hit test code which tells the area of the mouse.
- * param x_pos,y_pos The position of the mouse in window coordinates.
- *
- * sa MSG_NCLBUTTONDBLCLK, MSG_NCHITTEST
- */
- #define MSG_NCRBUTTONDBLCLK 0x000E
- #define MSG_LASTMOUSEMSG 0x000F
- /** @} end of mouse_msgs */
- /**
- * defgroup key_msgs Key event messages
- * @{
- */
- /* Group 2 from 0x0010 to 0x001F, the key messages. */
- #define MSG_FIRSTKEYMSG 0x0010
- /**
- * def MSG_KEYDOWN
- * brief User presses a key down.
- *
- * This message is posted to the current active window when the user
- * presses a key down.
- *
- * code
- * MSG_KEYDOWN
- * int scancode = (int)wParam;
- * DWORD key_flags = (DWORD)lParam;
- * endcode
- *
- * param scancode The scan code of the pressed key.
- * param key_flags The shift key status when this message occurred.
- *
- * sa MSG_KEYUP, key_defs
- *
- * Example:
- *
- * include keydown.c
- */
- #define MSG_KEYDOWN 0x0010
- /**
- * def MSG_CHAR
- * brief A character translated from MSG_KEYDOWN message.
- *
- * This message is translated from a MSG_KEYDOWN message by a TranslateMessage
- * and sent to the current active window.
- *
- * code
- * MSG_CHAR
- * int ch = (int)wParam;
- * DWORD key_flags = (DWORD)lParam;
- * endcode
- *
- * param ch The ASCII code of the pressed key.
- * param key_flags The shift key status when this message occurred.
- *
- * sa MSG_SYSCHAR, TranslateMessage, key_defs
- */
- #define MSG_CHAR 0x0011
- /**
- * def MSG_KEYUP
- * brief User releases up a key.
- *
- * This message is posted to the current active window when the user
- * releases up a key.
- *
- * code
- * MSG_KEYUP
- * int scancode = (int)wParam;
- * DWORD key_flags = (DWORD)lParam;
- * endcode
- *
- * param scancode The scan code of the released key.
- * param key_flags The shift key status when this message occurred.
- *
- * sa MSG_KEYDOWN, key_defs
- */
- #define MSG_KEYUP 0x0012
- /**
- * def MSG_SYSKEYDOWN
- * brief User presses down a key when <Alt> key is down.
- *
- * This message is posted to the current active window when the user
- * presses down a key as <Alt> key is down.
- *
- * code
- * MSG_SYSKEYDOWN
- * int scancode = (int)wParam;
- * DWORD key_flags = (DWORD)lParam;
- * endcode
- *
- * param scancode The scan code of the pressed key.
- * param key_flags The shift key status when this message occurred.
- *
- * sa MSG_SYSKEYUP, MSG_SYSCHAR, key_defs
- */
- #define MSG_SYSKEYDOWN 0x0013
- /**
- * def MSG_SYSCHAR
- * brief A system character translated from MSG_SYSKEYDOWN message.
- *
- * This message is translated from a MSG_SYSKEYDOWN message by a TranslateMessage
- * and sent to the current active window.
- *
- * code
- * MSG_SYSCHAR
- * int ch = (int)wParam;
- * DWORD key_flags = (DWORD)lParam;
- * endcode
- *
- * param ch The ASCII code of the pressed key.
- * param key_flags The shift key status when this message occurred.
- *
- * sa MSG_CHAR, TranslateMessage, key_defs
- */
- #define MSG_SYSCHAR 0x0014
- /**
- * def MSG_SYSKEYUP
- * brief User releases up a key when <Alt> key is down.
- *
- * This message is posted to the current active window when the user
- * releases up a key as <Alt> key is down.
- *
- * code
- * MSG_SYSKEYUP
- * int scancode = (int)wParam;
- * DWORD key_flags = (DWORD)lParam;
- * endcode
- *
- * param scancode The scan code of the released key.
- * param key_flags The shift key status when this message occurred.
- *
- * sa MSG_SYSKEYDOWN, key_defs
- */
- #define MSG_SYSKEYUP 0x0015
- /**
- * def MSG_KEYSYM
- * brief A key symbol translated from MSG_KEYDOWN messages.
- *
- * This message is translated from a MSG_KEYDOWN message by a TranslateMessage
- * and sent to the current active window.
- *
- * Note that one translation may generate a key symbol made by more than one character,
- * e.g., when using default keymap, DEL key will generate the key symbol "^[[3~".
- *
- * code
- * MSG_KEYSYM
- * int index = HIBYTE (wParam);
- * int keysym = LOBYTE (wParam);
- * DWORD key_flags = (DWORD)lParam;
- * endcode
- *
- * param index The index of the key symbol in one translation, zero for a new translation,
- * and the a keysym is the first symbol.
- * param keysym The code of the key symbol.
- * param key_flags The shift key status when this message occurred.
- *
- * sa MSG_SYSCHAR, TranslateMessage, key_defs
- */
- #define MSG_KEYSYM 0x0016
- #define MSG_LASTKEYMSG 0x001F
- /** @} end of key_msgs */
- /**
- * defgroup post_event_msgs Post mouse/key event messages
- * @{
- */
- /* Group 3 from 0x0020 to 0x005F, the post mouse/key event messages. */
- #define MSG_FIRSTPOSTMSG 0x0020
- /**
- * def MSG_SETCURSOR
- * brief Sets cursor shape in the client area.
- *
- * This message is posted to the window under the cursor when the user moves
- * the mouse in order to give the chance to change the cursor shape.
- * The default handler set the cursor shape to the default cursor of the window.
- * If you set a new cursor shape, your message handler should return immediately.
- *
- * code
- * MSG_SETCURSOR
- * int cx = LOSWORD (lParam);
- * int cy = HISWORD (lParam);
- * endcode
- *
- * param cx,cy The client coordinates of the cursor.
- *
- * Example:
- *
- * include setcursor.c
- *
- * sa MSG_NCSETCURSOR
- */
- #define MSG_SETCURSOR 0x0020
- #define HT_UNKNOWN 0x00
- #define HT_OUT 0x01
- #define HT_MENUBAR 0x02
- #define HT_TRANSPARENT 0x03
- #define HT_BORDER_TOP 0x04
- #define HT_BORDER_BOTTOM 0x05
- #define HT_BORDER_LEFT 0x06
- #define HT_BORDER_RIGHT 0x07
- #define HT_CORNER_TL 0x08
- #define HT_CORNER_TR 0x09
- #define HT_CORNER_BL 0x0A
- #define HT_CORNER_BR 0x0B
- #define HT_CLIENT 0x0C
- #define HT_NEEDCAPTURE 0x10
- #define HT_BORDER 0x11
- #define HT_NCLIENT 0x12
- #define HT_CAPTION 0x13
- #define HT_ICON 0x14
- #define HT_CLOSEBUTTON 0x15
- #define HT_MAXBUTTON 0x16
- #define HT_MINBUTTON 0x17
- #define HT_HSCROLL 0x18
- #define HT_VSCROLL 0x19
- #define SBPOS_LEFTARROW 0x81
- #define SBPOS_RIGHTARROW 0x82
- #define SBPOS_LEFTSPACE 0x83
- #define SBPOS_RIGHTSPACE 0x84
- #define SBPOS_UPARROW 0x85
- #define SBPOS_DOWNARROW 0x86
- #define SBPOS_UPSPACE 0x87
- #define SBPOS_DOWNSPACE 0x88
- #define SBPOS_THUMB 0x89
- #define SBPOS_UNKNOWN 0x80
- #define SBPOS_MASK 0x80
- #define MSG_NCHITTEST 0x0021 /* this is an async message. */
- #define MSG_HITTEST MSG_NCHITTEST
- #define MSG_CHANGESIZE 0x0022
- #define MSG_QUERYNCRECT 0x0023
- #define MSG_QUERYCLIENTAREA 0x0024
- /**
- * def MSG_SIZECHANGING
- * brief Indicates the size of the window is being changed.
- *
- * This message is sent to the window when the size is being changed.
- * If you want to control the actual position and size of the window when
- * the size is being changed (this may be caused by a MoveWindow or other functions),
- * you should handle this message, and return the actual
- * position and size of the window through the second parameter.
- *
- * code
- * MSG_SIZECHANGING
- * const RECT* rcExpect = (const RECT*)wParam;
- * RECT* rcResult = (RECT*)lParam;
- * endcode
- *
- * param rcExpect The expected size of the window after changing.
- * param rcResult The actual size of the window after changing.
- *
- * Example:
- *
- * include msg_sizechanging.c
- */
- #define MSG_SIZECHANGING 0x0025
- /**
- * def MSG_SIZECHANGED
- * brief Indicates the size of the window has been changed.
- *
- * This message is sent to the window when the size has been changed.
- * If you want adjust the size of the client area of the window,
- * you should handle this message, change the values of the client area,
- * and return non-zero value to indicate that the client area has been modified.
- *
- * code
- * MSG_SIZECHANGED
- * RECT* rcClient = (RECT*)lParam;
- * endcode
- *
- * param rcClient The pointer to a RECT structure which contains the new client area.
- *
- * Example:
- *
- * include msg_sizechanged.c
- */
- #define MSG_SIZECHANGED 0x0026
- /**
- * def MSG_SETFOCUS
- * brief Indicates that the window has gained the input focus.
- *
- * This message is sent to the window procedure
- * after the window gains the input focus.
- */
- #define MSG_SETFOCUS 0x0030
- /**
- * def MSG_KILLFOCUS
- * brief Indicates that the window has lost the input focus.
- *
- * This message is sent to the window procedure
- * after the window lost the input focus.
- */
- #define MSG_KILLFOCUS 0x0031
- /**
- * def MSG_MOUSEACTIVE
- * brief Indicates that the window has gained the input focus because
- * the user clicked the window.
- *
- * This message is sent to the window procedure
- * after the user clicked the window and it has gained the input focus.
- */
- #define MSG_MOUSEACTIVE 0x0032
- #define MSG_ACTIVE 0x0033
- #define MSG_CHILDHIDDEN 0x0034
- #define RCTM_CLICK 1
- #define RCTM_KEY 2
- #define RCTM_MESSAGE 3
- #define RCTM_SHOWCTRL 4
- /**
- * def MSG_ACTIVEMENU
- * brief Indicates that the user activates the menu bar and tracks it.
- *
- * This message is sent to the window procedure when the user
- * activates the menu bar and tracks it.
- *
- * If you want to change the states of menu items in the submenu
- * before displaying it, you can handle this message.
- *
- * code
- * MSG_ACTIVEMENU
- * int pos = (int)wParam;
- * HMENU submenu = (HMENU)lParam;
- * endcode
- *
- * param pos The position of the activated submenu. The position value of the
- * first submenu is 0.
- * param submenu The handle to the activated submenu.
- *
- * Example:
- *
- * include activemenu.c
- */
- #define MSG_ACTIVEMENU 0x0040
- /**
- * def MSG_DEACTIVEMENU
- * brief Indicates the end of the tracking of a menu bar or a popup menu.
- *
- * This message is sent to the window procedure when the user has
- * closed the tracking menu bar or popup menu.
- *
- * code
- * MSG_DEACTIVEMENU
- * HMENU menubar = (HMENU)wParam;
- * HMENU submenu = (HMENU)lParam;
- * endcode
- *
- * param menubar The handle to the menu bar. It will be zero when the deactivated
- * menu is a popup menu.
- * param submenu The handle to the submenu.
- */
- #define MSG_DEACTIVEMENU 0x0041
- /* Scroll bar notifying code */
- #define SB_LINEUP 0x01
- #define SB_LINEDOWN 0x02
- #define SB_LINELEFT 0x03
- #define SB_LINERIGHT 0x04
- #define SB_PAGEUP 0x05
- #define SB_PAGEDOWN 0x06
- #define SB_PAGELEFT 0x07
- #define SB_PAGERIGHT 0x08
- #define SB_THUMBPOSITION 0x09
- #define SB_THUMBTRACK 0x0A
- #define SB_ENDSCROLL 0x0B
- /**
- * def MSG_HSCROLL
- * brief Indicates that the user has clicked the horizontal scroll bar.
- *
- * This message is sent to the window procedure when the user has clicked
- * the horizontal scroll bar and changed the position of the thumb.
- *
- * code
- * MSG_HSCROLL
- * int hs_nc = (int)wParam;
- * endcode
- *
- * param hs_nc The scrolling code, can be one of the following values:
- * - SB_LINELEFTn
- * The user clicked the left arrow on the bar.
- * - SB_LINERIGHTn
- * The user clicked the right arrow on the bar.
- * - SB_PAGELEFTn
- * The user clicked the left page area on the bar.
- * - SB_PAGERIGHTn
- * The user clicked the right page area on the bar.
- * - SB_THUMBPOSITIONn
- * The user set a new thumb position.
- * - SB_THUMBTRACKn
- * The user is draging and tracking the thumb.
- * - SB_ENDSCROLLn
- * The end of scrolling.
- */
- #define MSG_HSCROLL 0x0042
- /**
- * def MSG_VSCROLL
- * brief Indicates that the user has clicked the vertical scroll bar.
- *
- * This message is sent to the window procedure when the user has clicked
- * the vertical scroll bar and changed the position of the thumb.
- *
- * code
- * MSG_HSCROLL
- * int vs_nc = (int)wParam;
- * endcode
- *
- * param vs_nc The scrolling code, can be one of the following values:
- * - SB_LINEUPn
- * The user clicked the up arrow on the bar.
- * - SB_LINEDOWNn
- * The user clicked the down arrow on the bar.
- * - SB_PAGEUPn
- * The user clicked the up page area on the bar.
- * - SB_PAGEDOWNn
- * The user clicked the down page area on the bar.
- * - SB_THUMBPOSITIONn
- * The user set a new thumb position.
- * - SB_THUMBTRACKn
- * The user is draging and tracking the thumb.
- * - SB_ENDSCROLLn
- * The end of scrolling.
- */
- #define MSG_VSCROLL 0x0043
- #define MSG_NCSETCURSOR 0x0044
- /**
- * def MSG_MOUSEMOVEIN
- * brief Indicates the mouse is moved in/out the area of the window.
- *
- * This message is posted to the window when the user moves the mouse
- * in/out the area of the window.
- *
- * code
- * MSG_MOUSEMOVEIN
- * BOOL in_out = (BOOL)wParam;
- * endcode
- *
- * param in_out Indicates whether the mouse has been moved in the window
- * or out the window.
- */
- #define MSG_MOUSEMOVEIN 0x0050
- #define MSG_LASTPOSTMSG 0x005F
- /** @} end of post_event_msgs */
- /**
- * defgroup creation_msgs Window creation messages
- * @{
- */
- /* Group 4 from 0x0060 to 0x009F, the creation messages. */
- #define MSG_FIRSTCREATEMSG 0x0060
- /**
- * def MSG_CREATE
- * brief Indicates the window has been created, and gives you a chance to initialize your private objects.
- *
- * This messages is sent to the window after the window has been created and registered
- * to the system. You can initialize your own objects when you receive this message,
- * and return zero to the system in order to indicates the success of initialization.
- * If you return non-zero to the system after handled this message, the created window
- * will be destroied immediately.
- *
- * code
- * MSG_CREATE for main windows:
- * PMAINWINCREATE create_info = (PMAINWINCREATE)lParam;
- *
- * MSG_CREATE for controls:
- * HWND parent = (HWND)wParam;
- * DWORD add_data = (DWORD)lParam;
- * endcode
- *
- * param create_info The pointer to the MAINWINCREATE structure which is passed to
- * CreateMainWindow function.
- * param parent The handle to the parent window of the control.
- * param add_data The first additional data passed to CreateWindow function.
- *
- * sa CreateMainWindow, CreateWindow, MAINWINCREATE
- */
- #define MSG_CREATE 0x0060
- /**
- * def MSG_NCCREATE
- * brief Indicates the window has been created, but has not registered to the system.
- *
- * This message is sent to the window after the window has been created, but not
- * registered the system. Like MSG_CREATE message, you can initialize your own objects
- * when you receive this message, but can not create child windows of the window, and
- * can not get a device context to draw.
- *
- * If you return non-zero to the system after handled this message, the created window
- * will be destroied immediately.
- *
- * code
- * MSG_NCCREATE for main windows:
- * PMAINWINCREATE create_info = (PMAINWINCREATE)lParam;
- *
- * MSG_NCCREATE for controls:
- * DWORD add_data = (DWORD)lParam;
- * endcode
- *
- * param create_info The pointer to the MAINWINCREATE structure which is passed to
- * CreateMainWindow function.
- * param add_data The first additional data passed to CreateWindow function.
- *
- * sa CreateMainWindow, CreateWindow, MAINWINCREATE
- */
- #define MSG_NCCREATE 0x0061
- #define MSG_INITPANES 0x0062
- #define MSG_DESTROYPANES 0x0063
- /**
- * def MSG_DESTROY
- * brief Indicates the window will be destroied.
- *
- * This message is sent to the window when a DestroyMainWindow
- * or a DestroyWindow is calling. You can destroy your private objects
- * when receiving this message.
- *
- * If you return non-zero to the system after handle this message, the process
- * of a DestroyMainWindow and a DestroyWindow will return immediately.
- *
- * sa DestroyMainWindow, DestroyWindow
- */
- #define MSG_DESTROY 0x0064
- #define MSG_NCDESTROY 0x0065
- /**
- * def MSG_CLOSE
- * brief Indicates the user has clicked the closing box on the caption.
- *
- * This message is sent to the window when the user has clicked the closing box
- * on the caption of the window.
- */
- #define MSG_CLOSE 0x0066
- #define MSG_NCCALCSIZE 0x0067
- /**
- * def MSG_MAXIMIZE
- * brief Indicates the user has clicked the maximizing box on the caption.
- *
- * This message is sent to the window when the user has clicked the maximizing box
- * on the caption of the window.
- */
- #define MSG_MAXIMIZE 0x0068
- /**
- * def MSG_MINIMIZE
- * brief Indicates the user has clicked the minimizing box on the caption.
- *
- * This message is sent to the window when the user has clicked the minimizing box
- * on the caption of the window.
- */
- #define MSG_MINIMIZE 0x0069
- #define MSG_LASTCREATEMSG 0x009F
- /** @} end of creation_msgs */
- /**
- * defgroup paint_msgs Window painting messages
- * @{
- */
- /* Group 5 from 0x00A0 to 0x00CF, the paint messages. */
- #define MSG_FIRSTPAINTMSG 0x00A0
- /**
- * def MSG_SHOWWINDOW
- * brief Indicates that the window has been shown or hidden.
- *
- * This message is sent to the window when the window has been shown
- * or hidden (due to the calling of the function ShowWindow).
- *
- * code
- * MSG_SHOWWINDOW
- * int show_cmd = (int)wParam;
- * endcode
- *
- * param show_cmd The command to show or hide, can be one of
- * the following values:
- * - SW_SHOWn
- * Shows the window.
- * - SW_HIDEn
- * Hides the window.
- * - SW_SHOWNORMALn
- * Shows the window, and if the window is a main window
- * sets it to be the topmost main window.
- *
- * sa ShowWindow
- */
- #define MSG_SHOWWINDOW 0x00A0
- /**
- * def MSG_ERASEBKGND
- * brief Sent to the window to erase the background.
- *
- * This message is sent to the window if the whole or a part of the background
- * should be erased.
- *
- * code
- * MSG_ERASEBKGND
- * const RECT* inv_rect = (const RECT*)lParam;
- * endcode
- *
- * param inv_rect The pointer to a RECT structure contains the rectangle
- * should be erase. The rectangle is in client coordinates system.
- * If it is NULL, the whole client area should be erased.
- */
- #define MSG_ERASEBKGND 0x00B0 /* this is an async message. */
- /**
- * def MSG_PAINT
- * brief Sent to the window if the window contains an invalid region.
- *
- * This message is sent to the window if the window contains an invalid region.
- *
- * code
- * MSG_PAINT
- * const CLIPRGN* inv_rgn = (const CLIPRGN*) lParam;
- * endcode
- *
- * param inv_rgn The pointer to the invalid region of the window.
- */
- #define MSG_PAINT 0x00B1
- #define MSG_NCPAINT 0x00B2
- #define MSG_NCACTIVATE 0x00B3
- #define MSG_SYNCPAINT 0x00B4
- #define MSG_LASTPAINTMSG 0x00CF
- /** @} end of paint_msgs */
- /**
- * defgroup desktop_msgs Internal desktop messages
- * @{
- */
- /* Group 6 from 0x00D0 to 0x00EF, the internal desktop messages. */
- #define MSG_FIRSTSESSIONMSG 0x00D0
- #define MSG_STARTSESSION 0x00D0
- #define MSG_QUERYENDSESSION 0x00D1
- #define MSG_ENDSESSION 0x00D2
- #define MSG_REINITSESSION 0x00D3
- #if defined(_LITE_VERSION) && !defined(_STAND_ALONE)
- #define MSG_NEWCLIENT 0x00D4
- #define MSG_DELCLIENT 0x00D5
- #define MSG_TOPMOSTCHANGED 0x00D6
- #endif /* _LITE_VERSION && !_STAND_ALONE */
- #define MSG_ERASEDESKTOP 0x00E0
- #define MSG_PAINTDESKTOP 0x00E1
- #define MSG_DT_MOUSEOFF 0x00E1
- #define MSG_DT_LBUTTONDOWN 0x00E2
- #define MSG_DT_LBUTTONUP 0x00E3
- #define MSG_DT_LBUTTONDBLCLK 0x00E4
- #define MSG_DT_MOUSEMOVE 0x00E5
- #define MSG_DT_RBUTTONDOWN 0x00E6
- #define MSG_DT_RBUTTONUP 0x00E7
- #define MSG_DT_RBUTTONDBLCLK 0x00E8
- #define MSG_DT_KEYOFF 0x00DA
- #define MSG_DT_KEYDOWN 0x00EA
- #define MSG_DT_CHAR 0x00EB
- #define MSG_DT_KEYUP 0x00EC
- #define MSG_DT_SYSKEYDOWN 0x00ED
- #define MSG_DT_SYSCHAR 0x00EE
- #define MSG_DT_SYSKEYUP 0x00EF
- #define MSG_LASTSESSIONMSG 0x00EF
- /** @} end of desktop_msgs */
- /**
- * defgroup window_msgs Internal window management messages
- * @{
- */
- /* Group 7 from 0x00F0 to 0x010F, Internal window management messages. */
- #define MSG_FIRSTWINDOWMSG 0x00F0
- #define MSG_ADDNEWMAINWIN 0x00F0
- #define MSG_REMOVEMAINWIN 0x00F1
- #define MSG_MOVETOTOPMOST 0x00F2
- #define MSG_SETACTIVEMAIN 0x00F3
- #define MSG_GETACTIVEMAIN 0x00F4
- #define MSG_SHOWMAINWIN 0x00F5
- #define MSG_HIDEMAINWIN 0x00F6
- #define MSG_MOVEMAINWIN 0x00F7
- #define MSG_SETCAPTURE 0x00F8
- #define MSG_GETCAPTURE 0x00F9
- #define MSG_ENDTRACKMENU 0x00FA
- #define MSG_TRACKPOPUPMENU 0x00FB
- #define MSG_CLOSEMENU 0x00FC
- #define MSG_SCROLLMAINWIN 0x00FD
- #define MSG_CARET_CREATE 0x00FE
- #define MSG_CARET_DESTROY 0x00FF
- #define MSG_ENABLEMAINWIN 0x0100
- #define MSG_ISENABLED 0x0101
- #define MSG_SETWINCURSOR 0x0102
- #define MSG_GETNEXTMAINWIN 0x0103
- #define MSG_SHOWGLOBALCTRL 0x010A
- #define MSG_HIDEGLOBALCTRL 0x010B
- #define MSG_LASTWINDOWMSG 0x010F
- /** @} end of window_msgs */
- /**
- * defgroup ctrl_msgs Dialog and control messages
- * @{
- */
- /* Group 8 from 0x0120 to 0x013F, the dialog and control messages. */
- #define MSG_FIRSTCONTROLMSG 0x0120
- /**
- * def MSG_COMMAND
- * brief The command message, indicates a notification message from child window,
- * or the user has selected a menu item.
- *
- * This message sent to the window when the user has selected a menu item, or
- * a child window has sent a notification message to the parent.
- *
- * code
- * MSG_COMMAND
- * int id = LOWORD(wParam);
- * int code = HIWORD(wParam);
- * HWND hwnd = (HWND)lParam;
- * endcode
- *
- * param id The identifier of the menu item or the child window.
- * param code The notification code.
- * param hwnd The handle to the control.
- *
- * sa NotifyParent
- */
- #define MSG_COMMAND 0x0120
- #define MSG_SYSCOMMAND 0x0121
- #define MSG_GETDLGCODE 0x0122
- /**
- * def MSG_INITDIALOG
- * brief Ready to initialize the controls in a dialog box.
- *
- * This message is sent to the dialog in order that you can initialize the controls
- * in the dialog box.
- *
- * code
- * MSG_INITDIALOG
- * HWND focus_hwnd = (HWND)wParam;
- * LPARAM lparam = (LPARAM)lParam;
- * endcode
- *
- * param focus_hwnd The handle to the control which will gain the input focus.
- * param lparam The parameter passed into the dialog box
- * through a DialogBoxIndirectParam function.
- * return Returns non-zero value to set the input focus to a focus_hwnd, else do not set focus.
- *
- * sa DialogBoxIndirectParam
- *
- * Example:
- *
- * include msg_initdialog.c
- */
- #define MSG_INITDIALOG 0x0123
- #define MSG_NEXTDLGCTRL 0x0124
- #define MSG_ENTERIDLE 0x0125
- #define MSG_DLG_GETDEFID 0x0126
- #define MSG_DLG_SETDEFID 0x0127
- #define MSG_DLG_REPOSITION 0x0128
- /**
- * def MSG_INITPAGE
- * brief Ready to initialize the controls in a property page.
- *
- * This message is sent to the page in order that you can initialize the controls
- * in the page.
- *
- * code
- * MSG_INITPAGE
- * DWORD add_data = (DWORD)lParam;
- * endcode
- *
- * param add_data The additional data in DLGTEMPLATE structure passed
- * through PSM_ADDPAGE message.
- *
- * sa ctrl_propsheet
- */
- #define MSG_INITPAGE 0x0129
- /**
- * def MSG_SHOWPAGE
- * brief Indicates the page will be shown or hidden.
- *
- * This message is sent to the page when the page will be shown or hidden.
- *
- * code
- * MSG_SHOWPAGE
- * HWND focus_hwnd = (HWND)wParam;
- * int show_cmd = (int)lParam;
- * endcode
- *
- * param focus_hwnd The handle to the child which will gain the input focus
- * if showing the page.
- * param show_cmd The show command, can be one of the following values:
- * - SW_SHOWn The page will be shown.
- * - SW_HIDEn The page will be hidden.
- *
- * sa ctrl_propsheet
- */
- #define MSG_SHOWPAGE 0x012A
- /**
- * def MSG_SHEETCMD
- * brief Indicates that a PSM_SHEETCMD message had been sent to the PropertySheet
- * control.
- *
- * This message is sent to the property page when the property sheet contains the page
- * received the PSM_SHEETCMD message.
- *
- * code
- * MSG_SHEETCMD
- * WPARAM param1 = wParam;
- * LPARAM param2 = lParam;
- * endcode
- *
- * param param1 The wParam of PSM_SHEETCMD message.
- * param param2 The lParam of PSM_SHEETCMD message.
- *
- * sa ctrl_propsheet, PSM_SHEETCMD
- */
- #define MSG_SHEETCMD 0x012B
- /**
- * def MSG_INITCONTAINER
- * brief This message will be sent to the container window procedure after
- * the container window is created.
- *
- * This message is sent to the container in order that you can initialize the controls
- * in the container.
- *
- * code
- * MSG_INITCONTAINER
- * DWORD add_data = (DWORD)lParam;
- * endcode
- *
- * param add_data The additional data in CONTAINERINFO structure passed
- * through the argument of dwAddData when creating the ScrollView control
- * by calling CreateWindowEx.
- *
- * sa ctrl_scrollview, CONTAINERINFO
- */
- #define MSG_INITCONTAINER 0x012C
- /**
- * def MSG_SVCONTCMD
- * brief This message will be sent to the parent of the ScrollView control when
- * the container of the ScrollView control reveived a MSG_COMMAND message.
- *
- * This message will be sent to the parent of the ScrollView when
- * the container of the ScrollView control reveived a MSG_COMMAND message.
- * Generally, the notification of the child control in the container will be
- * sent via MSG_COMMAND to the container. If you have not defined your own
- * window procedure for the container, this message gives a chance for the parent
- * of the ScrollView control to handle the notifications come from the controls
- * in the container.
- *
- * Note that you can also define user window procedure for the container, and
- * handle the notification from the child control in this procedure.
- *
- * code
- * MSG_SVCONTCMD
- * WPARAM param1 = wParam;
- * WPARAM param2 = lParam;
- * endcode
- *
- * param param1 The wParam of MSG_COMMAND message.
- * param param2 The lParam of MSG_COMMAND message.
- *
- * sa ctrl_scrollview, MSG_COMMAND
- */
- #define MSG_SVCONTCMD 0x012D
- /**
- * def MSG_FREEZECTRL
- * brief You can send this message to freeze or thaw the paint action of the control.
- *
- * note implemented only in scrollview and listview.
- *
- * code
- * MSG_FREEZECTRL
- * BOOL bFrozen;
- *
- * wParam = bFrozen
- * lParam = 0;
- *
- * endcode
- *
- * param bFrozen to freeze or to thaw.
- *
- * return zero.
- */
- #define MSG_FREEZECTRL 0x012E
- /**
- * def MSG_FONTCHANGING
- * brief Indicates the user is trying to change the font of the window.
- *
- * This message is sent to the window when the user is trying to change
- * the font of the window by calling a SetWindowFont.
- * If you return non-zero after handling this message, a SetWindowFont
- * will return immediately, i.e., the default window font will not change.
- *
- * code
- * MSG_FONTCHANGING
- * PLOGFONT log_font = (PLOGFONT)lParam;
- * endcode
- *
- * param log_font The pointer to the new window logical font.
- *
- * sa SetWindowFont
- */
- #define MSG_FONTCHANGING 0x0130
- /**
- * def MSG_FONTCHANGED
- * brief Indicates the window font has been changed.
- *
- * This message is sent to the window after the window font has changed.
- * Some window should be repainted to reflect the new window font.
- */
- #define MSG_FONTCHANGED 0x0131
- /**
- * def MSG_GETTEXTLENGTH
- * brief Sent to the control to get the length of the text.
- *
- * This message is sent to the control when you calling a GetWindowTextLength
- * function to get the lenght of the text.
- *
- * code
- * MSG_GETTEXTLENGTH
- * wParam = 0;
- * lParam = 0;
- * endcode
- *
- * return The length of the text.
- *
- * sa GetWindowTextLength
- */
- #define MSG_GETTEXTLENGTH 0x0132
- /**
- * def MSG_GETTEXT
- * brief Sent to the control to get the text.
- *
- * This message is sent to the control when you calling a GetWindowText
- * function to get the text.
- *
- * code
- * MSG_GETTEXT
- * int max_len;
- * char* text_buf;
- *
- * wParam = (WPARAM)max_len;
- * lParam = (LPARAM)text_buf;
- * endcode
- *
- * param max_len The maximal number of characters can be copied to the buffer.
- * param text_buf The pointer to a buffer receives the text.
- * return The length of the window text string.
- *
- * sa GetWindowText
- */
- #define MSG_GETTEXT 0x0133
- /**
- * def MSG_SETTEXT
- * brief Sent to the control to set the text.
- *
- * This message is sent to the control when you calling a SetWindowText
- * function to set the text.
- *
- * code
- * MSG_GETTEXT
- * char* text_buf;
- *
- * wParam = 0;
- * lParam = (LPARAM)text_buf;
- * endcode
- *
- * param text_buf The pointer to a buffer contains the text.
- * return The length of the text string.
- *
- * sa SetWindowText
- */
- #define MSG_SETTEXT 0x0134
- /**
- * def MSG_ENABLE
- * brief Indicates the window is disabled/enabled.
- *
- * This message is sent to the window if the window has been disabled or enabled.
- *
- * code
- * MSG_ENABLE
- * BOOL enabled = (BOOL)wParam;
- * endcode
- *
- * param enabled Indicates whether the window was disabled or enabled.
- */
- #define MSG_ENABLE 0x0135
- #define MSG_LASTCONTROLMSG 0x013F
- /** @} end of ctrl_msgs */
- /**
- * defgroup system_msgs System messages
- * @{
- */
- /* Group 9 from 0x0140 to 0x016F, the system messages. */
- #define MSG_FIRSTSYSTEMMSG 0x0140
- #define MSG_QUIT 0x0140
- /**
- * def MSG_IDLE
- * brief Indicates the system enters idle loop.
- *
- * This message is sent to the all main window when the system
- * enters idle loop.
- */
- #define MSG_IDLE 0x0142
- #define MSG_TIMEOUT 0x0143
- /**
- * def MSG_TIMER
- * brief Indicates a timer has expired.
- *
- * This message is sent to the window when a timer expired.
- *
- * code
- * MSG_TIMER
- * int timer_id = (int)wParam;
- * endcode
- *
- * param timer_id The identifier of the timer has expired.
- */
- #define MSG_TIMER 0x0144
- #define MSG_CARETBLINK 0x0145
- #ifdef _LITE_VERSION
- /**
- * def MSG_FDEVENT
- * brief Indicates an event of registered file descriptor occurred.
- *
- * You can use a RegisterListenFD to register a file desciptor to
- * MiniGUI-Lite for listening.
- *
- * When there is a read/write/except event on the fd, MiniGUI
- * will post a MSG_FDEVENT message with wParam being equal to
- * MAKELONG (fd, type), and the lParam being set to be the context
- * to the target window.
- *
- * code
- * MSG_FDEVENT
- * int fd = LOWORD(wParam);
- * int type = HIWORD(wParam);
- * void* context = (void*)lParam;
- * endcode
- *
- * param fd The listened file descriptor.
- * param type The event type.
- * param context A context value.
- *
- * note Only available on MiniGUI-Lite.
- *
- * sa RegisterListenFD
- */
- #define MSG_FDEVENT 0x0146
- /**
- * def MSG_SRVNOTIFY
- * brief Indicates a notification from the server of MiniGUI-Lite.
- *
- * This message will be broadcasted to all of the main window
- * in a client process when the client receives a MSG_SRVNOTIFY message
- * from the server.
- *
- * The server, i.e. 'mginit' defines the meaning of two parameters of this message.
- *
- * note Only available on MiniGUI-Lite.
- */
- #define MSG_SRVNOTIFY 0x0147
- #define MSG_UNEXPOSECLIENT 0x0148
- #define MSG_ACTIVECLIENT 0x0149
- #endif
- /**
- * def MSG_DOESNEEDIME
- * brief Sends to a window to query whether the window needs to open IME window.
- *
- * The system will send this message when the window gain the input focus
- * to determine whether the window needs to open IME window.
- *
- * The application should handle this message and return TRUE when
- * the window need IME window.
- * Default window procedure returns FALSE.
- *
- * note This is a asynchronical message.
- */
- #define MSG_DOESNEEDIME 0x0150
- #define MSG_IME_REGISTER 0x0151
- #define MSG_IME_UNREGISTER 0x0152
- #define MSG_IME_OPEN 0x0153
- #define MSG_IME_CLOSE 0x0154
- #define MSG_IME_SETSTATUS 0x0156
- #define MSG_IME_GETSTATUS 0x0157
- #define IS_ENABLE 1
- #define IS_FULLCHAR 2
- #define IS_FULLPUNC 3
- #define IS_METHOD 4
- #define MSG_IME_SETTARGET 0x0158
- #define MSG_IME_GETTARGET 0x0159
- #define MSG_SHOWMENU 0x0160
- #define MSG_HIDEMENU 0x0161
- #define MSG_ADDTIMER 0x0162
- #define MSG_REMOVETIMER 0x0163
- #define MSG_RESETTIMER 0x0164
- #define MSG_WINDOWCHANGED 0x0165
- #define MSG_BROADCASTMSG 0x0166
- #define MSG_REGISTERWNDCLASS 0x0167
- #define MSG_UNREGISTERWNDCLASS 0x0168
- #define MSG_NEWCTRLINSTANCE 0x0169
- #define MSG_REMOVECTRLINSTANCE 0x016A
- #define MSG_GETCTRLCLASSINFO 0x016B
- #define MSG_CTRLCLASSDATAOP 0x016C
- #define CCDOP_GETCCI 0x01
- #define CCDOP_SETCCI 0x02
- #define MSG_REGISTERKEYHOOK 0x016D
- #define MSG_REGISTERMOUSEHOOK 0x016E
- #define MSG_LASTSYSTEMMSG 0x016F
- /** @} end of system_msgs */
- /**
- * defgroup menu_msgs Internal menu messages
- * @{
- */
- /* Group 10 from 0x0170 to 0x018F, the menu messages */
- #define MSG_FIRSTMENUMSG 0x0170
- #define MSG_INITMENU 0x0170
- #define MSG_INITMENUPOPUP 0x0171
- #define MSG_MENUSELECT 0x0172
- #define MSG_MENUCHAR 0x0173
- #define MSG_ENTERMENULOOP 0x0174
- #define MSG_EXITMENULOOP 0x0175
- #define MSG_CONTEXTMENU 0x0176
- #define MSG_NEXTMENU 0x0177
- #define MSG_LASTMENUMSG 0x018F
- /** @} end of menu_msgs */
- /**
- * defgroup user_msgs User-defined messages
- * @{
- */
- #define MSG_FIRSTUSERMSG 0x0800
- /**
- * def MSG_USER
- * brief The first user-defined message.
- *
- * MiniGUI reserved the range from 0x0800 to 0xEFFF for user-defined messages.
- * MSG_USER is the first user-defined message you can use it by your own.
- */
- #define MSG_USER 0x0800
- #define MSG_LASTUSERMSG 0xEFFF
- /** @} end of user_msgs */
- /** @} end of msgs */
- /**
- * addtogroup fns Functions
- * @{
- */
- /**
- * defgroup msg_fns Message functions
- * @{
- */
- /**
- * defgroup msg_pass_fns Message passing functions
- * @{
- */
- /**
- * The message structure.
- * sa GetMessage, PostMessage, msgs
- */
- typedef struct _MSG
- {
- /** the handle to the window which receives this message. */
- HWND hwnd;
- /** the message identifier. */
- int message;
- /** The first parameter of the message (32-bit integer). */
- WPARAM wParam;
- /** The second parameter of the message (32-bit integer). */
- LPARAM lParam;
- unsigned int time;
- #ifndef _LITE_VERSION
- void* pAdd;
- #endif
- } MSG;
- typedef MSG* PMSG;
- #define QS_NOTIFYMSG 0x10000000
- #ifndef _LITE_VERSION
- #define QS_SYNCMSG 0x20000000
- #else
- #define QS_DESKTIMER 0x20000000
- #endif
- #define QS_POSTMSG 0x40000000
- #define QS_QUIT 0x80000000
- #define QS_INPUT 0x01000000
- #define QS_PAINT 0x02000000
- #define QS_TIMER 0x0000FFFF
- #define QS_EMPTY 0x00000000
- /**
- * fn int GetMessage (PMSG pMsg, HWND hMainWnd)
- * brief Gets a message from the message queue of a main window.
- *
- * This function gets a message from the message queue of the main window a hMainWnd,
- * and returns until there is a message in the message queue.
- *
- * param pMsg Pointer to the result message.
- * param hMainWnd Handle to the window.
- * return 0 on MSG_QUIT have been found, else gets a message.
- *
- * sa HavePendingMessage, PostQuitMesasge, MSG
- *
- * Example:
- *
- * include getmessage.c
- */
- int GUIAPI GetMessage (PMSG pMsg, HWND hMainWnd);
- /**
- * fn BOOL HavePendingMessage (HWND hMainWnd)
- * brief Checks if there is any pending message in the message queue of a main window.
- *
- * This function checks whether there is any pending message in the
- * message queue of the main window a hMainWnd.
- *
- * param hMainWnd The handle to the main window.
- * return TRUE for pending message, FALSE for empty message queue.
- *
- * sa GetMessage, MSG
- */
- BOOL GUIAPI HavePendingMessage (HWND hMainWnd);
- #define PM_NOREMOVE 0x0000
- #define PM_REMOVE 0x0001
- #define PM_NOYIELD 0x0002
- BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin,
- int iMsgFilterMax, UINT uRemoveMsg);
- /**
- * fn int PostMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Posts a message into the message queue of a window and returns immediatly.
- *
- * This functions posts a message into the message queue of the window a hWnd
- * and returns immediatly.
- *
- * param hWnd The handle to the window.
- * param iMsg The identifier of the message.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- * return ERR_OK on success, < 0 on errors.
- *
- * retval ERR_OK Post message successfully.
- * retval ERR_QUEUE_FULL The message queue is full.
- * retval ERR_INV_HWND Invalid window handle.
- *
- * sa SendMessage
- */
- int GUIAPI PostMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
- /**
- * fn int SendMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Sends a message to a window.
- *
- * This function sends a message to the window a hWnd, and will return
- * until the message-handling process returns.
- *
- * param hWnd The handle to the window.
- * param iMsg The identifier of the message.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- * return The return value of the message handler.
- *
- * sa PostMessage
- */
- int GUIAPI SendMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
- /**
- * fn void GUIAPI SetAutoRepeatMessage (HWND hwnd, int msg, WPARAM wParam, LPARAM lParam)
- * brief Sets the auto-repeat message.
- *
- * This function sets the auto-repeat message. When the default message
- * procedure receives an MSG_IDLE message, the default handler will send
- * the auto-repeat message to the target window as a notification message.
- *
- * param hwnd The handle to the target window. Set it to HWND_DESKTOP
- * to disable the auto-repeat message.
- * param msg The identifier of the auto-repeat message.
- * param wParam The first parameter of the auto-repeat message.
- * param lParam The second parameter of the auto-repeat message.
- */
- void GUIAPI SetAutoRepeatMessage (HWND hwnd, int msg, WPARAM wParam, LPARAM lParam);
- #ifdef _LITE_VERSION
- /**
- * def SendAsyncMessage
- * brief Is an alias of a SendMessage for MiniGUI-Lite.
- * sa SendMessage
- */
- #define SendAsyncMessage SendMessage
- #define CLIENTS_TOPMOST -1
- #define CLIENTS_ALL -2
- #define CLIENTS_EXCEPT_TOPMOST -3
- #define CLIENT_ACTIVE -4
- /**
- * fn int Send2Client (MSG* msg, int cli)
- * brief Sends a message to a client.
- *
- * This function sends a message to the specified client a cli.
- *
- * param msg The pointer to the message.
- * param cli Either be the identifier of the targe client or one of the following values:
- * - CLIENT_ACTIVEn
- * The current active client on the topmost layer.
- * - CLIENTS_TOPMOSTn
- * All clients in the topmost layer.
- * - CLIENTS_EXCEPT_TOPMOSTn
- * All clients except clients in the topmost layer.
- * - CLIENTS_ALLn
- * All clients.
- * return SOCKERR_OK if all OK, < 0 on error.
- *
- * retval SOCKERR_OK Read data successfully.
- * retval SOCKERR_IO There are some I/O errors occurred.
- * retval SOCKERR_CLOSED The socket has been closed by the peer.
- * retval SOCKERR_INVARG You passed invalid arguments.
- *
- * note This function is only defined for MiniGUI-Lite, and
- * can be called only by the server, i.e. a mginit.
- *
- * sa Send2TopMostClients, Send2ActiveClient
- */
- int GUIAPI Send2Client (MSG* msg, int cli);
- /**
- * def send2client Send2Client
- * brief Is an alias of a Send2Client
- *
- * sa Send2Client
- */
- #define send2client Send2Client
- /**
- * fn BOOL Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Sends a message to all clients in the topmost layer.
- *
- * This function sends the message specified by (a iMsg, a wParam, a lParam)
- * to all clients in the topmost layer.
- *
- * param iMsg The message identifier.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- * return TRUE on success, FALSE on error.
- *
- * note This function is only defined for MiniGUI-Lite, and
- * can be called only by the server, i.e. a mginit.
- *
- * sa Send2Client
- */
- BOOL GUIAPI Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam);
- /**
- * fn BOOL Send2ActiveClient (int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Sends a message to the active client in the topmost layer.
- *
- * This function sends the message specified by (a iMsg, a wParam, a lParam)
- * to the current active client in the topmost layer.
- *
- * param iMsg The message identifier.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- * return TRUE on success, FALSE on error.
- *
- * note This function is only defined for MiniGUI-Lite, and
- * can be called only by the server, i.e. a mginit.
- *
- * sa Send2Client
- */
- BOOL GUIAPI Send2ActiveClient (int iMsg, WPARAM wParam, LPARAM lParam);
- #else
- /**
- * fn int PostSyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Posts a synchronical message to a window which is in different thread.
- *
- * This function posts the synchronical message specified by
- * (a iMsg, a wParam, a lParam) to the window a hWnd which
- * is in different thread. This function will return until
- * the message is handled by the window procedure.
- *
- * note The destination window must belong to other thread.
- *
- * param iMsg The message identifier.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- * return The return value of the message handler.
- *
- * sa SendMessage
- */
- int GUIAPI PostSyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
- /**
- * fn int SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Sends an asynchronical message to a window.
- *
- * This function sends the asynchronical message specified by
- * (a iMsg, a wParam, a lParam) to the window a hWnd
- * which is in different thread. This function calls
- * the window procedure immediately. So it is very dangerous.
- *
- * param iMsg The message identifier.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- * return The return value of the message handler.
- *
- * note This function may corrupt your data.
- *
- * sa PostSyncMessage
- */
- int GUIAPI SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
- #endif
- /**
- * fn int SendNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Sends a notification message to a window.
- *
- * This function sends the notification message specified by (a iMsg, a wParam, a lParam)
- * to the window a hWnd. This function puts the notication message in the message queue
- * and then returns immediately.
- *
- * param hWnd The handle to the window.
- * param iMsg The message identifier.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- * return 0 if all OK, < 0 on error.
- *
- * sa SendMessage, PostMessage
- */
- int GUIAPI SendNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
- /**
- * fn int BroadcastMessage (int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Broadcasts a message to all main window on the desktop.
- *
- * This function posts the message specified by (a iMsg, a wParam, a lParam)
- * to all the main windows on the desktop.
- *
- * param iMsg The message identifier.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- * return 0 if all OK, < 0 on error.
- *
- * sa PostMessage
- */
- int GUIAPI BroadcastMessage (int iMsg, WPARAM wParam, LPARAM lParam);
- /**
- * fn int PostQuitMessage (HWND hWnd)
- * brief Puts a MSG_QUIT message into the message queue of a main window.
- *
- * This function puts a MSG_QUIT message into the message queue of the
- * main window a hWnd. The next call to a GetMessage will return 0.
- *
- * param hWnd The handle to the main window.
- * return 0 if all OK, < 0 on error.
- *
- * sa GetMessage
- */
- int GUIAPI PostQuitMessage (HWND hWnd);
- #define KBD_LAYOUT_DEFAULT "default"
- #define KBD_LAYOUT_FRPC "frpc"
- #define KBD_LAYOUT_FR "fr"
- #define KBD_LAYOUT_DE "de"
- #define KBD_LAYOUT_DELATIN1 "delatin1"
- #define KBD_LAYOUT_IT "it"
- #define KBD_LAYOUT_ES "es"
- #define KBD_LAYOUT_ESCP850 "escp850"
- /**
- * fn BOOL SetKeyboardLayout (const char* kbd_layout)
- * brief Sets a new keyboard layout.
- *
- * This function sets the keymaps to translate key scancodes to MSG_CHAR
- * or MSG_KEYSYM messages. The default keymaps is for US PC keyboard
- * layout, you can call this function to set a different keyboard layout.
- * The argument of a kbd_layout specifies the name of the keyboard layout.
- *
- * param kbd_layout The keyboard layout name. It can be one of the following values:
- *
- * - KBD_LAYOUT_DEFAULTn
- * The default keyboard layout, i.e., US PC.
- * - KBD_LAYOUT_FRPCn
- * The France PC keyboard layout.
- * - KBD_LAYOUT_FRn
- * The France keyboard layout.
- * - KBD_LAYOUT_DEn
- * The German keyboard layout.
- * - KBD_LAYOUT_DELATIN1n
- * The German Latin1 keyboard layout.
- * - KBD_LAYOUT_ITn
- * The Italian keyboard layout.
- * - KBD_LAYOUT_ESn
- * The Spanish keyboard layout.
- * - KBD_LAYOUT_ESCP850n
- * The Spanish CP850 keyboard layout.
- *
- * return TRUE for success, otherwise FALSE.
- *
- * sa TranslateMessage, MSG_CHAR, MSG_KEYSYM
- */
- BOOL GUIAPI SetKeyboardLayout (const char* kbd_layout);
- /**
- * fn BOOL TranslateMessage (PMSG pMsg)
- * brief Translates key down and key up messages to MSG_CHAR
- * message and post it into the message queue.
- *
- * This function translates key down and key up message to an MSG_CHAR
- * message or some MSG_KEYSYM messages, and send the message(s) to
- * the window procedure as a notification message. If the message is
- * not a key message, this function does nothing.
- *
- * The behavior of this function is inflected by the current
- * keyboard layout. The default keyboard layout is US keyboard, but
- * you can call a SetKeyboardLayout function to set a different keyboard
- * layout.
- *
- * param pMsg The pointer of message.
- * return A boolean indicates whether the message is a key message.
- *
- * sa SetKeyboardLayout, MSG_CHAR, MSG_KEYSYM
- */
- BOOL GUIAPI TranslateMessage (PMSG pMsg);
- /**
- * fn int DispatchMessage (PMSG pMsg)
- * brief Dispatches a message to the window's callback procedure.
- *
- * This function dispatches the message pointed to by a pMsg to the
- * target window's callback procedure.
- *
- * param pMsg The pointer to the message.
- * return The return value of the message handler.
- *
- * sa GetMessage
- *
- * Example:
- *
- * include getmessage.c
- */
- int GUIAPI DispatchMessage (PMSG pMsg);
- /**
- * fn int ThrowAwayMessages (HWND pMainWnd)
- * brief Removes all messages in the message queue associated with a window.
- *
- * This function removes all messages which are associated with
- * the specified window a pMainWnd.
- *
- * param pMainWnd The handle to the window.
- * return The number of thrown messages.
- *
- * sa EmptyMessageQueue
- */
- int GUIAPI ThrowAwayMessages (HWND pMainWnd);
- #ifdef _LITE_VERSION
- /**
- * fn BOOL EmptyMessageQueue (HWND hWnd)
- * brief Empties a message queue.
- *
- * This function empties the message queue of the main window a hWnd.
- *
- * param hWnd The handle to the main window.
- * return TRUE on all success, FALSE on error.
- *
- * note Only defined for MiniGUI-Lite.
- *
- * sa ThrowAwayMessages
- */
- BOOL GUIAPI EmptyMessageQueue (HWND hWnd);
- #endif
- #ifdef _MSG_STRING
- /**
- * fn const char* GUIAPI Message2Str (int message)
- * brief Translates a message identifier to the message string.
- *
- * This function returns the message string of the message identifier a message.
- * E.g. this function will return the string of "MSG_CHAR" for MSG_CHAR message.
- *
- * param message The message identifier.
- * return The message string.
- *
- * note Only defined for _MSG_STRING.
- *
- * sa PrintMessage
- */
- const char* GUIAPI Message2Str (int message);
- /**
- * fn void GUIAPI PrintMessage (FILE* fp, HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam)
- * brief Prints a message in readable string form to a stdio stream.
- *
- * This function prints the message specified by (a iMsg, a wParam, a lParam)
- * in readable string form to the stdio stream a fp.
- *
- * param fp The pointer to the FILE object.
- * param hWnd The target window of the message.
- * param iMsg The message identifier.
- * param wParam The first parameter of the message.
- * param lParam The second parameter of the message.
- *
- * sa Message2Str
- */
- void GUIAPI PrintMessage (FILE* fp, HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
- #endif
- /** @} end of msg_pass_fns */
- /**
- * defgroup msg_hook_fns Message or event hook functions
- * @{
- */
- #define HOOK_GOON 0
- #define HOOK_STOP 1
- /**
- * Type of message hook function.
- */
- typedef int (* MSGHOOK)(void* context, HWND dst_wnd, int msg, WPARAM wparam, LPARAM lparam);
- /**
- * Structure defines a message hook.
- */
- typedef struct _HOOKINFO
- {
- /** the context which will be passed to the hook function. */
- void* context;
- /** the pointer to the hook function. */
- MSGHOOK hook;
- } HOOKINFO;
- /**
- * fn MSGHOOK GUIAPI RegisterKeyMsgHook (void* context, MSGHOOK hook)
- * brief Registers a key message hook.
- *
- * This function registers a key message hook pointed to by a hook.
- *
- * When the desktop receives a key message, it will send it to the hook first,
- * and passes the a context value to the hook as the first argument.
- *
- * param context The context value will be passed to the hook.
- * param hook The hook. This function will unregister the old hook if hook is NULL.
- * return The old hook.
- *
- * sa UnregisterHook, KEYMSGHOOK
- */
- MSGHOOK GUIAPI RegisterKeyMsgHook (void* context, MSGHOOK hook);
- /**
- * fn MSGHOOK GUIAPI RegisterMouseMsgHook (void* context, MSGHOOK hook)
- * brief Registers a mouse message hook.
- *
- * This function registers a mouse message hook pointed to by a hook.
- *
- * When the desktop receives a mouse message, it will send it to the hook first,
- * and passes the a context value to the hook as the first argument.
- *
- * param context The context value will be passed to the hook.
- * param hook The hook. This function will unregister the old hook if hook is NULL.
- * return The old hook.
- *
- * sa UnregisterHook, KEYMSGHOOK
- */
- MSGHOOK GUIAPI RegisterMouseMsgHook (void* context, MSGHOOK hook);
- #ifdef _LITE_VERSION
- /**
- * var typedef int (* SRVEVTHOOK) (PMSG pMsg)
- * brief The type of the event hook.
- *
- * You can call a SetServerEventHook to set an event hook
- * in the server of the MiniGUI-Lite.
- *
- * If the event hook returns HOOK_GOON, a mginit will continue to
- * handle the event, and send it to the active client.
- * If the hook returns HOOK_STOP, a mginit will cancel normal handling.
- *
- * sa SetServerEventHook
- */
- typedef int (* SRVEVTHOOK) (PMSG pMsg);
- /**
- * fn void GUIAPI SetServerEventHook (SRVEVTHOOK SrvEvtHook)
- * brief Sets an event hook in the server of MiniGUI-Lite.
- *
- * This function sets the event hook as a SrvEvtHook in the server,
- * i.e. mginit, of MiniGUI-Lite.
- *
- * param SrvEvtHook The pointer to the hook, NULL to cancel the hook.
- *
- * note Only defined for MiniGUI-Lite, and only can be used by the server.
- *
- * sa SRVEVTHOOK
- */
- SRVEVTHOOK GUIAPI SetServerEventHook (SRVEVTHOOK SrvEvtHook);
- #endif
- /** @} end of msg_hook_fns */
- /** @} end of msg_fns */
- /** @} end of fns */
- /**
- * defgroup styles Window styles
- * @{
- */
- /**
- * def WS_NONE
- * brief None style.
- */
- #define WS_NONE 0x00000000L
- #define WS_OVERLAPPED 0x00000000L
- /**
- * def WS_ABSSCRPOS
- * brief Create a main window whose position is based on absolute screen coordinates.
- */
- #define WS_ABSSCRPOS 0x80000000L
- /**
- * def WS_CHILD
- * brief Indicates the window is a child.
- */
- #define WS_CHILD 0x40000000L
- /* Clipping styles -- not supported so far */
- /**
- * def WS_VISIBLE
- * brief Creates a window initially visible.
- */
- #define WS_VISIBLE 0x08000000L
- /**
- * def WS_DISABLED
- * brief Creates a window initially disabled.
- */
- #define WS_DISABLED 0x04000000L
- /* Main window states -- not supported so far */
- #define WS_MINIMIZE 0x02000000L
- #define WS_MAXIMIZE 0x01000000L
- /**
- * def WS_CAPTION
- * brief Creates a main window with caption.
- */
- #define WS_CAPTION 0x20000000L
- /**
- * def WS_SYSMENU
- * brief Creates a main window with system menu.
- */
- #define WS_SYSMENU 0x10000000L
- #define WS_DLGFRAME 0x00800000L
- /**
- * def WS_BORDER
- * brief Creates a window with border.
- */
- #define WS_BORDER 0x00400000L
- /**
- * def WS_THICKFRAME
- * brief Creates a window with thick frame.
- */
- #define WS_THICKFRAME 0x00200000L
- /**
- * def WS_THINFRAME
- * brief Creates a window with thin frame.
- */
- #define WS_THINFRAME 0x00100000L
- /**
- * def WS_VSCROLL
- * brief Creates a window with vertical scroll bar.
- */
- #define WS_VSCROLL 0x00080000L
- /**
- * def WS_HSCROLL
- * brief Creates a window with horizontal scroll bar.
- */
- #define WS_HSCROLL 0x00040000L
- /**
- * def WS_MINIMIZEBOX
- * brief Creates a window with minimizing box on caption.
- */
- #define WS_MINIMIZEBOX 0x00020000L
- /**
- * def WS_MAXIMIZEBOX
- * brief Creates a window with maximizing box on caption.
- */
- #define WS_MAXIMIZEBOX 0x00010000L
- /**
- * def WS_GROUP
- * brief Indicates the control is the leader of a group.
- */
- #define WS_GROUP 0x00020000L
- /**
- * def WS_TABSTOP
- * brief Indicates the user can set the input focus to the control by using Tab key.
- */
- #define WS_TABSTOP 0x00010000L
- /**
- * def WS_EX_NONE
- * brief None extended window style.
- */
- #define WS_EX_NONE 0x00000000L /* supported */
- /**
- * def WS_EX_USEPRIVATECDC
- * brief The window has its own private client device context.
- *
- * sa CreatePrivateClientDC
- */
- #define WS_EX_USEPRIVATECDC 0x00000002L /* supported */
- #define WS_EX_NOPARENTNOTIFY 0x00000004L
- /**
- * def WS_EX_TOPMOST
- * brief The main window is a topmost (always on top) window.
- */
- #define WS_EX_TOPMOST 0x00000008L /* supported */
- /**
- * def WS_EX_TRANSPARENT
- * brief The window is transparent.
- * note This style is only implemented for control.
- */
- #define WS_EX_TRANSPARENT 0x00000020L
- /**
- * def WS_EX_TOOLWINDOW
- * brief The main window is a tool window, which can not gain the input focus.
- */
- #define WS_EX_TOOLWINDOW 0x00000080L /* supported */
- /**
- * def WS_EX_USEPARENTFONT
- * brief The window uses the default font of its parent.
- */
- #define WS_EX_USEPARENTFONT 0x00000100L /* supported */
- #define WS_EX_CONTEXTHELP 0x00000400L
- /**
- * def WS_EX_USEPARENTCURSOR
- * brief The window uses the default cursor of its parent.
- */
- #define WS_EX_USEPARENTCURSOR 0x00000800L /* supported */
- #define WS_EX_RIGHT 0x00001000L
- #define WS_EX_LEFT 0x00000000L
- #define WS_EX_RTLREADING 0x00002000L
- #define WS_EX_LTRREADING 0x00000000L
- #define WS_EX_LEFTSCROLLBAR 0x00004000L
- #define WS_EX_RIGHTSCROLLBAR 0x00000000L
- #define WS_EX_CONTROLPARENT 0x00010000L
- #define WS_EX_STATICEDGE 0x00020000L
- #define WS_EX_APPWINDOW 0x00040000L
- /* Obsolete style. */
- #define WS_EX_IMECOMPOSE 0x10000000L
- /**
- * def WS_EX_NOCLOSEBOX
- * brief The main window has no closing box on its caption.
- */
- #define WS_EX_NOCLOSEBOX 0x20000000L /* supported */
- /**
- * def WS_EX_CTRLASMAINWIN
- * brief The control can be displayed out of the main window which contains the control.
- */
- #define WS_EX_CTRLASMAINWIN 0x40000000L /* supported */
- /** @} end of styles */
- /**
- * addtogroup fns Functions
- * @{
- */
- /**
- * defgroup window_fns Windowing functions
- * @{
- */
- /**
- * defgroup window_create_fns Window creating/destroying
- * @{
- */
- /**
- * var typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM)
- * brief Type of the window callback procedure.
- */
- typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM);
- #define HWND_DESKTOP 0
- #define HWND_INVALID 0xFFFFFFFF
- /**
- * Structure defines a main window.
- */
- typedef struct _MAINWINCREATE
- {
- /** the style of the main window */
- DWORD dwStyle;
- /** the extended style of the main window */
- DWORD dwExStyle;
- /** the caption of the main window */
- const char* spCaption;
- /** the handle to the menu of the main window */
- HMENU hMenu;
- /** the handle to the cursor of the main window */
- HCURSOR hCursor;
- /** the handle to the icon of the main window */
- HICON hIcon;
- /** the hosting main window */
- HWND hHosting;
- /** the window callback procedure */
- int (*MainWindowProc)(HWND, int, WPARAM, LPARAM);
- /** the position of the main window in the screen coordinates */
- int lx, ty, rx, by;
- /** the pixel value of background color of the main window */
- int iBkColor;
- /** the first private data associated with the main window */
- DWORD dwAddData;
- /** reserved, do not use */
- DWORD dwReserved;
- }MAINWINCREATE;
- typedef MAINWINCREATE* PMAINWINCREATE;
- #ifndef _LITE_VERSION
- int GUIAPI CreateThreadForMainWindow(pthread_t* thread,
- pthread_attr_t* attr,
- void * (*start_routine)(void *),
- void * arg);
- pthread_t GUIAPI GetMainWinThread(HWND hMainWnd);
- int GUIAPI WaitMainWindowClose(HWND hWnd, void** returnval);
- #endif
- /**
- * fn void GUIAPI MainWindowThreadCleanup(HWND hMainWnd)
- * brief Cleans up system resource associated with a main window.
- *
- * This function cleans up the system resource such as message queue associated
- * with the main window a hMainWnd. a DestroyMainWindow does not
- * destroy all resource used by a main window, therefore, you should call
- * this function after calling a DestroyMainWindow and skipping out from
- * the message loop. After calling this function, the main window object
- * will destroied actually.
- *
- * param hMainWnd The handle to the main window.
- *
- * sa DestroyMainWindow
- */
- void GUIAPI MainWindowThreadCleanup(HWND hMainWnd);
- /**
- * def MainWindowCleanup(hwnd)
- * brief Is an alias of a MainWindowThreadCleanup
- *
- * sa MainWindowThreadCleanup
- */
- #define MainWindowCleanup(hwnd) MainWindowThreadCleanup(hwnd)
- /**
- * fn HWND GUIAPI CreateMainWindow (PMAINWINCREATE pCreateStruct)
- * brief Creates a main window.
- *
- * This function creates a main window by using information in
- * the structure pointed to by a pCreateStruct, and returns
- * the handle to the main window.
- *
- * param pCreateStruct The pointer to a MAINWINCREATE structure.
- * return The handle to the new main window; HWND_INVALID indicates an error.
- *
- * sa MAINWINCREATE, styles
- *
- * Example:
- *
- * include createmainwindow.c
- */
- HWND GUIAPI CreateMainWindow (PMAINWINCREATE pCreateStruct);
- /**
- * fn BOOL GUIAPI DestroyMainWindow (HWND hWnd)
- * brief Destroies a main window.
- *
- * This function destroies the main window specified by a hWnd.
- * It does not release all system resource used by the main window.
- * You should call a MainWindowThreadCleanup to destroy the main window
- * actually.
- *
- * param hWnd The handle to the main window.
- * return TRUE on success, FALSE on error.
- *
- * sa MainWindowThreadCleanup
- *
- * Example:
- *
- * include destroymainwindow.c
- */
- BOOL GUIAPI DestroyMainWindow (HWND hWnd);
- /**
- * fn int DefaultMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
- * brief Is the default main window callback procedure.
- *
- * This function is the default main window callback procedure.
- * You should call this function for all messages you do not want to handle
- * in your main window procedure.
- */
- int DefaultMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
- /**
- * fn int DefaultControlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
- * brief Is the default control callback procedure.
- *
- * This function is the default control callback procedure.
- * You should call this function for all messages you do not want to handle
- * in your own control procedure.
- */
- int DefaultControlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
- #ifdef _DEBUG
- void GUIAPI DumpWindow (FILE* fp, HWND hWnd);
- #endif /* _DEBUG */
- /** @} end of window_create_fns */
- /**
- * defgroup window_general_fns General window operations
- * @{
- */
- #define SW_HIDE 0x0000
- #define SW_SHOW 0x0010
- #define SW_SHOWNORMAL 0x0100
- /**
- * fn void GUIAPI UpdateWindow (HWND hWnd, BOOL bErase)
- * brief Updates a window.
- *
- * This function updates the window specified by a hWnd.
- * It will redraw the caption, the frame, and the menu bar of the window.
- * It will invalidate the client area of the window as well, and
- * if b bErase is TRUE, the client area will be erased by using background color.
- *
- * param hWnd The handle to the window.
- * param bErase Indicates whether to erase the client area of the window.
- *
- * sa InvalidateRect
- */
- void GUIAPI UpdateWindow (HWND hWnd, BOOL bErase);
- /**
- * fn BOOL GUIAPI ShowWindow (HWND hWnd, int iCmdShow)
- * brief Shows or hides a window.
- *
- * This function shows or hides the window specified by a hWnd.
- *
- * param hWnd The handle to the window.
- * param iCmdShow The command to show or hide, can be one of
- * the following values:
- * - SW_SHOWn
- * Shows the window.
- * - SW_HIDEn
- * Hides the window.
- * - SW_SHOWNORMALn
- * Shows the window, and if the window is a main window
- * sets it to be the top most main window.
- * return TRUE on sucess, otherwise FALSE.
- */
- BOOL GUIAPI ShowWindow (HWND hWnd, int iCmdShow);
- /**
- * fn BOOL GUIAPI EnableWindow (HWND hWnd, BOOL fEnable)
- * brief Enables of disables a window.
- *
- * This function enables or disables mouse and keyboard input
- * to the specified window a hWnd. When input is disabled, the window
- * does not receive input such as mouse clicks and key presses.
- * When input is enabled, the window receives all input.
- *
- * param hWnd The handle to the window.
- * param fEnable Indicates whether to enable or disable the window, TRUE for enable.
- * return The old enable state of the window.
- *
- * sa IsWindowEnabled
- */
- BOOL GUIAPI EnableWindow (HWND hWnd, BOOL fEnable);
- /**
- * fn BOOL GUIAPI IsWindowEnabled (HWND hWnd)
- * brief Determines whether the specified window is enabled for mouse and keyboard input.
- *
- * This function returns the enable/disable state of the window specified by
- * a hWnd.
- *
- * param hWnd The handle to the window.
- * return The enable/disable state of the window, TRUE for enabled.
- *
- * sa EnableWindow
- */
- BOOL GUIAPI IsWindowEnabled (HWND hWnd);
- /**
- * fn BOOL GUIAPI GetClientRect(HWND hWnd, PRECT prc)
- * brief Retrives the client rectangle of a window.
- *
- * This function retrives the coordinates of the client area of
- * the window specified by a hWnd. The client coordinates specify
- * the upper-left and lower-right corners of the client area.
- * Because client coordinates are relative to the upper-left corner of
- * a window's client area, the coordinates of the upper-left corner are always (0,0).
- *
- * param hWnd The handle to the window.
- * param prc The pointer to a RECT structure receives the client rectangle.
- * Note that the coordinates of the upper-left corner are always zero.
- *
- * return TRUE on sucess, otherwise FALSE.
- *
- * sa MoveWindow
- */
- BOOL GUIAPI GetClientRect(HWND hWnd, PRECT prc);
- /**
- * fn int GUIAPI GetWindowBkColor (HWND hWnd)
- * brief Returns the current background color of a window.
- *
- * This function returns the pixel value of the current background color of
- * the window specified by a hWnd.
- *
- * param hWnd The handle to the window.
- * return The pixel value of the background color.
- *
- * /sa SetWindowBkColor
- */
- int GUIAPI GetWindowBkColor (HWND hWnd);
- /**
- * fn int GUIAPI SetWindowBkColor (HWND hWnd, int new_bkcolor)
- * brief Sets the background color of a window.
- *
- * This function sets the background color of the specified window a hWnd
- * to be new pixel value a new_backcolor. You should call a UpdateWindow
- * or a InvalidateRect in order that the new background color runs into
- * affect.
- *
- * param hWnd The handle to the window.
- * param new_bkcolor The pixel value of the new background color.
- * return The pixel value of the old background color.
- *
- * /sa GetWindowBkColor
- */
- int GUIAPI SetWindowBkColor (HWND hWnd, int new_bkcolor);
- /**
- * fn PLOGFONT GUIAPI GetWindowFont (HWND hWnd)
- * brief Retrives the default font of a window.
- *
- * This function retrives the default font of the specified
- * window a hWnd.
- *
- * param hWnd The handle to the window.
- * return The default logical font of the window.
- *
- * /sa SetWindowFont
- */
- PLOGFONT GUIAPI GetWindowFont (HWND hWnd);
- /**
- * fn PLOGFONT GUIAPI SetWindowFont (HWND hWnd, PLOGFONT pLogFont)
- * brief Sets the default font of a window.
- *
- * This function sets the default font of the specified window a hWnd
- * to be the logical font a pLogFont. This function will send an
- * MSG_FONTCHANGING message to the window. If the handler of the message
- * returns non-zero value, this function will return immediately with the
- * unchanged default font. Or, after the new default font set, this function
- * will send an MSG_FONTCHANGED message to the window as a notification.
- *
- * param hWnd The handle to the window.
- * param pLogFont The new default logical font. If it is NULL, this function
- * will set the default font to be the system wchar font.
- * return The old default logical font of the window, NULL on error.
- *
- * sa GetWindowFont, GetSystemFont
- */
- PLOGFONT GUIAPI SetWindowFont (HWND hWnd, PLOGFONT pLogFont);
- /**
- * fn HCURSOR GUIAPI GetWindowCursor (HWND hWnd)
- * brief Retrives the current cursor of a window.
- *
- * This function retrives the current cursor of the specified
- * window a hWnd.
- *
- * param hWnd The handle to the window.
- * return The handle to the cursor.
- *
- * sa SetWindowCursor
- */
- HCURSOR GUIAPI GetWindowCursor (HWND hWnd);
- /**
- * fn HCURSOR GUIAPI SetWindowCursor (HWND hWnd, HCURSOR hNewCursor)
- * brief Sets the current cursor of a window.
- *
- * This function sets the current cursor of the specified window a hWnd with
- * argument a hNewCursor.
- *
- * param hWnd The handle to the window.
- * param hNewCursor The handle to the new cursor.
- * return The handle to the old cursor.
- *
- * sa GetWindowCursor
- */
- HCURSOR GUIAPI SetWindowCursor (HWND hWnd, HCURSOR hNewCursor);
- /**
- * fn DWORD GUIAPI GetWindowStyle (HWND hWnd)
- * brief Retrives the style of a window.
- *
- * This function retrives the style of the window specified by a hWnd.
- *
- * param hWnd The handle to the window.
- * return The style of the window.
- *
- * sa GetWindowExStyle
- */
- DWORD GUIAPI GetWindowStyle (HWND hWnd);
- /**
- * fn DWORD GUIAPI GetWindowExStyle (HWND hWnd)
- * brief Retrives the extended style of a window.
- *
- * This function retrives the extended style of the window specified by a hWnd.
- *
- * param hWnd The handle to the window.
- * return The extended style of the window.
- *
- * sa GetWindowStyle
- */
- DWORD GUIAPI GetWindowExStyle (HWND hWnd);
- BOOL GUIAPI ExcludeWindowStyle (HWND hWnd, DWORD dwStyle);
- BOOL GUIAPI IncludeWindowStyle (HWND hWnd, DWORD dwStyle);
- BOOL GUIAPI ExcludeWindowExStyle (HWND hWnd, DWORD dwStyle);
- BOOL GUIAPI IncludeWindowExStyle (HWND hWnd, DWORD dwStyle);
- /**
- * fn WNDPROC GUIAPI GetWindowCallbackProc (HWND hWnd)
- * brief Retrives the callback procedure of a window.
- *
- * This function retrives the window callback procedure of the specified window
- * a hWnd.
- *
- * param hWnd The handle to the window.
- * return The callback procedure of the window.
- *
- * sa SetWindowCallbackProc
- */
- WNDPROC GUIAPI GetWindowCallbackProc (HWND hWnd);
- /**
- * fn WNDPROC GUIAPI SetWindowCallbackProc (HWND hWnd, WNDPROC newProc)
- * brief Sets the callback procedure of a window.
- *
- * This function sets the window callback procedure of the specified window
- * a hWnd to be the procedure a newProc.
- *
- * param hWnd The handle to the window.
- * param newProc The new callback procedure of the window.
- * return The old callback procedure of the window.
- *
- * sa GetWindowCallbackProc
- *
- * Example:
- *
- * include subclass.c
- */
- WNDPROC GUIAPI SetWindowCallbackProc (HWND hWnd, WNDPROC newProc);
- /**
- * fn DWORD GUIAPI GetWindowAdditionalData (HWND hWnd)
- * brief Retrives the first additional data of a window.
- *
- * This function retrives the first additional data of the specified window
- * a hWnd.
- *
- * param hWnd The handle to the window.
- * return The first additional data of the window.
- *
- * sa SetWindowAdditionalData
- */
- DWORD GUIAPI GetWindowAdditionalData (HWND hWnd);
- /**
- * fn DWORD GUIAPI SetWindowAdditionalData (HWND hWnd, DWORD newData)
- * brief Sets the first additional data of a window.
- *
- * This function sets the first additional data of the specified window
- * a hWnd.
- *
- * param hWnd The handle to the window.
- * param newData The new first additional data of the window.
- * return The old first additional data of the window.
- *
- * note For a dialog box created by a DialogBoxIndirectParam, its second additional
- * data used internally by the system to save the return value of the box.
- * So you should avoid setting the second additional data of a dialog box.
- *
- * sa GetWindowAdditionalData
- */
- DWORD GUIAPI SetWindowAdditionalData (HWND hWnd, DWORD newData);
- /**
- * fn DWORD GUIAPI GetWindowAdditionalData2 (HWND hWnd)
- * brief Retrives the second additional data of a window.
- *
- * This function retrives the second additional data of the specified window
- * a hWnd.
- *
- * param hWnd The handle to the window.
- * return The second additional data of the window.
- *
- * sa SetWindowAdditionalData2
- */
- DWORD GUIAPI GetWindowAdditionalData2 (HWND hWnd);
- /**
- * fn DWORD GUIAPI SetWindowAdditionalData2 (HWND hWnd, DWORD newData)
- * brief Sets the second additional data of a window.
- *
- * This function sets the second additional data of the specified window
- * a hWnd.
- *
- * param hWnd The handle to the window.
- * param newData The new second additional data of the window.
- * return The old second additional data of the window.
- *
- * note For a control created by a CreateWindow, its second additional
- * data is reserved for internal use. So you should avoid setting the
- * second additional data of a control.
- *
- * sa GetWindowAdditionalData2
- */
- DWORD GUIAPI SetWindowAdditionalData2 (HWND hWnd, DWORD newData);
- /**
- * fn DWORD GUIAPI GetWindowClassAdditionalData (HWND hWnd)
- * brief Retrives the additional data of a control class.
- *
- * This function retrives the additional data of the control class to which
- * the specified control a hWnd belongs.
- *
- * param hWnd The handle to the control.
- * return The additional data of the control class to which the control belongs.
- * Note that this function always returns zero for the main window.
- *
- * sa SetWindowClassAdditionalData
- */
- DWORD GUIAPI GetWindowClassAdditionalData (HWND hWnd);
- /**
- * fn DWORD GUIAPI SetWindowClassAdditionalData (HWND hWnd, DWORD newData)
- * brief Sets the additional data of a control class.
- *
- * This function sets the additional data of the control class to which
- * the specified control a hWnd belongs.
- *
- * param hWnd The handle to the control.
- * param newData The new additional data of the control class.
- * return The old additional data of the control class.
- *
- * note This function always does nothing and returns zero for the main window.
- *
- * sa SetWindowClassAdditionalData
- */
- DWORD GUIAPI SetWindowClassAdditionalData (HWND hWnd, DWORD newData);
- /**
- * fn const char* GUIAPI GetWindowCaption (HWND hWnd)
- * brief Retrives the caption of a window.
- *
- * This function retrives the caption of the specified window a hWnd.
- *
- * param hWnd The handle to the window.
- * return The pointer to the caption string of the window.
- *
- * sa SetWindowCaption
- */
- const char* GUIAPI GetWindowCaption (HWND hWnd);
- /**
- * fn BOOL GUIAPI SetWindowCaption (HWND hWnd, const char* spCaption)
- * brief Sets the caption of a window.
- *
- * This function sets the caption of the specified window a hWnd.
- *
- * param hWnd The handle to the window.
- * param spCaption The pointer to the new caption of the window.
- * return TRUE on success, otherwise FALSE.
- *
- * sa GetWindowCaption, SetWindowText
- */
- BOOL GUIAPI SetWindowCaption (HWND hWnd, const char* spCaption);
- /**
- * fn BOOL GUIAPI InvalidateRect(HWND hWnd, const RECT* prc, BOOL bEraseBkgnd)
- * brief Makes a rectangle region in the client area of a window invalid.
- *
- * This function adds a rectangle pointed to by a prc to the specified window's
- * update region. The update region represents the portion of the window's client area
- * that must be redrawn, and erase background if argument a bReaseBkgnd is set.
- *
- * param hWnd The handle to the window.
- * param prc The pointer to a RECT structure which defines the invalid rectangle.
- * param bEraseBkgnd Indicates whether the background should be erased.
- * return TRUE on success, otherwise FALSE.
- *
- * sa MSG_PAINT
- */
- BOOL GUIAPI InvalidateRect(HWND hWnd, const RECT* prc, BOOL bEraseBkgnd);
- /**
- * fn HDC GUIAPI BeginPaint(HWND hWnd)
- * brief Prepares a window for painting.
- *
- * This function prepares the specified window a hWnd for painting.
- * This function is called in the handler of MSG_PAINT message normally.
- * It returns a device context including the update region of the window.
- * When you are done with the device context, you should call a EndPaint
- * to finish the painting of the window.
- *
- * param hWnd The handle to the window.
- * return The device context.
- *
- * sa EndPaint
- */
- HDC GUIAPI BeginPaint(HWND hWnd);
- /**
- * fn void GUIAPI EndPaint(HWND hWnd, HDC hdc)
- * brief Marks the end of painting in a window.
- *
- * This function marks the end of painting in the specified window.
- * This function is required for each call to the a BeginPaint function,
- * but only after painting is complete.
- *
- * param hWnd The handle to the window.
- * param hdc The device context returned by BeginPaint.
- *
- * sa BeginPaint
- */
- void GUIAPI EndPaint(HWND hWnd, HDC hdc);
- /**
- * fn BOOL GUIAPI GetUpdateRect (HWND hWnd, RECT* update_rect)
- * brief Retrives the bounding box of the update region of a window.
- *
- * This function retrives the bounding box of the update region of
- * the specified window a hWnd.
- *
- * param hWnd The handle to the window.
- * param update_rect The pointer to a RECT structure which will contains
- * the bounding box of the update region.
- * return TRUE on success, otherwise FALSE.
- *
- * sa InvalidateRect
- */
- BOOL GUIAPI GetUpdateRect (HWND hWnd, RECT* update_rect);
- /**
- * fn int GUIAPI ClientWidthToWindowWidth (DWORD dwStyle, int cw)
- * brief Calculates main window width from the width of the client area.
- *
- * This function calculates the main window width from the width of the client area.
- *
- * param dwStyle The style of the main window.
- * param cw The width of the client area.
- * return The width of the main window.
- *
- * sa ClientHeightToWindowHeight
- */
- int GUIAPI ClientWidthToWindowWidth (DWORD dwStyle, int cw);
- /**
- * fn int GUIAPI ClientHeightToWindowHeight (DWORD dwStyle, int ch, BOOL hasMenu)
- * brief Calculates main window height from the height of the client area.
- *
- * This function calculates the main window height from the height of
- * the client area.
- *
- * param dwStyle The style of the main window.
- * param ch The height of the client area.
- * param hasMenu Indicates whether the main window has menu.
- * return The height of the main window.
- *
- * sa ClientWidthToWindowWidth
- */
- int GUIAPI ClientHeightToWindowHeight (DWORD dwStyle, int ch, BOOL hasMenu);
- /**
- * fn void GUIAPI ClientToScreen (HWND hWnd, int* x, int* y)
- * brief Converts the client coordinates of a point to screen coordinates.
- *
- * This function converts the client coordinates of the specified point a (*x,*y)
- * in the specified window a hWnd to screen coordinates.
- *
- * param hWnd The handle to the window.
- * param x The pointer to the x coordinate.
- * param y The pointer to the y coordinate.
- *
- * sa ScreenToClient
- */
- void GUIAPI ClientToScreen (HWND hWnd, int* x, int* y);
- /**
- * fn void GUIAPI ScreenToClient (HWND hWnd, int* x, int* y)
- * brief Converts the screen coordinates of a point to client coordinates.
- *
- * This function converts the screen coordinates of the specified point a (*x,*y)
- * to client coordinates of the specified window a hWnd
- *
- * param hWnd The handle to the window.
- * param x The pointer to the x coordinate.
- * param y The pointer to the y coordinate.
- *
- * sa ClientToScreen
- */
- void GUIAPI ScreenToClient (HWND hWnd, int* x, int* y);
- /**
- * fn void GUIAPI WindowToScreen (HWND hWnd, int* x, int* y)
- * brief Converts the window coordinates of a point to screen coordinates.
- *
- * This function converts the window coordinates of the specified point a (*x,*y)
- * in the specified window a hWnd to the screen coordinates.
- *
- * param hWnd The handle to the window.
- * param x The pointer to the x coordinate.
- * param y The pointer to the y coordinate.
- *
- * sa ScreenToWindow
- */
- void GUIAPI WindowToScreen (HWND hWnd, int* x, int* y);
- /**
- * fn void GUIAPI ScreenToWindow (HWND hWnd, int* x, int* y)
- * brief Converts the screen coordinates of a point to window coordinates.
- *
- * This function converts the screen coordinates of the specified point a (*x,*y)
- * to the window coordinates of the specfied window a hWnd.
- *
- * param hWnd The handle to the window.
- * param x The pointer to the x coordinate.
- * param y The pointer to the y coordinate.
- *
- * sa WindowToScreen
- */
- void GUIAPI ScreenToWindow (HWND hWnd, int* x, int* y);
- /**
- * fn BOOL GUIAPI IsMainWindow (HWND hWnd)
- * brief Determines whether a window is a main window.
- *
- * This function determines whether the specified window a hWnd is a main window.
- *
- * param hWnd The handle to the window.
- * return TRUE for main window, otherwise FALSE.