window.h

Go to the documentation of this file.
00001 
00021 /* 
00022  * $Id: window.h 13745 2011-03-07 06:22:20Z houhuihua $
00023  *
00024  *             MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks, 
00025  *                     pSOS, ThreadX, NuCleus, OSE, and Win32.
00026  *
00027  *             Copyright (C) 2002-2009 Feynman Software.
00028  *             Copyright (C) 1998-2002 Wei Yongming.
00029  */
00030 
00031 #ifndef _MGUI_WINDOW_H
00032 #define _MGUI_WINDOW_H
00033 
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif  /* __cplusplus */
00038 
00044 /* Definitions of common messages. */
00045 #define MSG_NULLMSG         0x0000
00046 #define MSG_SYNCMSG         0x0000
00047 
00053 /* Group 1 from 0x0001 to 0x000F, the mouse messages. */
00054 #define MSG_FIRSTMOUSEMSG   0x0001
00055 
00078 #define MSG_LBUTTONDOWN     0x0001
00079 
00099 #define MSG_LBUTTONUP       0x0002
00100 
00120 #define MSG_LBUTTONDBLCLK   0x0003
00121 
00141 #define MSG_MOUSEMOVE       0x0004
00142 
00165 #define MSG_RBUTTONDOWN     0x0005
00166 
00186 #define MSG_RBUTTONUP       0x0006
00187 
00207 #define MSG_RBUTTONDBLCLK   0x0007
00208 
00209 #define MSG_NCMOUSEOFF      0x0007
00210 
00230 #define MSG_NCLBUTTONDOWN   0x0008
00231 
00251 #define MSG_NCLBUTTONUP     0x0009
00252 
00272 #define MSG_NCLBUTTONDBLCLK 0x000A
00273 
00293 #define MSG_NCMOUSEMOVE     0x000B
00294 
00314 #define MSG_NCRBUTTONDOWN   0x000C
00315 
00335 #define MSG_NCRBUTTONUP     0x000D
00336 
00356 #define MSG_NCRBUTTONDBLCLK 0x000E
00357 
00358 #define MSG_LASTMOUSEMSG    0x000F
00359 
00367 /* Group 2 from 0x0010 to 0x001F, the key messages. */
00368 #define MSG_FIRSTKEYMSG     0x0010
00369 
00392 #define MSG_KEYDOWN         0x0010
00393 
00412 #define MSG_CHAR            0x0011
00413 
00432 #define MSG_KEYUP           0x0012
00433 
00452 #define MSG_SYSKEYDOWN      0x0013
00453 
00472 #define MSG_SYSCHAR         0x0014
00473 
00492 #define MSG_SYSKEYUP        0x0015
00493 
00519 #define MSG_KEYSYM  0x0016
00520 
00521 /* keyboard longpress supported */
00522 
00530 #define MSG_KEYLONGPRESS    0x0017
00531 
00539 #define MSG_KEYALWAYSPRESS  0x0018
00540 
00547 #define DEF_LPRESS_TIME     500
00548 
00555 #define DEF_APRESS_TIME     1000
00556 
00561 #define DEF_INTERVAL_TIME   200
00562 
00563 extern unsigned int __mg_key_longpress_time;
00564 extern unsigned int __mg_key_alwayspress_time;
00565 extern unsigned int __mg_interval_time;
00566 
00571 #define SetKeyLongPressTime(time)       \
00572     do {                                \
00573         __mg_key_longpress_time = time; \
00574     } while (0)
00575 
00580 #define SetKeyAlwaysPressTime(time)     \
00581     do {                                \
00582         __mg_key_alwayspress_time = time; \
00583     } while (0)
00584 
00589 #define SetIntervalTime(time)           \
00590     do {                                \
00591         __mg_interval_time = time;      \
00592     } while (0)
00593 
00594 #define MSG_LASTKEYMSG      0x001F
00595 
00603 /* Group 3 from 0x0020 to 0x005F, User-machine Interaction messages. */
00604 #define MSG_FIRSTPOSTMSG    0x0020
00605 
00630 #define MSG_SETCURSOR       0x0020
00631     
00632     #define HT_MASK             0xFF
00633 
00634     #define HT_UNKNOWN          0x00
00635     #define HT_OUT              0x01
00636     #define HT_MENUBAR          0x02
00637     #define HT_TRANSPARENT      0x03
00638     
00639     #define HT_BORDER           0x04
00640     #define HT_CLIENT           0x0C
00641     
00642     #define HT_NEEDCAPTURE      0x10
00643     #define HT_ICON             0x14
00644     #define HT_CLOSEBUTTON      0x15
00645     #define HT_MAXBUTTON        0x16
00646     #define HT_MINBUTTON        0x17
00647     #define HT_HSCROLL          0x18
00648     #define HT_VSCROLL          0x19
00649     
00650     #define HT_DRAGGABLE        0x20
00651     #define HT_CAPTION          0x20
00652     
00653     /*indicate cursor at border */
00654     #define HT_BORDER_MASK      0x28
00655     #define HT_BORDER_TOP       0x28
00656     #define HT_BORDER_BOTTOM    0x29
00657     #define HT_BORDER_LEFT      0x2A
00658     #define HT_BORDER_RIGHT     0x2B
00659     
00660     /*indicate cursor at border corner*/
00661     #define HT_CORNER_MASK      0x2C
00662     #define HT_CORNER_TL        0x2C
00663     #define HT_CORNER_TR        0x2D
00664     #define HT_CORNER_BL        0x2E
00665     #define HT_CORNER_BR        0x2F
00666     
00667     /*new scrollbar hittest value
00668      * can be AND'ed with HT_NEEDCAPTURE*/
00669     #define HT_SB_MASK          0x50
00670 
00671     #define HT_SB_LEFTARROW     0x50
00672     #define HT_SB_RIGHTARROW    0x51
00673     #define HT_SB_LEFTSPACE     0x52
00674     #define HT_SB_RIGHTSPACE    0x53
00675     #define HT_SB_HTHUMB        0x54
00676     
00677     #define HT_SB_VMASK         0x58
00678 
00679     #define HT_SB_UPARROW       0x58
00680     #define HT_SB_DOWNARROW     0x59
00681     #define HT_SB_UPSPACE       0x5a
00682     #define HT_SB_DOWNSPACE     0x5b
00683     #define HT_SB_VTHUMB        0x5c
00684     
00685     #define HT_SB_UNKNOWN       0x5f
00686     
00687 /*user defined hittest code are 0x80 ~ 0x8F*/
00688 #define HT_USER_MASK            0x80
00689 
00690 
00696 #define MSG_NCHITTEST       0x0021      
00697 
00704 #define MSG_HITTEST         MSG_NCHITTEST
00705 
00710 #define MSG_CHANGESIZE      0x0022
00711 
00712 /* reserved */
00713 #define MSG_QUERYNCRECT     0x0023
00714 
00719 #define MSG_QUERYCLIENTAREA 0x0024
00720 
00744 #define MSG_SIZECHANGING    0x0025
00745 
00768 #define MSG_SIZECHANGED     0x0026
00769 
00786 #define MSG_CSIZECHANGED     0x0027
00787 
00798 #define MSG_SETFOCUS        0x0030
00799 
00810 #define MSG_KILLFOCUS       0x0031
00811 
00820 #define MSG_MOUSEACTIVE     0x0032
00821 
00830 #define MSG_ACTIVE          0x0033
00831 
00836 #define MSG_CHILDHIDDEN     0x0034
00837     #define RCTM_CLICK          1
00838     #define RCTM_KEY            2
00839     #define RCTM_MESSAGE        3
00840     #define RCTM_SHOWCTRL       4
00841 
00866 #define MSG_ACTIVEMENU      0x0040
00867 
00885 #define MSG_DEACTIVEMENU    0x0041
00886 
00887 /* Scroll bar notifying code */
00898 #define SB_LINEUP           0x01a
00899 
00905 #define SB_LINEDOWN         0x02
00906 
00912 #define SB_LINELEFT         0x03
00913 
00919 #define SB_LINERIGHT        0x04
00920 
00926 #define SB_PAGEUP           0x05
00927 
00933 #define SB_PAGEDOWN         0x06
00934 
00940 #define SB_PAGELEFT         0x07
00941 
00947 #define SB_PAGERIGHT        0x08
00948 
00954 #define SB_THUMBPOSITION    0x09
00955 
00961 #define SB_THUMBTRACK       0x0A
00962 
00968 #define SB_TOP              0x0B
00969 
00975 #define SB_BOTTOM           0x0C
00976 
00982 #define SB_ENDSCROLL        0x0D
00983 
01014 #define MSG_HSCROLL         0x0042
01015 
01044 #define MSG_VSCROLL         0x0043
01045 
01058 #define MSG_NCSETCURSOR     0x0044
01059 
01075 #define MSG_MOUSEMOVEIN     0x0050
01076 
01082 #define MSG_WINDOWDROPPED   0x0051
01083 
01084 #define MSG_LASTPOSTMSG     0x005F
01085 
01093     /* Group 4 from 0x0060 to 0x009F, the creation messages. */
01094 #define MSG_FIRSTCREATEMSG  0x0060
01095 
01123 #define MSG_CREATE          0x0060
01124 
01153 #define MSG_NCCREATE        0x0061
01154 
01155 /*Not use*/
01156 #define MSG_INITPANES       0x0062
01157 #define MSG_DESTROYPANES    0x0063
01158 
01172 #define MSG_DESTROY         0x0064
01173 
01174 /* Not use */
01175 #define MSG_NCDESTROY       0x0065
01176 
01184 #define MSG_CLOSE           0x0066
01185 
01186 /* Not use */
01187 #define MSG_NCCALCSIZE      0x0067
01188 
01189 /* 
01190  * Not implemented, this message is reserved for future use.
01191  *
01192  * \def MSG_MAXIMIZE
01193  * \brief Indicates the user has clicked the maximizing box on the caption.
01194  *
01195  * This message is sent to the window when the user has clicked the maximizing
01196  * box on the caption of the window.
01197  */
01198 #define MSG_MAXIMIZE        0x0068
01199 
01200 /*
01201  * Not implemented, this message is reserved for future use.
01202  *
01203  * \def MSG_MINIMIZE
01204  * \brief Indicates the user has clicked the minimizing box on the caption.
01205  *
01206  * This message is sent to the window when the user has clicked the 
01207  * minimizing box on the caption of the window.
01208  */
01209 #define MSG_MINIMIZE        0x0069
01210 
01211 /*
01212  * Not implemented, this message is reserved for future use.
01213  *
01214  * \def MSG_HELP
01215  * \brief Indicates the user has clicked the help box on the caption.
01216  *
01217  * This message is sent to the window when the user has clicked the 
01218  * help box on the caption of the window.
01219  */
01220 #define MSG_HELP            0x006A
01221 
01222 #define MSG_LASTCREATEMSG   0x009F
01223 
01231 /* Group 5 from 0x00A0 to 0x00CF, the paint messages. */
01232 #define MSG_FIRSTPAINTMSG   0x00A0
01233 
01258 #define MSG_SHOWWINDOW      0x00A0 
01259 
01278 #define MSG_ERASEBKGND          0x00B0      /* this is an async message */ 
01279 
01293 #define MSG_PAINT           0x00B1
01294 
01310 #define MSG_NCPAINT         0x00B2
01311 
01316 #define MSG_NCACTIVATE      0x00B3
01317 
01322 #define MSG_SYNCPAINT       0x00B4
01323 
01324 #define MSG_LASTPAINTMSG    0x00CF
01325 
01333 /* Group 6 from 0x00D0 to 0x00EF, the internal desktop messages. */
01334 #define MSG_FIRSTSESSIONMSG 0x00D0
01335 
01336 #define MSG_STARTSESSION    0x00D0
01337 #define MSG_QUERYENDSESSION 0x00D1
01338 #define MSG_ENDSESSION      0x00D2
01339 #define MSG_REINITSESSION   0x00D3
01340 
01341 #define MSG_ERASEDESKTOP    0x00DE
01342 #define MSG_PAINTDESKTOP    0x00DF
01343 
01344 #define MSG_DT_MOUSEOFF     0x00E0
01345 
01363 #define MSG_DT_LBUTTONDOWN  0x00E1
01364 
01382 #define MSG_DT_LBUTTONUP    0x00E2
01383 
01401 #define MSG_DT_LBUTTONDBLCLK    0x00E3
01402 
01420 #define MSG_DT_MOUSEMOVE    0x00E4
01421 
01440 #define MSG_DT_RBUTTONDOWN  0x00E5
01441 
01459 #define MSG_DT_RBUTTONUP    0x00E6
01460 
01478 #define MSG_DT_RBUTTONDBLCLK    0x00E7
01479 
01480 #define MSG_DT_KEYOFF       0x00D8 
01481 
01499 #define MSG_DT_KEYDOWN      0x00E8
01500 
01517 #define MSG_DT_KEYUP        0x00EA
01518 
01519 #define MSG_DT_SYSKEYDOWN   0x00EB
01520 
01521 #define MSG_DT_SYSKEYUP     0x00ED
01522 
01523 #define MSG_DT_SYSCHAR      0x00EC
01524 #define MSG_DT_CHAR         0x00E9
01525 
01526 #define MSG_DT_KEYLONGPRESS     0x00EE
01527 #define MSG_DT_KEYALWAYSPRESS   0x00EF
01528 
01529 #define MSG_LASTSESSIONMSG  0x00EF
01530 
01538 /* Group 7 from 0x00F0 to 0x010F, Internal window management messages. */
01539 #define MSG_FIRSTWINDOWMSG  0x00F0
01540 
01541 #define MSG_ADDNEWMAINWIN   0x00F0
01542 #define MSG_REMOVEMAINWIN   0x00F1
01543 #define MSG_MOVETOTOPMOST   0x00F2 
01544 #define MSG_SETACTIVEMAIN   0x00F3
01545 #define MSG_GETACTIVEMAIN   0x00F4
01546 #define MSG_SHOWMAINWIN     0x00F5
01547 #define MSG_HIDEMAINWIN     0x00F6
01548 #define MSG_MOVEMAINWIN     0x00F7
01549 #define MSG_SETCAPTURE      0x00F8
01550 #define MSG_GETCAPTURE      0x00F9
01551 
01552 #define MSG_ENDTRACKMENU    0x00FA
01553 #define MSG_TRACKPOPUPMENU  0x00FB
01554 #define MSG_CLOSEMENU       0x00FC
01555 #define MSG_SCROLLMAINWIN   0x00FD
01556 #define MSG_CARET_CREATE    0x00FE
01557 #define MSG_CARET_DESTROY   0x00FF
01558 
01559 #define MSG_ENABLEMAINWIN   0x0100
01560 #define MSG_ISENABLED       0x0101
01561 
01562 #define MSG_SETWINCURSOR    0x0102
01563 
01564 #define MSG_GETNEXTMAINWIN  0x0103
01565 
01566 #define MSG_SHOWGLOBALCTRL  0x010A
01567 #define MSG_HIDEGLOBALCTRL  0x010B
01568 
01569 typedef struct _DRAGINFO {
01570     int     location;
01571     int     init_x, init_y;
01572 } DRAGINFO;
01573 
01574 /* client to server; wParam: hwnd, lParam: DRAGINFO. */
01575 #define MSG_STARTDRAGWIN    0x010C
01576 /* client to server; wParam: hwnd, lParam: 0L. */
01577 #define MSG_CANCELDRAGWIN   0x010D
01578 
01579 #define MSG_CHANGECAPTION   0x010E
01580 
01581 #define MSG_LASTWINDOWMSG   0x010F
01582 
01590 /* Group 8 from 0x0120 to 0x013F, the dialog and control messages. */
01591 #define MSG_FIRSTCONTROLMSG 0x0120
01592 
01614 #define MSG_COMMAND         0x0120
01615 
01620 #define MSG_SYSCOMMAND      0x0121
01621 
01626 #define MSG_GETDLGCODE      0x0122
01627 
01654 #define MSG_INITDIALOG      0x0123
01655 
01656 /*Reserved*/
01657 #define MSG_NEXTDLGCTRL     0x0124
01658 #define MSG_ENTERIDLE       0x0125
01659 
01664 #define MSG_DLG_GETDEFID    0x0126
01665 
01670 #define MSG_DLG_SETDEFID    0x0127
01671 
01672 /* #define MSG_DLG_REPOSITION  0x0128 */
01673 
01680 #define MSG_ISDIALOG        0x0128
01681 
01699 #define MSG_INITPAGE        0x0129
01700 
01721 #define MSG_SHOWPAGE        0x012A
01722 
01742 #define MSG_SHEETCMD        0x012B
01743 
01763 #define MSG_INITCONTAINER   0x012C
01764 
01793 #define MSG_SVCONTCMD       0x012D
01794 
01813 #define MSG_FREEZECTRL      0x012E
01814 
01833 #define MSG_FONTCHANGING    0x0130
01834 
01835 
01843 #define MSG_FONTCHANGED     0x0131
01844 
01862 #define MSG_GETTEXTLENGTH   0x0132
01863 
01886 #define MSG_GETTEXT         0x0133
01887 
01908 #define MSG_SETTEXT         0x0134
01909 
01923 #define MSG_ENABLE          0x0135
01924 
01925 #define MSG_LASTCONTROLMSG  0x013F
01926 
01934 /* Group 9 from 0x0140 to 0x016F, the system messages. */
01935 #define MSG_FIRSTSYSTEMMSG  0x0140
01936 
01937 #define MSG_QUIT            0x0140
01938 
01946 #define MSG_IDLE            0x0142
01947 
01948 #define MSG_TIMEOUT         0x0143
01949 
01965 #define MSG_TIMER           0x0144
01966 
01967 #define MSG_CARETBLINK      0x0145
01968 
01969 #ifndef _MGRM_THREADS
01970 
01998 #define MSG_FDEVENT         0x0146
01999 
02013 #define MSG_SRVNOTIFY       0x0147
02014 
02015 #ifdef _MGRM_PROCESSES
02016     #define MSG_UPDATECLIWIN    0x0148
02017 #endif
02018 
02019 #endif /* !_MGRM_THREADS */
02020 
02034 #define MSG_DOESNEEDIME     0x0150
02035 
02036 /* flag code. */
02037 #define IME_STATUS_REGISTERED   0x0000
02038 #define IME_STATUS_ENABLED      0x0001
02039 #define IME_STATUS_AUTOTRACK    0x0002
02040 #define IME_STATUS_LANGUAGE     0x0003
02041     #define IME_LANGUAGE_UNKNOWN    0x0000
02042     #define IME_LANGUAGE_LATIN      0x0001
02043     #define IME_LANGUAGE_ZHCN       0x0002
02044     #define IME_LANGUAGE_ZHTW       0x0003
02045 #define IME_STATUS_ENCODING     0x0004
02046     #define IME_ENCODING_LOCAL      0x0000
02047     #define IME_ENCODING_UTF8       0x0001
02048 #define IME_STATUS_VERSION          0x0005
02049 #define IME_STATUS_USER_MIN         0x0006
02050 #define IME_STATUS_USER_MAX         0x0020
02051 
02052 /* IME edit type */
02053 #define IME_WINDOW_TYPE_NOT_EDITABLE    0x0000
02054 #define IME_WINDOW_TYPE_EDITABLE        0x0001
02055 #define IME_WINDOW_TYPE_READONLY        0x0002
02056 #define IME_WINDOW_TYPE_PASSWORD        0x0003
02057 
02058 /*Internal use*/
02059 #define MSG_IME_REGISTER    0x0151
02060 #define MSG_IME_UNREGISTER  0x0152
02061 #define MSG_IME_OPEN        0x0153
02062 #define MSG_IME_CLOSE       0x0154
02063 #define MSG_IME_SETSTATUS   0x0156
02064 #define MSG_IME_GETSTATUS   0x0157
02065 #define MSG_IME_SETTARGET   0x0158
02066 #define MSG_IME_GETTARGET   0x0159
02067 #define MSG_IME_SETPOS      0x015A
02068 #define MSG_IME_GETPOS      0x015B
02069 
02070 /*  new ime msg. */
02071 #define MSG_IME_SET_TARGET_INFO   0x015C
02072 #define MSG_IME_GET_TARGET_INFO   0x015D
02073 
02074 #define MSG_SHOWMENU        0x0160
02075 #define MSG_HIDEMENU        0x0161
02076 
02077 #define MSG_ADDTIMER        0x0162
02078 #define MSG_REMOVETIMER     0x0163
02079 #define MSG_RESETTIMER      0x0164
02080 
02081 #define MSG_WINDOWCHANGED   0x0165
02082 
02083 #define MSG_BROADCASTMSG    0x0166
02084 
02085 #define MSG_REGISTERWNDCLASS    0x0167
02086 #define MSG_UNREGISTERWNDCLASS  0x0168
02087 #define MSG_NEWCTRLINSTANCE     0x0169
02088 #define MSG_REMOVECTRLINSTANCE  0x016A
02089 #define MSG_GETCTRLCLASSINFO    0x016B
02090 #define MSG_CTRLCLASSDATAOP     0x016C
02091     #define CCDOP_GETCCI        0x01
02092     #define CCDOP_SETCCI        0x02
02093 
02094 #define MSG_REGISTERKEYHOOK     0x016D
02095 #define MSG_REGISTERMOUSEHOOK   0x016E
02096 
02097 #define MSG_LASTSYSTEMMSG   0x016F
02098 
02106 /* Group 10 from 0x0170 to 0x018F, the menu messages */
02107 #define MSG_FIRSTMENUMSG    0x0170
02108 
02109 /*Internal use*/
02110 #define MSG_INITMENU        0x0170
02111 #define MSG_INITMENUPOPUP   0x0171
02112 #define MSG_MENUSELECT      0x0172
02113 #define MSG_MENUCHAR        0x0173
02114 #define MSG_ENTERMENULOOP   0x0174
02115 #define MSG_EXITMENULOOP    0x0175
02116 #define MSG_CONTEXTMENU     0x0176
02117 #define MSG_NEXTMENU        0x0177
02118 
02119 #define MSG_LASTMENUMSG     0x018F
02120 
02128 #define MSG_FIRSTUSERMSG    0x0800
02129 
02130 
02138 #define MSG_USER            0x0800
02139 
02140 #define MSG_LASTUSERMSG     0xEFFF
02141 
02165 typedef struct _MSG
02166 {
02168     HWND             hwnd;
02170     int              message;
02172     WPARAM           wParam;
02174     LPARAM           lParam;
02176     unsigned int     time;
02177 #ifdef _MGRM_THREADS
02178 
02179     void*            pAdd;
02180 #endif
02181 } MSG;
02182 typedef MSG* PMSG;
02183 
02184 #define QS_NOTIFYMSG        0x10000000
02185 #ifdef _MGRM_THREADS
02186   #define QS_SYNCMSG        0x20000000
02187 #else
02188   #define QS_DESKTIMER      0x20000000
02189 #endif
02190 #define QS_POSTMSG          0x40000000
02191 #define QS_QUIT             0x80000000
02192 #define QS_INPUT            0x01000000
02193 #define QS_PAINT            0x02000000
02194 #define QS_TIMER            0x0000FFFF
02195 #define QS_EMPTY            0x00000000
02196 
02202 #define PM_NOREMOVE     0x0000
02203 
02209 #define PM_REMOVE       0x0001
02210 
02216 #define PM_NOYIELD      0x0002
02217 
02245 MG_EXPORT BOOL GUIAPI PeekMessageEx (PMSG pMsg, HWND hWnd, 
02246                 int iMsgFilterMin, int iMsgFilterMax, 
02247                 BOOL bWait, UINT uRemoveMsg);
02248 
02267 static inline BOOL GUIAPI GetMessage (PMSG pMsg, HWND hWnd)
02268 {
02269     return PeekMessageEx (pMsg, hWnd, 0, 0, TRUE, PM_REMOVE);
02270 }
02271 
02288 MG_EXPORT BOOL GUIAPI WaitMessage (PMSG pMsg, HWND hMainWnd);
02289 
02304 MG_EXPORT BOOL GUIAPI HavePendingMessage (HWND hMainWnd);
02305 
02332 static inline BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, 
02333                          int iMsgFilterMax, UINT uRemoveMsg)
02334 {
02335     return PeekMessageEx (pMsg, hWnd, iMsgFilterMin, iMsgFilterMax, 
02336                            FALSE, uRemoveMsg);
02337 }
02338 
02365 MG_EXPORT BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, int iMsgFilterMin, 
02366                 int iMsgFilterMax, UINT uRemoveMsg);
02367 
02389 MG_EXPORT int GUIAPI PostMessage (HWND hWnd, int iMsg, 
02390                 WPARAM wParam, LPARAM lParam);
02391 
02407 MG_EXPORT int GUIAPI SendMessage (HWND hWnd, int iMsg, 
02408                 WPARAM wParam, LPARAM lParam);
02409 
02425 MG_EXPORT void GUIAPI SetAutoRepeatMessage (HWND hwnd, int msg, 
02426                 WPARAM wParam, LPARAM lParam);
02427 
02428 #ifndef _MGRM_THREADS
02429 
02436 #define SendAsyncMessage SendMessage
02437 
02438 #ifdef _MGRM_PROCESSES
02439 
02440 #define CLIENTS_TOPMOST          -1
02441 #define CLIENTS_ALL              -2
02442 #define CLIENTS_EXCEPT_TOPMOST   -3
02443 #define CLIENT_ACTIVE            -4
02444 
02475 int GUIAPI Send2Client (MSG* msg, int cli);
02476 
02496 BOOL GUIAPI Send2TopMostClients (int iMsg, WPARAM wParam, LPARAM lParam);
02497 
02518 BOOL GUIAPI Send2ActiveWindow (const MG_Layer* layer, 
02519                  int iMsg, WPARAM wParam, LPARAM lParam);
02520 
02521 #endif /* _MGRM_PROCESSES */
02522 
02523 #else /* !_MGRM_THREADS */
02524 
02545 MG_EXPORT int GUIAPI PostSyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
02546 
02567 MG_EXPORT int GUIAPI SendAsyncMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
02568 #endif
02569 
02588 MG_EXPORT int GUIAPI SendNotifyMessage (HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
02589 
02604 MG_EXPORT int GUIAPI BroadcastMessage (int iMsg, WPARAM wParam, LPARAM lParam);
02605 
02618 MG_EXPORT int GUIAPI PostQuitMessage (HWND hWnd);
02619 
02620 #define KBD_LAYOUT_DEFAULT  "default"
02621 #define KBD_LAYOUT_FRPC     "frpc"
02622 #define KBD_LAYOUT_FR       "fr"
02623 #define KBD_LAYOUT_DE       "de"
02624 #define KBD_LAYOUT_DELATIN1 "delatin1"
02625 #define KBD_LAYOUT_IT       "it"
02626 #define KBD_LAYOUT_ES       "es"
02627 #define KBD_LAYOUT_ESCP850  "escp850"
02628 #define KBD_LAYOUT_HEBREW   "hebrew"
02629 #define KBD_LAYOUT_ARABIC   "arabic"
02630 
02668 MG_EXPORT BOOL GUIAPI SetKeyboardLayout (const char* kbd_layout);
02669 
02690 MG_EXPORT BOOL GUIAPI TranslateMessage (PMSG pMsg);
02691 
02714 MG_EXPORT BOOL GUIAPI TranslateKeyMsgToChar (int message, 
02715                 WPARAM wParam, LPARAM lParam, WORD *ch);
02716 
02733 MG_EXPORT int GUIAPI DispatchMessage (PMSG pMsg);
02734 
02747 MG_EXPORT int GUIAPI ThrowAwayMessages (HWND pMainWnd);
02748 
02749 #ifndef _MGRM_THREADS
02750 
02765 MG_EXPORT BOOL GUIAPI EmptyMessageQueue (HWND hWnd);
02766 
02767 #endif
02768 
02769 #ifdef _MGHAVE_MSG_STRING
02770 
02785 MG_EXPORT const char* GUIAPI Message2Str (int message);
02786 
02803 MG_EXPORT void GUIAPI PrintMessage (FILE* fp, HWND hWnd, 
02804                 int iMsg, WPARAM wParam, LPARAM lParam);
02805 
02806 #endif
02807 
02819 #define HOOK_GOON       0
02820 
02825 #define HOOK_STOP       1
02826 
02827 #ifndef _MGRM_PROCESSES
02828 
02835 typedef int (* MSGHOOK)(void* context, HWND dst_wnd, 
02836                 int msg, WPARAM wparam, LPARAM lparam);
02837 
02841 typedef struct _HOOKINFO
02842 {
02844     void* context;
02846     MSGHOOK hook;
02847 } HOOKINFO;
02848 
02865 MG_EXPORT MSGHOOK GUIAPI RegisterKeyMsgHook (void* context, MSGHOOK hook);
02866 
02883 MG_EXPORT MSGHOOK GUIAPI RegisterMouseMsgHook (void* context, MSGHOOK hook);
02884 
02885 #endif /* !_MGRM_PROCESSES */
02886 
02887 #ifndef _MGRM_THREADS
02888 
02902 typedef int (* SRVEVTHOOK) (PMSG pMsg);
02903 
02917 MG_EXPORT SRVEVTHOOK GUIAPI SetServerEventHook (SRVEVTHOOK SrvEvtHook);
02918 
02919 #ifdef _MGRM_PROCESSES
02920 
02942 MG_EXPORT HWND GUIAPI RegisterKeyHookWindow (HWND hwnd, DWORD flag);
02943 
02965 MG_EXPORT HWND GUIAPI RegisterMouseHookWindow (HWND hwnd, DWORD flag);
02966 
02967 #endif /* _MGRM_PROCESSES */
02968 #endif /* !_MGRM_THREADS */
02969 
02970 
02982 #define WS_CTRLMASK         0x0000FFFFL
02983 
02988 #define WS_NONE             0x00000000L
02989 
02994 #define WS_CHILD            0x40000000L
02995 
03000 #define WS_CAPTION          0x20000000L
03001 
03006 #define WS_SYSMENU          0x10000000L
03007 
03012 #define WS_VISIBLE          0x08000000L
03013 
03018 #define WS_DISABLED         0x04000000L
03019 
03020 /* Main window states -- reserved for future use. */
03021 #define WS_MINIMIZE         0x02000000L
03022 #define WS_MAXIMIZE         0x01000000L
03023 
03029 #define WS_DLGFRAME         0x00800000L
03030 
03035 #define WS_BORDER           0x00400000L
03036 
03041 #define WS_THICKFRAME       0x00200000L
03042 
03047 #define WS_THINFRAME        0x00100000L
03048 
03053 #define WS_VSCROLL          0x00080000L
03054 
03059 #define WS_HSCROLL          0x00040000L
03060 
03066 #define WS_GROUP            0x00020000L
03067 
03074 #define WS_TABSTOP          0x00010000L
03075 
03076 /*
03077  * Not implemented, reserved for future use.
03078  *
03079  * \def WS_MINIMIZEBOX
03080  * \brief Creates a window with minimizing box on caption.
03081  * \note This style is valid only for main window.
03082  */
03083 #define WS_MINIMIZEBOX      0x00020000L
03084 
03085 /*
03086  * Not implemented, reserved for future use.
03087  *
03088  * \def WS_MAXIMIZEBOX
03089  * \brief Creates a window with maximizing box on caption.
03090  * \note This style is valid only for main window.
03091  */
03092 #define WS_MAXIMIZEBOX      0x00010000L
03093 
03094 /* Obsolete styles, back-compatibility definitions. */
03095 #define WS_OVERLAPPED       0x00000000L
03096 #define WS_ABSSCRPOS        0x00000000L
03097 
03102 #define WS_EX_CONTROL_MASK      0x0000000FL
03103 
03108 #define WS_EX_INTERNAL_MASK     0xF0000000L
03109 
03114 #define WS_EX_NONE              0x00000000L
03115 
03120 #define WS_EX_TROUNDCNS         0x00000010L
03121 
03126 #define WS_EX_BROUNDCNS         0x00000020L
03127 
03134 #define WS_EX_USEPRIVATECDC     0x00000040L
03135 
03140 #define WS_EX_NOTDRAGGABLE      0x00000080L
03141 #define WS_EX_DRAGGABLE         0x00000000L
03142 
03147 #define WS_EX_USEPARENTFONT     0x00000100L
03148 
03153 #define WS_EX_USEPARENTCURSOR   0x00000200L
03154 
03159 #define WS_EX_USEPARENTRDR      0x00000400L
03160 
03167 #define WS_EX_NOPARENTNOTIFY    0x00000800L
03168 
03175 #define WS_EX_AUTOSECONDARYDC   0x00001000L
03176 
03182 #define WS_EX_TRANSPARENT       0x00002000L
03183 
03188 #define WS_EX_TOPMOST           0x00004000L
03189 
03194 #define WS_EX_TOOLWINDOW        0x00008000L
03195 
03196 /* The group reserved for BIDI support */
03197 #define WS_EX_RIGHT             0x00010000L
03198 #define WS_EX_LEFT              0x00000000L
03199 #define WS_EX_RTLREADING        0x00020000L
03200 #define WS_EX_LTRREADING        0x00000000L
03201 
03206 #define WS_EX_LEFTSCROLLBAR     0x00040000L
03207 
03212 #define WS_EX_RIGHTSCROLLBAR    0x00000000L
03213 
03218 #define WS_EX_DLGHIDE           0x00100000L
03219 
03224 #define WS_EX_NOCLOSEBOX        0x00400000L
03225 
03230 #define WS_EX_CLIPCHILDREN      0x00800000L
03231 
03236 #define WS_EX_LFRDR_MASK        0x0F000000L
03237 
03243 #define WS_EX_LFRDR_CUSTOM1     0x01000000L
03244 
03251 #define WS_EX_LFRDR_CUSTOM2     0x02000000L
03252 
03259 #define WS_EX_LFRDR_CUSTOM3     0x04000000L
03260 
03267 #define WS_EX_LFRDR_CUSTOM4     0x08000000L
03268 
03269 /* Obsolete style, back-compatibility definitions. */
03270 #define WS_EX_IMECOMPOSE        0x00000000L
03271 
03288 #define WE_FONTS_NUMBER             4 
03289 
03294 #define WE_METRICS_NUMBER           6
03295 
03300 #define WE_COLORS_NUMBER            14
03301 
03302 /* Window type mask */
03303 #define WE_ATTR_TYPE_MASK           0xF000
03304 #define WE_ATTR_TYPE_COLOR_MASK     0x0F00
03305 #define WE_ATTR_INDEX_MASK          0x00FF
03306 
03307 #define WE_ATTR_TYPE_FONT           0x1000
03308 #define WE_ATTR_TYPE_METRICS        0x2000
03309 
03310 #define WE_ATTR_TYPE_COLOR          0x3000  
03311 #define WE_ATTR_TYPE_FGC            0x3000
03312 #define WE_ATTR_TYPE_BGCA           0x3100
03313 #define WE_ATTR_TYPE_BGCB           0x3200
03314 
03315 /* window element id */
03316 #define WE_CAPTION                  0  
03317 #define WE_MENU                     1
03318 #define WE_MESSAGEBOX               2
03319 #define WE_TOOLTIP                  3
03320 #define WE_WND_BORDER               4
03321 #define WE_SCROLLBAR                5
03322 #define WE_INACTIVE_CAPTION         6
03323 #define WE_WINDOW                   7
03324 #define WE_THREED_BODY              8
03325 #define WE_SELECTED_ITEM            9
03326 #define WE_DISABLED_ITEM            10
03327 #define WE_HIGHLIGHT_ITEM           11
03328 #define WE_SIGNIFICANT_ITEM         12
03329 #define WE_DESKTOP                  13
03330 
03331 /* window element attr id */
03332 
03333 /* Window caption */
03334 #define WE_FONT_CAPTION             (WE_CAPTION | WE_ATTR_TYPE_FONT)
03335 #define WE_METRICS_CAPTION          (WE_CAPTION | WE_ATTR_TYPE_METRICS)
03336 #define WE_FGC_ACTIVE_CAPTION       (WE_CAPTION | WE_ATTR_TYPE_FGC)
03337 #define WE_BGCA_ACTIVE_CAPTION      (WE_CAPTION | WE_ATTR_TYPE_BGCA)
03338 #define WE_BGCB_ACTIVE_CAPTION      (WE_CAPTION | WE_ATTR_TYPE_BGCB)
03339 
03340 /* Menu */
03341 #define WE_FONT_MENU                (WE_MENU | WE_ATTR_TYPE_FONT)
03342 #define WE_METRICS_MENU             (WE_MENU | WE_ATTR_TYPE_METRICS)
03343 #define WE_FGC_MENU                 (WE_MENU | WE_ATTR_TYPE_FGC)
03344 #define WE_BGC_MENU                 (WE_MENU | WE_ATTR_TYPE_BGCA)
03345 
03346 /* Message box */
03347 #define WE_FONT_MESSAGEBOX          (WE_MESSAGEBOX | WE_ATTR_TYPE_FONT)
03348 #define WE_FGC_MESSAGEBOX           (WE_MESSAGEBOX | WE_ATTR_TYPE_FGC)
03349 
03350 /* Tool tips */
03351 #define WE_FONT_TOOLTIP             (WE_TOOLTIP | WE_ATTR_TYPE_FONT)
03352 #define WE_FGC_TOOLTIP              (WE_TOOLTIP | WE_ATTR_TYPE_FGC)
03353 #define WE_BGC_TOOLTIP              (WE_TOOLTIP | WE_ATTR_TYPE_BGCA)
03354 
03355 /* Window border */
03356 #define WE_METRICS_WND_BORDER       (WE_WND_BORDER | WE_ATTR_TYPE_METRICS)
03357 #define WE_FGC_ACTIVE_WND_BORDER    (WE_WND_BORDER | WE_ATTR_TYPE_FGC)
03358 #define WE_FGC_INACTIVE_WND_BORDER  (WE_WND_BORDER | WE_ATTR_TYPE_BGCA)
03359 
03360 /* Scroll bar */
03361 #define WE_METRICS_SCROLLBAR        (WE_SCROLLBAR | WE_ATTR_TYPE_METRICS)
03362 
03363 /* Inactive caption */
03364 #define WE_FGC_INACTIVE_CAPTION     (WE_INACTIVE_CAPTION | WE_ATTR_TYPE_FGC)
03365 #define WE_BGCA_INACTIVE_CAPTION    (WE_INACTIVE_CAPTION | WE_ATTR_TYPE_BGCA)
03366 #define WE_BGCB_INACTIVE_CAPTION    (WE_INACTIVE_CAPTION | WE_ATTR_TYPE_BGCB)
03367 
03368 /* Window */
03369 #define WE_FGC_WINDOW               (WE_WINDOW | WE_ATTR_TYPE_FGC)
03370 #define WE_BGC_WINDOW               (WE_WINDOW | WE_ATTR_TYPE_BGCA)
03371 
03372 /* 3d body */
03373 #define WE_FGC_THREED_BODY          (WE_THREED_BODY | WE_ATTR_TYPE_FGC)
03374 #define WE_MAINC_THREED_BODY        (WE_THREED_BODY | WE_ATTR_TYPE_BGCA)
03375 
03376 /* Selected items */
03377 #define WE_FGC_SELECTED_ITEM        (WE_SELECTED_ITEM | WE_ATTR_TYPE_FGC)
03378 #define WE_BGC_SELECTED_ITEM        (WE_SELECTED_ITEM | WE_ATTR_TYPE_BGCA)
03379 #define WE_BGC_SELECTED_LOSTFOCUS   (WE_SELECTED_ITEM | WE_ATTR_TYPE_BGCB)
03380 
03381 /* Invalidate items */
03382 #define WE_FGC_DISABLED_ITEM        (WE_DISABLED_ITEM | WE_ATTR_TYPE_FGC)
03383 #define WE_BGC_DISABLED_ITEM        (WE_DISABLED_ITEM | WE_ATTR_TYPE_BGCA)
03384 
03385 /* Highlight items */
03386 #define WE_FGC_HIGHLIGHT_ITEM       (WE_HIGHLIGHT_ITEM | WE_ATTR_TYPE_FGC)
03387 #define WE_BGC_HIGHLIGHT_ITEM       (WE_HIGHLIGHT_ITEM | WE_ATTR_TYPE_BGCA)
03388 
03389 /* Significant items */
03390 #define WE_FGC_SIGNIFICANT_ITEM     (WE_SIGNIFICANT_ITEM | WE_ATTR_TYPE_FGC)
03391 #define WE_BGC_SIGNIFICANT_ITEM     (WE_SIGNIFICANT_ITEM | WE_ATTR_TYPE_BGCA)
03392 
03393 /* Desktop */
03394 #define WE_BGC_DESKTOP              (WE_DESKTOP | WE_ATTR_TYPE_BGCA)
03395 
03396 #define WE_ATTR_TYPE_ICON           0x4000  
03397 #define WE_ATTR_TYPE_ICON_MASK      0x0F00
03398 #define WE_ATTR_TYPE_SMALLICON      0x4000
03399 #define WE_ATTR_TYPE_LARGEICON      0x4100
03400 
03401 #define WE_LARGEICON_APPLICATION    (WE_ATTR_TYPE_LARGEICON | 0x00)
03402 #define WE_LARGEICON_HAND           (WE_ATTR_TYPE_LARGEICON | 0x01)
03403 #define WE_LARGEICON_QUESTION       (WE_ATTR_TYPE_LARGEICON | 0x02)
03404 #define WE_LARGEICON_EXCLAMATION    (WE_ATTR_TYPE_LARGEICON | 0x03)
03405 #define WE_LARGEICON_ASTERISK       (WE_ATTR_TYPE_LARGEICON | 0x04)
03406 #define WE_LARGEICON_STOP           WE_LARGEICON_HAND
03407 #define WE_LARGEICON_INFORMATION    WE_LARGEICON_ASTERISK
03408 
03409 #define WE_SMALLICON_APPLICATION    (WE_ATTR_TYPE_SMALLICON | 0x00)
03410 #define WE_SMALLICON_HAND           (WE_ATTR_TYPE_SMALLICON | 0x01)
03411 #define WE_SMALLICON_QUESTION       (WE_ATTR_TYPE_SMALLICON | 0x02)
03412 #define WE_SMALLICON_EXCLAMATION    (WE_ATTR_TYPE_SMALLICON | 0x03)
03413 #define WE_SMALLICON_ASTERISK       (WE_ATTR_TYPE_SMALLICON | 0x04)
03414 #define WE_SMALLICON_STOP           WE_SMALLICON_HAND
03415 #define WE_SMALLICON_INFORMATION    WE_SMALLICON_ASTERISK
03416 
03421 #define WE_ATTR_TYPE_RDR                0x5000 
03422 
03423 #define WE_LFFLAT_NUMBER                1
03424 #ifdef _MGLF_RDR_FLAT
03425 
03426 #define WE_LFFLAT_TAB_NRMLCLR           (WE_ATTR_TYPE_RDR | 0)
03427 #endif
03428 
03429 #define WE_LFSKIN_NUMBER                28
03430 #ifdef _MGLF_RDR_SKIN
03431 #define WE_LFSKIN_WND_BKGND             (WE_ATTR_TYPE_RDR | 0)
03432 
03433 #define WE_LFSKIN_CAPTION               (WE_ATTR_TYPE_RDR | 1)
03434 #define WE_LFSKIN_CAPTION_BTN           (WE_ATTR_TYPE_RDR | 2)
03435 
03436 #define WE_LFSKIN_SCROLLBAR_VSHAFT      (WE_ATTR_TYPE_RDR | 3)
03437 #define WE_LFSKIN_SCROLLBAR_VTHUMB      (WE_ATTR_TYPE_RDR | 4)
03438 #define WE_LFSKIN_SCROLLBAR_HSHAFT      (WE_ATTR_TYPE_RDR | 5)
03439 #define WE_LFSKIN_SCROLLBAR_HTHUMB      (WE_ATTR_TYPE_RDR | 6)
03440 #define WE_LFSKIN_SCROLLBAR_ARROWS      (WE_ATTR_TYPE_RDR | 7)
03441 
03442 #define WE_LFSKIN_BORDER_TOP            (WE_ATTR_TYPE_RDR | 8)
03443 #define WE_LFSKIN_BORDER_BOTTOM         (WE_ATTR_TYPE_RDR | 9)
03444 #define WE_LFSKIN_BORDER_LEFT           (WE_ATTR_TYPE_RDR | 10)
03445 #define WE_LFSKIN_BORDER_RIGHT          (WE_ATTR_TYPE_RDR | 11)
03446 
03447 #define WE_LFSKIN_ARROWS                (WE_ATTR_TYPE_RDR | 12)
03448 #define WE_LFSKIN_ARROWS_SHELL          (WE_ATTR_TYPE_RDR | 13)
03449 
03450 #define WE_LFSKIN_RADIOBUTTON           (WE_ATTR_TYPE_RDR | 14)
03451 #define WE_LFSKIN_CHECKBUTTON           (WE_ATTR_TYPE_RDR | 15)
03452 #define WE_LFSKIN_PUSHBUTTON            (WE_ATTR_TYPE_RDR | 16)
03453 
03454 #define WE_LFSKIN_TREE                  (WE_ATTR_TYPE_RDR | 17)
03455 
03456 #define WE_LFSKIN_HEADER                (WE_ATTR_TYPE_RDR | 18)
03457 #define WE_LFSKIN_TAB                   (WE_ATTR_TYPE_RDR | 19)
03458 
03459 #define WE_LFSKIN_PROGRESS_HCHUNK       (WE_ATTR_TYPE_RDR | 20)
03460 #define WE_LFSKIN_PROGRESS_VCHUNK       (WE_ATTR_TYPE_RDR | 21)
03461 #define WE_LFSKIN_PROGRESS_HTRACKBAR    (WE_ATTR_TYPE_RDR | 22)
03462 #define WE_LFSKIN_PROGRESS_VTRACKBAR    (WE_ATTR_TYPE_RDR | 23)
03463 
03464 #define WE_LFSKIN_TBSLIDER_H            (WE_ATTR_TYPE_RDR | 24)
03465 #define WE_LFSKIN_TRACKBAR_VERT         (WE_ATTR_TYPE_RDR | 25)
03466 #define WE_LFSKIN_TRACKBAR_HORZ         (WE_ATTR_TYPE_RDR | 26)
03467 #define WE_LFSKIN_TBSLIDER_V            (WE_ATTR_TYPE_RDR | 27)
03468 #endif
03469 
03471 typedef struct _WINDOW_ELEMENT_ATTR {
03473     int we_attr_id;
03475     DWORD we_attr;
03476 } WINDOW_ELEMENT_ATTR;
03477 
03478 struct _WINDOW_ELEMENT_RENDERER;
03479 typedef struct _WINDOW_ELEMENT_RENDERER* PWERENDERER;
03480 
03481 #define SBS_NORMAL                  0x00
03482 #define SBS_DISABLED                0x01
03483 #define SBS_HIDE                    0x02
03484 
03488 typedef struct _LFSCROLLBARINFO {
03490     int  minPos;       
03492     int  maxPos; 
03494     int  curPos;       
03496     int  pageStep;      
03498     int  arrowLen;      
03500     int  barStart;     
03502     int  barLen;     
03504     int status;        
03505 } LFSCROLLBARINFO;
03506 
03507 typedef LFSCROLLBARINFO* PLFSCROLLBARINFO;
03508 
03512 typedef struct _SCROLLBARDATA {
03514     int  minPos;
03516     int  maxPos;
03518     int  curPos;
03520     int  pageStep;
03522     int  arrowLen;
03524     int  barStart;
03526     int  barLen;       
03527     /* mouse position before tracking thumb.
03528      * it represents the distance from x mouse postion to barStart 
03529      * for horizontal scrollbar.
03530      * it represents the distance from y mouse postion to barStart 
03531      * for vertical  scrollbar.
03532      */
03533     int  track_pos;
03535     int status;
03536 } SCROLLBARDATA;
03537 
03538 typedef SCROLLBARDATA* PSCROLLBARDATA;
03539 
03541 #define SBS_DISABLED_LTUP       0x0100
03542 
03544 #define SBS_DISABLED_BTDN       0x0200
03545 
03547 #define SBS_HILITE_LTUP         0x0400
03548 
03550 #define SBS_HILITE_BTDN         0x0800
03551 
03553 #define SBS_HILITE_THUMB        0x0010
03554 
03556 #define SBS_PRESSED_LTUP        0x0020
03557 
03559 #define SBS_PRESSED_BTDN        0x0040
03560 
03562 #define SBS_PRESSED_THUMB       0x0080
03563 
03564 
03565 #define LFRDR_WINTYPE_UNKNOWN           0
03566 #define LFRDR_WINTYPE_DIALOG            1
03567 #define LFRDR_WINTYPE_MAINWIN           2
03568 #define LFRDR_WINTYPE_CONTROL           3
03569 
03573 typedef struct _LFRDR_WINSTYLEINFO
03574 {
03576     int         dwStyle; 
03577 
03586     int         winType; 
03587 } LFRDR_WINSTYLEINFO;
03588 
03594 typedef struct _LFRDR_TRACKBARINFO
03595 {   
03596     int nMin;                  
03597     int nMax;                  
03598     int nPos;
03599     int nTickFreq;                                
03600 }LFRDR_TRACKBARINFO;
03601 
03602 #define LFRDR_METRICS_MASK              0xFF00
03603 #define LFRDR_METRICS_BORDER            0x0100
03604 #define LFRDR_METRICS_CAPTION_H         0x0200
03605 #define LFRDR_METRICS_ICON_H            0x0300
03606 #define LFRDR_METRICS_ICON_W            0x0400
03607 #define LFRDR_METRICS_MENU_H            0x0500
03608 #define LFRDR_METRICS_VSCROLL_W         0x0600
03609 #define LFRDR_METRICS_HSCROLL_H         0x0700
03610 #define LFRDR_METRICS_MINWIN_WIDTH      0x0800
03611 #define LFRDR_METRICS_MINWIN_HEIGHT     0x0900
03612 
03613 #define LFRDR_SB_MINBARLEN        10
03614 
03619 #define LEN_RENDERER_NAME           15
03620 
03621 /* button status used by button and 3dbox.  */
03622 #define LFRDR_BTN_STATUS_MASK       0x03
03623 #define LFRDR_BTN_STATUS_NORMAL     0x00
03624 #define LFRDR_BTN_STATUS_HILITE     0x01
03625 #define LFRDR_BTN_STATUS_PRESSED    0x02
03626 #define LFRDR_BTN_STATUS_DISABLED   0x03
03627  
03628 /* a flag used by radio button and check button. */
03629 #define LFRDR_BTN_STATUS_SELECTED   0x04
03630 
03631 /* a flag used by button on capton bar. */
03632 #define LFRDR_BTN_STATUS_INACTIVE   0x08
03633  
03634 /* thick or thin frame used by 3dbox. */
03635 #define LFRDR_3DBOX_THICKFRAME      0x20
03636  
03637 /* filled 3dbox */
03638 #define LFRDR_3DBOX_FILLED          0x40
03639  
03640 /*select status used by checkmark or radio.*/
03641 #define LFRDR_MARK_SELECTED_MASK    0x05
03642 #define LFRDR_MARK_ALL_SELECTED     0x01
03643 #define LFRDR_MARK_HALF_SELECTED    0x04
03644  
03645 /* a flag whether a checkmark or radio has a shell or not.*/
03646 #define LFRDR_MARK_HAVESHELL        0x02
03647  
03648 /*the direction of arrow.*/
03649 #define LFRDR_ARROW_DIRECT_MASK     0x0F00
03650 #define LFRDR_ARROW_LEFT            0x0000
03651 #define LFRDR_ARROW_RIGHT           0x0100
03652 #define LFRDR_ARROW_UP              0x0200
03653 #define LFRDR_ARROW_DOWN            0x0300
03654 
03655 /* hollow arrow or filled */
03656 #define LFRDR_ARROW_NOFILL          0x1000
03657 #define LFRDR_ARROW_HAVESHELL       0x2000
03658 
03659 /* minimum of menu margin */
03660 #define LFRDR_MENUITEMOFFY_MIN      4
03661 
03662 #define LFRDR_3DBOX_COLOR_LIGHTEST  0x01
03663 #define LFRDR_3DBOX_COLOR_DARKEST   0x02
03664 #define LFRDR_3DBOX_COLOR_LIGHTER   0x03
03665 #define LFRDR_3DBOX_COLOR_DARKER    0x04
03666 
03667 /* flag of propsheet tab */
03668 #define LFRDR_TAB_BOTTOM            0x0001
03669 #define LFRDR_TAB_ACTIVE            0x0010
03670 #define LFRDR_TAB_ICON              0x0100
03671 
03672 /* for fold icon*/
03673 #define LFRDR_TREE_WITHICON         0x08
03674 #define LFRDR_TREE_FOLD             0x01
03675 
03676 /* for connecting line*/
03677 #define LFRDR_TREE_CHILD            0x02
03678 #define LFRDR_TREE_NEXT             0x04
03679 
03680 #define SYSICO_ITEM_NUMBER          5
03681 
03683 typedef struct _WINDOW_ELEMENT_RENDERER {
03685     const char name[LEN_RENDERER_NAME+1];
03686 
03691     int (*init) (PWERENDERER renderer);
03692 
03697     int (*deinit) (PWERENDERER renderer);
03698 
03713     DWORD (*calc_3dbox_color) (DWORD color, int flag);
03714 
03734     void (*draw_3dbox) (HDC hdc, const RECT* pRect, DWORD color, DWORD flag);
03735 
03736 
03747     void (*draw_radio) (HDC hdc, const RECT* pRect, DWORD color, int status);
03748 
03752     void (*draw_checkbox) (HDC hdc, const RECT* pRect, DWORD color, 
03753             int status);
03754 
03758     void (*draw_checkmark) (HDC hdc, const RECT* pRect, DWORD color, 
03759             int status);
03760 
03777     void (*draw_arrow) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color, int status);
03778 
03792     void (*draw_fold) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color, 
03793             int status, int next);
03794 
03796     void (*draw_focus_frame) (HDC hdc, const RECT *pRect, DWORD color);
03797 
03799     void (*draw_normal_item) (HWND hWnd, HDC hdc, const RECT* pRect, 
03800             DWORD color);
03801     
03803     void (*draw_hilite_item) (HWND hWnd, HDC hdc, const RECT* pRect, 
03804             DWORD color);
03805     
03807     void (*draw_disabled_item) (HWND hWnd, HDC hdc, const RECT* pRect, 
03808             DWORD color);
03809     
03811     void (*draw_significant_item) (HWND hWnd, HDC hdc, const RECT* pRect, 
03812             DWORD color);
03813 
03827     void (*draw_push_button) (HWND hWnd, HDC hdc, const RECT* pRect,
03828             DWORD color1, DWORD color2, int status);
03829 
03846     void (*draw_radio_button) (HWND hWnd, HDC hdc, const RECT* pRect, int status);
03847 
03864     void (*draw_check_button) (HWND hWnd, HDC hdc, const RECT* pRect, int status);
03865 
03867     void (*draw_border) (HWND hWnd, HDC hdc, BOOL is_active);
03868 
03870     void (*draw_caption) (HWND hWnd, HDC hdc, BOOL is_active);
03871 
03885     void (*draw_caption_button) (HWND hwnd, HDC hdc, int ht_code, int state);
03886 
03901     void (*draw_scrollbar) (HWND hWnd, HDC hdc, int sb_pos);
03902 
03904     void (*calc_trackbar_rect) (HWND hWnd, LFRDR_TRACKBARINFO *info, 
03905             DWORD dwStyle, const RECT* rcClient, RECT* rcRuler, 
03906             RECT* rcBar, RECT* rcBorder);
03907 
03909     void (*draw_trackbar) (HWND hWnd, HDC hdc, LFRDR_TRACKBARINFO *info);
03910 
03917     int (*calc_we_area) (HWND hWnd, int which, RECT* we_area);
03918 
03941     int (*calc_we_metrics) (HWND hWnd, 
03942             LFRDR_WINSTYLEINFO* style_info, int which);
03943 
03949     int (*hit_test) (HWND hWnd, int x, int y);
03950 
03952     int (*on_click_hotspot) (HWND hWnd, int which);
03953 
03963     void (*draw_custom_hotspot) (HWND hWnd, HDC hdc, int ht_code, int state);
03964 
03971     void (*calc_thumb_area) (HWND hWnd, BOOL vertical, 
03972             LFSCROLLBARINFO* sb_info);
03973 
03975     void (*disabled_text_out) (HWND hWnd, HDC hdc, const char* spText,
03976                     PRECT rc, DWORD dt_fmt);
03977 
03988     void (*draw_tab) (HWND hWnd, HDC hdc, RECT *rect, char *title, 
03989                 DWORD color, int flag, HICON icon);
03990 
03992     void (*draw_progress) (HWND hWnd, HDC hdc, 
03993             int nMax, int nMin, int nPos, BOOL fVertical);
03994     
03998     void (*draw_header) (HWND hWnd, HDC hdc, const RECT* pRect, DWORD color);
03999 
04004     DWORD (*on_get_rdr_attr) (struct _WINDOW_ELEMENT_RENDERER*, int we_attr_id);
04005 
04012     DWORD (*on_set_rdr_attr) (struct _WINDOW_ELEMENT_RENDERER*, int we_attr_id, DWORD we_attr, BOOL change);
04013 
04015     void (*erase_background) (HWND hWnd, HDC hdc, const RECT *rect);
04016 
04018     void (*draw_normal_menu_item) (HWND hWnd, HDC hdc, const RECT* pRect,
04019                         DWORD color);
04020 
04022     void (*draw_hilite_menu_item) (HWND hWnd, HDC hdc, const RECT* pRect,
04023                         DWORD color);
04024 
04026     void (*draw_disabled_menu_item) (HWND hWnd, HDC hdc, const RECT* pRect,
04027                         DWORD color);
04028 
04030     int we_metrics [WE_METRICS_NUMBER];
04031 
04033     DWORD we_colors [WE_COLORS_NUMBER][3];
04034 
04036     PLOGFONT we_fonts [WE_FONTS_NUMBER];
04037 
04039     HICON  we_icon [2][SYSICO_ITEM_NUMBER];
04040 
04042     unsigned int refcount;
04043 
04045     const void* private_info;
04046 } WINDOW_ELEMENT_RENDERER;
04047 
04051 typedef struct _WINDOWINFO
04052 {
04054     int left, top; 
04055     int right, bottom;
04056 
04058     int cl, ct;
04059     int cr, cb;
04060 
04062     DWORD dwStyle;
04064     DWORD dwExStyle;
04065 
04067     int iBkColor; 
04069     HMENU hMenu; 
04071     HACCEL hAccel;
04073     HCURSOR hCursor;
04075     HICON hIcon; 
04077     HMENU hSysMenu; 
04079     PLOGFONT pLogFont;
04080 
04082     char* spCaption; 
04084     int   id;    
04085 
04087     LFSCROLLBARINFO vscroll;
04089     LFSCROLLBARINFO hscroll;
04090 
04092     WINDOW_ELEMENT_RENDERER* we_rdr;
04093 } WINDOWINFO;
04094 
04106 static inline const WINDOWINFO* GUIAPI GetWindowInfo (HWND hWnd)
04107 {
04108     return (WINDOWINFO*)((unsigned char*)hWnd + 2*sizeof (short));
04109 }
04110 
04122 MG_EXPORT BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr);
04123 
04216 MG_EXPORT DWORD GUIAPI GetWindowElementAttr (HWND hwnd, int we_attr_id);
04217 
04234 MG_EXPORT DWORD GUIAPI SetWindowElementAttr (HWND hwnd, int we_attr_id, 
04235         DWORD we_attr);
04236 
04256 MG_EXPORT gal_pixel GUIAPI GetWindowElementPixelEx (HWND hwnd, 
04257         HDC hdc, int we_attr_id);
04258 
04271 MG_EXPORT const WINDOW_ELEMENT_RENDERER* 
04272     GUIAPI GetWindowRendererFromName (const char* name);
04273 
04286 MG_EXPORT BOOL GUIAPI AddWindowElementRenderer (const char* name, 
04287         const WINDOW_ELEMENT_RENDERER* we_rdr);
04288 
04299 MG_EXPORT BOOL GUIAPI RemoveWindowElementRenderer (const char* name);
04300 
04309 MG_EXPORT const WINDOW_ELEMENT_RENDERER* 
04310         GUIAPI GetDefaultWindowElementRenderer (void);
04311 
04323 MG_EXPORT const char* GUIAPI SetDefaultWindowElementRenderer (const char* name);
04324 
04343 MG_EXPORT BOOL GUIAPI SetWindowElementRenderer (HWND hWnd, 
04344         const char* werdr_name, const WINDOW_ELEMENT_ATTR* we_attrs);
04345 
04358 MG_EXPORT BOOL InitRendererSystemIcon (const char* rdr_name, 
04359         HICON *small_icon, HICON *large_icon);
04360 
04371 MG_EXPORT void TermRendererSystemIcon (HICON *small_icon, 
04372         HICON *large_icon);
04373 
04394 MG_EXPORT BOOL GUIAPI RegisterResFromFile (HDC hdc, const char* file);
04395 
04396 
04415 MG_EXPORT BOOL GUIAPI RegisterResFromMem (HDC hdc, const char* file, 
04416         const unsigned char* data, size_t data_size);
04417 
04431 MG_EXPORT BOOL GUIAPI RegisterResFromBitmap (const char* file, const BITMAP* bmp);
04432 
04445 MG_EXPORT const BITMAP* GUIAPI RetrieveRes (const char *file);
04446 
04460 MG_EXPORT void GUIAPI UnregisterRes (const char *file);
04461 
04478 MG_EXPORT BOOL GUIAPI RegisterSystemBitmap (HDC hdc, const char* rdr_name, 
04479         const char* id);
04480 
04495 MG_EXPORT void GUIAPI UnregisterSystemBitmap (HDC hdc, const char* rdr_name, 
04496         const char* id);
04497 
04498 /* define the key of resouce */
04499 typedef unsigned long RES_KEY;
04500 #define RES_KEY_INVALID 0
04501 
04502 /* define the incore res type */
04503 typedef struct _INNER_RES {
04504     RES_KEY key;
04505     Uint8* data;
04506     int data_len;
04507 
04508     /* special param recognized by the TYPE_OPS
04509      * normal is null. 
04510      * is the data is a mem of raw png, jpeg, bmp
04511      * and so on, it should be the extention name
04512      * of the filename. eg. 
04513      * INNER_RES res[]= { ... { ..., ... ,.., "png" } .. };
04514      * */
04515     void* additional;
04516 } INNER_RES;
04517 
04518 /* the type of resouce */
04519 enum emResType{
04520     RES_TYPE_INVALID = 0xFF,
04521 
04522     /* All kinds of image supported by MiniGUI
04523      * such as png, jpeg, bmp and so on
04524      * This type will make LoadResouce return a
04525      * PBITMAP pointer
04526      */
04527     RES_TYPE_IMAGE = 0,
04528 
04529     /* All kinds of image supported by MiniGUI
04530      * This Type will make LoadResource return a MYBITMAP* pointer
04531      */
04532     RES_TYPE_MYBITMAP,
04533 
04534     /* the icon file and mem
04535      * it only make LoadResource load or get the FIRST
04536      * icon, and return HICON
04537      */
04538     RES_TYPE_ICON,
04539 
04540 #ifdef _MGHAVE_CURSOR
04541     /* the cursor file or data
04542      * Make LoadResource return HCURSOR
04543      */
04544     RES_TYPE_CURSOR,
04545 #endif
04546 
04547     /* the config file or data support by minigui
04548      * make LoadResource return GHANDLE
04549      * it should be accessed by GetValueFromEtc and GetIntValueFromEtc
04550      */
04551     RES_TYPE_ETC,
04552 
04553     /* NOT IMPLEMENT */
04554     RES_TYPE_TEXT,
04555     /* NOT IMPLEMENT */
04556     RES_TYPE_MENU,
04557     /* NOT IMPLEMENT */
04558 
04559     RES_TYPE_WINDOW,
04560     /* Make the LoadResource return the 
04561      * raw data of INNER_RES, it's a pointer
04562      * of MEM_RES
04563      * only support incore Resource,
04564      * if the resource is stored in disk, LoadResource will return NULL
04565      */
04566     RES_TYPE_MEM_RES, 
04567 
04568     RES_TYPE_FONT, 
04569 
04570     /* the beginning of user defined type
04571      */
04572     RES_TYPE_USER,
04573 
04574     /* the max valid value of type
04575      * used defined type must less this value
04576      */
04577     RES_TYPE_USER_MAX = 0x7F
04578 };
04579 
04580 /* the return value of LoadResouce with type RES_TYPE_MEM_RES */
04581 typedef struct _MEM_RES {
04582     Uint8 *data;
04583     int data_len;
04584 } MEM_RES;
04585 
04586 typedef struct _FONT_RES {
04587     LOGFONT logfont;
04588     RES_KEY key;
04589 } FONT_RES;
04590 
04591 /* the original source of resource 
04592  * depend on the values, the res manager
04593  * would select corrent loader to
04594  * load resouce form disk or mem
04595  */
04596 
04597 #define REF_SRC_NOTYPE 0x00
04598 
04599 /* indicate that the resouce is stored in disk */
04600 #define REF_SRC_FILE 0x01
04601 
04602 /* indicate that the resouce is stored in memory*/
04603 #define REF_SRC_INNER 0x02
04604 
04605 /* indicate that the resouce is stored in shared memory*/
04606 #define REF_SRC_SHARED 0x03
04607 
04608 /* indicate that the resource is stored in outside( NOT SUPPORTED) */
04609 #define REF_SRC_OUTSIDE 0x04
04610 
04611 /* indicate that the resouce is stored in a stream object (NOT SUPPORTED) */
04612 #define REF_SRC_STREAM 0x05
04613 
04614 /* indicate that the resource is create by MiniGUI */
04615 #define REF_SRC_LOGIC 0x06
04616 
04617 /* the RESOUCE type for loadding */
04618 typedef struct _RESOURCE {
04619     void* data; // store the pointer of cached resouce
04620     union {
04621         void* src;
04622         INNER_RES* inner;
04623         char* file;
04624     } source; // indicate the stored format of resouce
04625 } RESOURCE;
04626 
04627 /* The operations of one type of resouce */
04628 typedef struct _RES_TYPE_OPS {
04629     /* To get a resource
04630      * return the buffered resouce pointer
04631      * param res the in and out param of resouce.
04632      * param src_type, one of REF_SRC_XXX
04633      * param usr_param
04634      * */
04635     void* (*get_res_data)(RESOURCE* res, int src_type, DWORD usr_param);
04636     /* To unload a buffered resouce
04637      */
04638     void (*unload)(RESOURCE* res, int src_type);
04639 } RES_TYPE_OPS;
04640 
04641 /* Return value and error code of resouce manager */
04642 enum emResReturn {
04643     RES_RET_OK = 0,
04644     RES_RET_INVALID_PARAM,
04645     RES_RET_NOT_EXIST_KEY, //RES_KEY is not exist
04646     RES_RET_LOAD_FILE_FAILED, 
04647     RES_RET_LOAD_MEM_FAILED,
04648     RES_RET_UNKNOWN_TYPE,
04649     RES_RET_NOT_IMPLEMENTED,
04650     RES_RET_INUSED //the res or object is in used, cannot be unloaded
04651 };
04652 
04664 MG_EXPORT int SetResPath (const char* path);
04665 
04679 MG_EXPORT int AddInnerRes (INNER_RES* inner_res, int count, BOOL copy);
04680 
04681 /*
04682  *  NOT IMPLEMENT
04683  */
04684 MG_EXPORT int AddSharedRes (const char* shared_name);
04685 
04698 MG_EXPORT int RegisterResType (int type, RES_TYPE_OPS* ops);
04699 
04710 MG_EXPORT int UnregisterResType (int type);
04711 
04749 MG_EXPORT void* LoadResource (const char* res_name, int type, DWORD usr_param);
04750 
04764 MG_EXPORT void* GetResource (RES_KEY key);
04765 
04781 MG_EXPORT int AddResRef (RES_KEY key);
04782 
04794 MG_EXPORT int ReleaseRes (RES_KEY key);
04795 
04796 #define LoadBitmapFromRes(hdc, res_name) \
04797     (PBITMAP)LoadResource(res_name, RES_TYPE_IMAGE, (DWORD)hdc)
04798 
04799 #define GetBitmapFromRes(key) (BITMAP*)GetResource(key)
04800 
04801 #define GetIconFromRes(key) (HICON)GetResource(key)
04802 
04803 #ifndef _MGHAVE_CURSOR
04804 #define GetCursorFromRes(key) (HCURSOR)GetResource(key)
04805 #endif
04806 
04807 #define GetEtcFromRes(key) (GHANDLE)GetResource(key)
04808 
04809 #define LoadLogicFontFromRes(font_name)  (PLOGFONT)LoadResource(font_name, RES_TYPE_FONT, 0)
04810 #define GetLogicFontFromRes(font_name)   (PLOGFONT)GetResource(Str2Key(font_name))
04811 #define ReleaseLogicFont(font)  ReleaseRes(((FONT_RES*)(font))->key)
04812 #define ReleaseLogicFontByName(font_name)  ReleaseRes(Str2Key(font_name))
04813 
04825 MG_EXPORT RES_KEY Str2Key (const char* str);
04826 
04827 
04828 #ifdef __TARGET_MSTUDIO__
04829 
04838 MG_EXPORT int GUIAPI GetWindowZOrder(HWND hWnd);
04839 
04849 MG_EXPORT int GUIAPI SetWindowZOrder(HWND hWnd, int zorder);
04850 
04851 #endif
04852 
04869 typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM);
04870 
04871 extern MG_EXPORT HWND __mg_hwnd_desktop;
04872 
04877 #define HWND_DESKTOP        __mg_hwnd_desktop
04878 
04883 #define HWND_NULL           0
04884 
04889 #define HWND_INVALID        0xFFFFFFFF
04890 
04891 #define HWND_OTHERPROC      0xFFFFFFFE
04892 
04896 typedef struct _MAINWINCREATE
04897 {
04899     DWORD dwStyle;
04900 
04902     DWORD dwExStyle;
04903 
04905     const char* spCaption;
04906 
04908     HMENU hMenu;
04909 
04911     HCURSOR hCursor;
04912 
04914     HICON hIcon;
04915 
04917     HWND  hHosting;
04918 
04920     int (*MainWindowProc)(HWND, int, WPARAM, LPARAM);
04921 
04923     int lx, ty, rx, by;
04924 
04926     int iBkColor;
04927 
04929     DWORD dwAddData;
04930 
04932     DWORD dwReserved;
04933 }MAINWINCREATE;
04934 typedef MAINWINCREATE* PMAINWINCREATE;
04935 
04936 #ifdef _MGRM_THREADS
04937 
04948 MG_EXPORT int GUIAPI CreateThreadForMainWindow(pthread_t* thread, 
04949                                      pthread_attr_t* attr, 
04950                                      void * (*start_routine)(void *), 
04951                                      void * arg);
04952 
04959 MG_EXPORT pthread_t GUIAPI GetMainWinThread(HWND hMainWnd);
04960 
04970 MG_EXPORT int GUIAPI WaitMainWindowClose(HWND hWnd, void** returnval);
04971 #endif
04972 
04988 MG_EXPORT void GUIAPI MainWindowThreadCleanup(HWND hMainWnd);
04989 
04996 #define MainWindowCleanup(hwnd)      MainWindowThreadCleanup(hwnd)
04997 
05023 MG_EXPORT HWND GUIAPI CreateMainWindowEx (PMAINWINCREATE pCreateInfo, 
05024                         const char* werdr_name, const WINDOW_ELEMENT_ATTR* we_attrs,
05025                         const char* window_name, const char* layer_name);
05026 
05037 static inline HWND GUIAPI CreateMainWindow (PMAINWINCREATE pCreateInfo)
05038 {
05039     return CreateMainWindowEx (pCreateInfo, NULL, NULL, NULL, NULL);
05040 }
05041 
05060 MG_EXPORT BOOL GUIAPI DestroyMainWindow (HWND hWnd);
05061 
05077 MG_EXPORT BOOL GUIAPI SetWindowMask (HWND hWnd, const MYBITMAP* mask);
05078 
05095 MG_EXPORT BOOL GUIAPI SetWindowMaskEx (HWND hWnd, HDC hdc, const BITMAP* mask);
05096 
05106 BOOL GUIAPI SetWindowRegion (HWND hWnd, const CLIPRGN* region);
05107 
05108 int GUIAPI PreDefMainWinProc (HWND hWnd, int message, 
05109                 WPARAM wParam, LPARAM lParam);
05110 
05111 int GUIAPI PreDefDialogProc (HWND hWnd, 
05112                 int message, WPARAM wParam, LPARAM lParam);
05113 
05114 int GUIAPI PreDefControlProc (HWND hWnd, int message, 
05115                 WPARAM wParam, LPARAM lParam);
05116 
05134 MG_EXPORT int GUIAPI DefaultWindowProc (HWND hWnd, int message, 
05135                 WPARAM wParam, LPARAM lParam);
05136 
05142 extern MG_EXPORT WNDPROC __mg_def_proc[3];
05143 
05158 #define DefaultMainWinProc (__mg_def_proc[0])
05159 
05176 #define DefaultDialogProc  (__mg_def_proc[1])
05177 
05191 #define DefaultControlProc (__mg_def_proc[2])
05192 
05193 #ifdef _DEBUG
05194 MG_EXPORT void GUIAPI DumpWindow (FILE* fp, HWND hWnd);
05195 #endif /* _DEBUG */
05196 
05202 #define SW_HIDE              0x0000
05203 #define SW_SHOW              0x0010
05204 #define SW_SHOWNORMAL        0x0100
05205 
05221 MG_EXPORT void GUIAPI UpdateWindow (HWND hWnd, BOOL bErase);
05222 
05241 MG_EXPORT BOOL GUIAPI ShowWindow (HWND hWnd, int iCmdShow);
05242 
05259 MG_EXPORT BOOL GUIAPI EnableWindow (HWND hWnd, BOOL fEnable);
05260 
05275 MG_EXPORT BOOL GUIAPI IsWindowEnabled (HWND hWnd);
05276 
05297 MG_EXPORT BOOL GUIAPI GetClientRect(HWND hWnd, PRECT prc);
05298 
05312 MG_EXPORT int GUIAPI GetWindowBkColor (HWND hWnd);
05313 
05329 MG_EXPORT int GUIAPI SetWindowBkColor (HWND hWnd, int new_bkcolor);
05330 
05343 MG_EXPORT PLOGFONT GUIAPI GetWindowFont (HWND hWnd);
05344 
05364 MG_EXPORT PLOGFONT GUIAPI SetWindowFont (HWND hWnd, PLOGFONT pLogFont);
05365 
05378 MG_EXPORT HCURSOR GUIAPI GetWindowCursor (HWND hWnd);
05379 
05393 MG_EXPORT HCURSOR GUIAPI SetWindowCursor (HWND hWnd, HCURSOR hNewCursor);
05394 
05407 MG_EXPORT HICON GUIAPI GetWindowIcon (HWND hWnd);
05408 
05426 MG_EXPORT HICON GUIAPI SetWindowIcon (HWND hWnd, HICON hIcon, BOOL bRedraw);
05427 
05439 MG_EXPORT DWORD GUIAPI GetWindowStyle (HWND hWnd);
05440 
05452 MG_EXPORT DWORD GUIAPI GetWindowExStyle (HWND hWnd);
05453 
05467 MG_EXPORT BOOL GUIAPI ExcludeWindowStyle (HWND hWnd, DWORD dwStyle);
05468 
05482 MG_EXPORT BOOL GUIAPI IncludeWindowStyle (HWND hWnd, DWORD dwStyle);
05483 
05497 MG_EXPORT BOOL GUIAPI ExcludeWindowExStyle (HWND hWnd, DWORD dwStyle);
05498 
05512 MG_EXPORT BOOL GUIAPI IncludeWindowExStyle (HWND hWnd, DWORD dwStyle);
05513 
05526 MG_EXPORT WNDPROC GUIAPI GetWindowCallbackProc (HWND hWnd);
05527 
05545 MG_EXPORT WNDPROC GUIAPI SetWindowCallbackProc (HWND hWnd, WNDPROC newProc);
05546 
05559 MG_EXPORT DWORD GUIAPI GetWindowAdditionalData (HWND hWnd);
05560 
05579 MG_EXPORT DWORD GUIAPI SetWindowAdditionalData (HWND hWnd, DWORD newData);
05580 
05593 MG_EXPORT DWORD GUIAPI GetWindowAdditionalData2 (HWND hWnd);
05594 
05612 MG_EXPORT DWORD GUIAPI SetWindowAdditionalData2 (HWND hWnd, DWORD newData);
05613 
05630 MG_EXPORT DWORD GUIAPI GetWindowClassAdditionalData (HWND hWnd);
05631 
05647 MG_EXPORT DWORD GUIAPI SetWindowClassAdditionalData (HWND hWnd, DWORD newData);
05648 
05661 MG_EXPORT const char* GUIAPI GetWindowCaption (HWND hWnd);
05662 
05676 MG_EXPORT BOOL GUIAPI SetWindowCaption (HWND hWnd, const char* spCaption);
05677 
05696 MG_EXPORT BOOL GUIAPI InvalidateRect (HWND hWnd, 
05697                 const RECT* prc, BOOL bEraseBkgnd);
05698 
05714 MG_EXPORT HDC GUIAPI BeginPaint(HWND hWnd);
05715 
05729 MG_EXPORT void GUIAPI EndPaint(HWND hWnd, HDC hdc);
05730 
05746 MG_EXPORT BOOL GUIAPI GetUpdateRect (HWND hWnd, RECT* update_rect);
05747 
05764 MG_EXPORT int GUIAPI ClientWidthToWindowWidthEx (DWORD dwStyle, 
05765         int win_type, int cw);
05766 
05783 MG_EXPORT int GUIAPI ClientHeightToWindowHeightEx (DWORD dwStyle, 
05784         int win_type, int ch, BOOL hasMenu);
05785 
05786 #define ClientWidthToWindowWidth(dwStyle, cw) \
05787     ClientWidthToWindowWidthEx (dwStyle, LFRDR_WINTYPE_MAINWIN, cw)
05788 
05789 #define ClientHeightToWindowHeight(dwStyle, ch, hasMenu) \
05790     ClientHeightToWindowHeightEx (dwStyle, LFRDR_WINTYPE_MAINWIN, ch, hasMenu)
05791 
05805 MG_EXPORT void GUIAPI ClientToScreen (HWND hWnd, int* x, int* y);
05806 
05820 MG_EXPORT void GUIAPI ScreenToClient (HWND hWnd, int* x, int* y);
05821 
05835 MG_EXPORT void GUIAPI ClientToWindow(HWND hWnd, int* x, int* y);
05836 
05850 MG_EXPORT void GUIAPI WindowToClient(HWND hWnd, int* x, int* y);
05851 
05852 
05866 MG_EXPORT void GUIAPI WindowToScreen (HWND hWnd, int* x, int* y);
05867 
05881 MG_EXPORT void GUIAPI ScreenToWindow (HWND hWnd, int* x, int* y);
05882 
05896 MG_EXPORT BOOL GUIAPI IsMainWindow (HWND hWnd);
05897 
05910 MG_EXPORT BOOL GUIAPI IsControl (HWND hWnd);
05911 
05925 MG_EXPORT BOOL GUIAPI IsWindow (HWND hWnd);
05926 
05940 MG_EXPORT BOOL GUIAPI IsDialog (HWND hWnd);
05941 
05959 MG_EXPORT HWND GUIAPI GetParent (HWND hWnd);
05960 
05976 MG_EXPORT HWND GUIAPI GetMainWindowHandle (HWND hWnd);
05977 
05992 MG_EXPORT BOOL GUIAPI IsWindowVisible (HWND hWnd);
05993 
06011 MG_EXPORT BOOL GUIAPI GetWindowRect (HWND hWnd, PRECT prc);
06012 
06037 MG_EXPORT HWND GUIAPI GetNextChild (HWND hWnd, HWND hChild);
06038 
06056 MG_EXPORT HWND GUIAPI GetNextMainWindow (HWND hMainWnd);
06057 
06077 MG_EXPORT HWND GUIAPI GetHosting (HWND hMainWnd);
06078 
06098 MG_EXPORT HWND GUIAPI GetFirstHosted (HWND hHosting);
06099 
06124 MG_EXPORT HWND GUIAPI GetNextHosted (HWND hHosting, HWND hHosted);
06125 
06140 MG_EXPORT int GUIAPI GetWindowTextLength (HWND hWnd);
06141 
06158 MG_EXPORT int GUIAPI GetWindowText (HWND hWnd, char* spString, int nMaxLen);
06159 
06175 MG_EXPORT BOOL GUIAPI SetWindowText (HWND hWnd, const char* spString);
06176 
06191 MG_EXPORT HWND GUIAPI GetFocusChild (HWND hParent);
06192 
06206 MG_EXPORT HWND GUIAPI SetNullFocus (HWND hParent);
06207 
06221 MG_EXPORT HWND GUIAPI SetFocusChild (HWND hWnd);
06222 
06227 #define SetFocus SetFocusChild
06228 
06233 #define GetFocus GetFocusChild
06234 
06246 MG_EXPORT HWND GUIAPI GetActiveWindow (void);
06247 
06261 MG_EXPORT HWND GUIAPI SetActiveWindow (HWND hMainWnd);
06262 
06267 #define GetForegroundWindow GetActiveWindow
06268 
06273 #define SetForegroundWindow SetActiveWindow
06274 
06289 MG_EXPORT HWND GUIAPI GetCapture(void);
06290 
06306 MG_EXPORT HWND GUIAPI SetCapture(HWND hWnd);
06307 
06319 MG_EXPORT void GUIAPI ReleaseCapture(void);
06320 
06333 MG_EXPORT HWND GUIAPI GetWindowUnderCursor (void);
06334 
06356 MG_EXPORT BOOL GUIAPI MoveWindow (HWND hWnd, int x, int y, int w, int h, 
06357                 BOOL fPaint);
06358 
06379 MG_EXPORT void GUIAPI ScrollWindow (HWND hWnd, int iOffx, int iOffy, 
06380                 const RECT* rc1, const RECT* rc2);
06381 
06386 #define GetWindowElementColor(iItem)   \
06387         GetWindowElementPixelEx(HWND_NULL, -1, iItem)
06388 
06389 #define GetWindowElementColorEx(hWnd, iItem)   \
06390         GetWindowElementPixelEx(hWnd, -1, iItem)
06391 
06392 #define GetWindowElementPixel(hWnd, iItem)   \
06393         GetWindowElementPixelEx(hWnd, -1, iItem)
06394 
06401 #define SYSBMP_RADIOBUTTON          "radiobutton" 
06402 #define SYSBMP_CHECKBUTTON          "checkbutton" 
06403 #define SYSBMP_BGPICTURE            "bgpicture"
06404 #define SYSBMP_BGPICPOS             "bgpicpos"
06405 
06406 /* Obsolete definitions; back-compatibility definitions. */
06407 #define SYSBMP_IMECTRLBTN          "IMEctrlbtn"
06408 #define SYSBMP_LOGO                "logo"
06409 
06428 MG_EXPORT const BITMAP* GUIAPI GetSystemBitmapEx (const char* rdr_name, 
06429         const char* id);
06430 
06449 MG_EXPORT const BITMAP* GUIAPI GetSystemBitmapByHwnd (HWND hWnd, const char* id);
06450 
06469 MG_EXPORT const BITMAP* GUIAPI GetSystemBitmap (HWND hWnd, const char* id);
06470 
06490 MG_EXPORT void GUIAPI TermSystemBitmapEx (const char* id, 
06491         const char* rdr_name, PBITMAP bmp);
06492 
06511 MG_EXPORT void GUIAPI TermSystemBitmap (HWND hWnd, const char* id, PBITMAP bmp);
06512 
06513 /*for backward compatibility */
06514 #define IDI_APPLICATION         0
06515 #define IDI_HAND                1
06516 #define IDI_STOP                IDI_HAND
06517 #define IDI_QUESTION            2
06518 #define IDI_EXCLAMATION         3
06519 #define IDI_ASTERISK            4
06520 #define IDI_INFORMATION         IDI_ASTERISK
06521 
06522 #define SYSICON_FT_DIR          "dir"
06523 #define SYSICON_FT_FILE         "file"
06524 
06525 #define SYSICON_TREEFOLD        "treefold" 
06526 #define SYSICON_TREEUNFOLD      "treeunfold" 
06527 
06545 MG_EXPORT HICON GUIAPI LoadSystemIconEx (HDC hdc, 
06546         const char* rdr_name, const char* szItemName, int which);
06547 
06562 MG_EXPORT HICON GUIAPI LoadSystemIcon (const char* szItemName, int which);
06563 
06584 MG_EXPORT HICON GUIAPI GetLargeSystemIconEx (HWND hWnd, int iItem);
06585 
06606 MG_EXPORT HICON GUIAPI GetSmallSystemIconEx (HWND hWnd, int iItem);
06607 
06614 #define GetLargeSystemIcon(iItem) GetLargeSystemIconEx(HWND_NULL, iItem)
06615 
06622 #define GetSmallSystemIcon(iItem) GetSmallSystemIconEx(HWND_NULL, iItem)
06623 
06631 #define SB_HORZ     1
06632 #define SB_VERT     2
06633 
06652 MG_EXPORT BOOL GUIAPI EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable);
06653 
06675 MG_EXPORT BOOL GUIAPI GetScrollPos (HWND hWnd, int iSBar, int* pPos);
06676 
06701 MG_EXPORT BOOL GUIAPI GetScrollRange (HWND hWnd, int iSBar, 
06702                 int* pMinPos, int* pMaxPos);
06703 
06726 MG_EXPORT BOOL GUIAPI SetScrollPos (HWND hWnd, int iSBar, int iNewPos);
06727 
06752 MG_EXPORT BOOL GUIAPI SetScrollRange (HWND hWnd, int iSBar, 
06753                 int iMinPos, int iMaxPos);
06754 
06774 MG_EXPORT BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow);
06775 
06776 #define SIF_RANGE           0x0001
06777 #define SIF_PAGE            0x0002
06778 #define SIF_POS             0x0004
06779 #define SIF_DISABLENOSCROLL 0x0008
06780 #define SIF_TRACKPOS        0x0010
06781 #define SIF_ALL             (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
06782 
06784 #define SB_ARROW_LTUP   0x0001
06785 
06787 #define SB_ARROW_BTDN   0x0002
06788 
06790 #define SB_ARROW_BOTH  (SB_ARROW_LTUP | SB_ARROW_BTDN)
06791 
06795 typedef struct _SCROLLINFO
06796 {
06798     UINT    cbSize;
06811     UINT    fMask;
06813     int     nMin;
06815     int     nMax;
06817     UINT    nPage;
06819     int     nPos;
06820 #if 0
06821     int     nTrackPos;
06822 #endif
06823 } SCROLLINFO, *PSCROLLINFO;
06824 
06848 MG_EXPORT BOOL GUIAPI SetScrollInfo (HWND hWnd, int iSBar, 
06849                 const SCROLLINFO* lpsi, BOOL fRedraw);
06850 
06873 MG_EXPORT BOOL GUIAPI GetScrollInfo (HWND hWnd, int iSBar, PSCROLLINFO lpsi);
06874 
06882 /* Class styles -- not supported so far */
06883 #define CS_VREDRAW          0x0001
06884 #define CS_HREDRAW          0x0002
06885 #define CS_KEYCVTWINDOW     0x0004
06886 #define CS_DBLCLKS          0x0008
06887 
06888 #define CS_OWNDC            0x0020
06889 #define CS_CLASSDC          0x0040
06890 #define CS_PARENTDC         0x0080
06891 
06892 #define CS_NOKEYCVT         0x0100
06893 #define CS_NOCLOSE          0x0200
06894 #define CS_SAVEBITS         0x0800
06895 
06896 #define CS_BYTEALIGNCLIENT  0x1000
06897 #define CS_BYTEALIGNWINDOW  0x2000
06898 #define CS_GLOBALCLASS      0x4000
06899 #define CS_IME              0x8000
06900 
06901 #define COP_STYLE           0x0001
06902 #define COP_HCURSOR         0x0002
06903 #define COP_BKCOLOR         0x0004
06904 #define COP_WINPROC         0x0008
06905 #define COP_ADDDATA         0x0010
06906 
06910 typedef struct _WNDCLASS
06911 {
06913     const char* spClassName;
06914 
06927     DWORD   opMask;
06928 
06930     DWORD   dwStyle;
06931 
06933     DWORD   dwExStyle;
06934 
06936     HCURSOR hCursor;
06937 
06939     int     iBkColor;
06940 
06942     int     (*WinProc) (HWND, int, WPARAM, LPARAM);
06943 
06945     DWORD dwAddData;
06946 } WNDCLASS;
06947 typedef WNDCLASS* PWNDCLASS;
06948 
06949 #define MAINWINCLASSNAME    ("MAINWINDOW")
06950 #define ROOTWINCLASSNAME    ("ROOTWINDOW")
06951 
06970 MG_EXPORT BOOL GUIAPI RegisterWindowClass (PWNDCLASS pWndClass);
06971 
06985 MG_EXPORT BOOL GUIAPI UnregisterWindowClass (const char* szClassName);
06986 
07000 MG_EXPORT const char* GUIAPI GetClassName (HWND hWnd);
07001 
07017 MG_EXPORT BOOL GUIAPI GetWindowClassInfo (PWNDCLASS pWndClass);
07018 
07033 MG_EXPORT BOOL GUIAPI SetWindowClassInfo (const WNDCLASS* pWndClass);
07034 
07079 MG_EXPORT HWND GUIAPI CreateWindowEx2 (const char* spClassName, 
07080         const char* spCaption, DWORD dwStyle, DWORD dwExStyle, 
07081         int id, int x, int y, int w, int h, HWND hParentWnd, 
07082         const char* werdr_name, const WINDOW_ELEMENT_ATTR* we_attrs, 
07083         DWORD dwAddData);
07084 
07097 static inline HWND GUIAPI CreateWindowEx (const char* spClassName, 
07098                 const char* spCaption, DWORD dwStyle, DWORD dwExStyle, 
07099                 int id, int x, int y, int w, int h, HWND hParentWnd, 
07100                 DWORD dwAddData)
07101 {
07102     return CreateWindowEx2 (spClassName, spCaption, dwStyle, dwExStyle, 
07103                 id, x, y, w, h, hParentWnd, NULL, NULL, dwAddData);
07104 }
07105 
07118 MG_EXPORT BOOL GUIAPI DestroyWindow (HWND hWnd);
07119 
07131 typedef void (* NOTIFPROC) (HWND hwnd, int id, int nc, DWORD add_data);
07132 
07159 MG_EXPORT NOTIFPROC GUIAPI SetNotificationCallback (HWND hwnd, 
07160                 NOTIFPROC notif_proc);
07161 
07175 MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd);
07176 
07183 #define CreateWindow(class_name, caption, style,        \
07184                 id, x, y, w, h, parent, add_data)       \
07185         CreateWindowEx(class_name, caption, style, 0,   \
07186                         id, x, y, w, h, parent, add_data)
07187 
07190 /******************************** Timer Support ******************************/
07208 typedef BOOL (* TIMERPROC)(HWND, int, DWORD);
07209 
07243 MG_EXPORT BOOL GUIAPI SetTimerEx (HWND hWnd, int id, unsigned int speed, 
07244                 TIMERPROC timer_proc);
07245 
07252 #define SetTimer(hwnd, id, speed) \
07253                 SetTimerEx(hwnd, id, speed, NULL)
07254 
07269 MG_EXPORT int GUIAPI KillTimer (HWND hWnd, int id);
07270 
07290 MG_EXPORT BOOL GUIAPI ResetTimerEx (HWND hWnd, int id, unsigned int speed,
07291                 TIMERPROC timer_proc);
07292 
07299 #define ResetTimer(hwnd, id, speed) \
07300                 ResetTimerEx(hwnd, id, speed, (TIMERPROC)0xFFFFFFFF)
07301 
07312 MG_EXPORT unsigned int GUIAPI GetTickCount (void);
07313 
07328 MG_EXPORT BOOL GUIAPI IsTimerInstalled (HWND hWnd, int id);
07329 
07341 MG_EXPORT BOOL GUIAPI HaveFreeTimer (void);
07342 
07353 typedef struct _IME_TARGET_INFO
07354 {
07366     int     iEditBoxType;
07367     
07368     /* The position of the caret */
07369     POINT   ptCaret;
07370     
07371     /* The rect of the edit box */
07372     RECT    rcEditBox;
07373 } IME_TARGET_INFO;
07374 
07393 MG_EXPORT int GUIAPI RegisterIMEWindow (HWND hWnd);
07394 
07409 MG_EXPORT int GUIAPI UnregisterIMEWindow (HWND hWnd);
07410 
07454 MG_EXPORT int GUIAPI GetIMEStatus (int StatusCode);
07455 
07471 MG_EXPORT int GUIAPI SetIMEStatus (int StatusCode, int Value);
07472 
07486 MG_EXPORT int GUIAPI GetIMETargetInfo (IME_TARGET_INFO *info);
07487 
07502 MG_EXPORT inline int GUIAPI GetIMEPos (POINT* pt);
07503 
07519 MG_EXPORT int GUIAPI SetIMETargetInfo (const IME_TARGET_INFO *info);
07520 
07536 MG_EXPORT inline int GUIAPI SetIMEPos(const POINT* pt);
07537 
07556 MG_EXPORT HACCEL GUIAPI CopyAcceleratorTable (HACCEL hacc);
07557 
07571 MG_EXPORT int GUIAPI DeleteAccelerators (HACCEL hacc, int key, DWORD keymask);
07572 
07573 #define ACCEL_SHIFT     KS_SHIFT
07574 #define ACCEL_ALT       KS_ALT
07575 #define ACCEL_CTRL      KS_CTRL
07576 
07605 MG_EXPORT int GUIAPI AddAccelerators (HACCEL hacc, int key, 
07606                 DWORD keymask, WPARAM wParam, LPARAM lParam);
07607 
07622 MG_EXPORT int GUIAPI DestroyAcceleratorTable (HACCEL hacc);
07623 
07635 MG_EXPORT HACCEL GUIAPI CreateAcceleratorTable (HWND hWnd);
07636 
07648 MG_EXPORT int GUIAPI TranslateAccelerator (HACCEL hAccel, PMSG pMsg);
07649 
07675 MG_EXPORT BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, 
07676                 int nWidth, int nHeight);
07677 
07693 MG_EXPORT BOOL GUIAPI ChangeCaretSize (HWND hWnd, int newWidth, int newHeight);
07694 
07707 MG_EXPORT BOOL GUIAPI ActiveCaret (HWND hWnd);
07708 
07724 MG_EXPORT UINT GUIAPI GetCaretBlinkTime (HWND hWnd);
07725 
07742 MG_EXPORT BOOL GUIAPI SetCaretBlinkTime (HWND hWnd, UINT uTime);
07743 
07756 MG_EXPORT BOOL GUIAPI DestroyCaret (HWND hWnd);
07757 
07775 MG_EXPORT BOOL GUIAPI HideCaretEx (HWND hWnd, BOOL ime);
07776 
07791 static inline BOOL GUIAPI HideCaret (HWND hWnd)
07792 {
07793     return HideCaretEx (hWnd, TRUE);
07794 }
07795 
07813 MG_EXPORT BOOL GUIAPI ShowCaretEx (HWND hWnd, BOOL ime);
07814 
07829 static inline BOOL GUIAPI ShowCaret (HWND hWnd)
07830 {
07831     return ShowCaretEx (hWnd, TRUE);
07832 }
07833 
07850 MG_EXPORT BOOL GUIAPI SetCaretPos (HWND hWnd, int x, int y);
07851 
07866 MG_EXPORT BOOL GUIAPI GetCaretPos (HWND hWnd, PPOINT pPt);
07867 
07875 /* Menu flags */
07876 #define MF_INSERT           0x00000000L
07877 #define MF_CHANGE           0x00000080L
07878 #define MF_APPEND           0x00000100L
07879 #define MF_DELETE           0x00000200L
07880 #define MF_REMOVE           0x00001000L
07881 
07882 #define MF_BYCOMMAND        0x00000000L
07883 #define MF_BYPOSITION       0x00000400L
07884 
07885 #define MF_SEPARATOR        0x00000800L
07886 
07887 #define MF_ENABLED          0x00000000L
07888 #define MF_GRAYED           0x00000001L
07889 #define MF_DISABLED         0x00000002L
07890 
07891 #define MF_UNCHECKED        0x00000000L
07892 #define MF_CHECKED          0x00000008L
07893 #define MF_USECHECKBITMAPS  0x00000200L
07894 
07895 #define MF_STRING           0x00000000L
07896 #define MF_BITMAP           0x00000004L
07897 #define MF_OWNERDRAW        0x00000100L
07898 
07899 #define MF_POPUP            0x00000010L
07900 #define MF_MENUBARBREAK     0x00000020L
07901 #define MF_MENUBREAK        0x00000040L
07902 
07903 #define MF_UNHILITE         0x00000000L
07904 #define MF_HILITE           0x00000080L
07905 
07906 #define MF_DEFAULT          0x00001000L
07907 #define MF_SYSMENU          0x00002000L
07908 #define MF_HELP             0x00004000L
07909 #define MF_RIGHTJUSTIFY     0x00004000L
07910 
07911 #define MF_MOUSESELECT      0x00008000L
07912 #define MF_END              0x00000080L
07913 
07914 #define MFT_STRING          MF_STRING /* 0x00000000L */
07915 #define MFT_BITMAP          MF_BITMAP /* 0x00000004L */
07916 #define MFT_BMPSTRING       0x00010000L
07917 #define MFT_MENUBARBREAK    MF_MENUBARBREAK /* 0x00000020L */
07918 #define MFT_MENUBREAK       MF_MENUBREAK /* 0x00000040L */
07919 #define MFT_OWNERDRAW       MF_OWNERDRAW /* 0x00000100L */
07920 #define MFT_RADIOCHECK      0x00000200L
07921 #define MFT_MARKCHECK       0x00000400L
07922 #define MFT_SEPARATOR       MF_SEPARATOR /* 0x00000800L */
07923 
07924 #define MFT_RIGHTORDER      0x00002000L
07925 #define MFT_RIGHTJUSTIFY    MF_RIGHTJUSTIFY
07926 
07927 #define MFS_GRAYED          0x00000003L
07928 #define MFS_DISABLED        MFS_GRAYED
07929 #define MFS_CHECKED         MF_CHECKED
07930 #define MFS_HILITE          MF_HILITE
07931 #define MFS_ENABLED         MF_ENABLED
07932 #define MFS_UNCHECKED       MF_UNCHECKED
07933 #define MFS_UNHILITE        MF_UNHILITE
07934 #define MFS_DEFAULT         MF_DEFAULT
07935 
07936 /* System Menu Command Values */
07937   #define SC_SIZE         0xF000
07938   #define SC_MOVE         0xF010
07939   #define SC_MINIMIZE     0xF020
07940   #define SC_MAXIMIZE     0xF030
07941   #define SC_NEXTWINDOW   0xF040
07942   #define SC_PREVWINDOW   0xF050
07943   #define SC_CLOSE        0xF060
07944   #define SC_VSCROLL      0xF070
07945   #define SC_HSCROLL      0xF080
07946   #define SC_MOUSEMENU    0xF090
07947   #define SC_KEYMENU      0xF100
07948   #define SC_ARRANGE      0xF110
07949   #define SC_RESTORE      0xF120
07950   #define SC_TASKLIST     0xF130
07951   #define SC_SCREENSAVE   0xF140
07952   #define SC_HOTKEY       0xF150
07953 
07954   #define SC_DEFAULT      0xF160
07955   #define SC_MONITORPOWER 0xF170
07956   #define SC_CONTEXTHELP  0xF180
07957   #define SC_SEPARATOR    0xF00F
07958 
07959 /* MENUITEMINFO flags */
07960   #define MIIM_STATE       0x00000001
07961   #define MIIM_ID          0x00000002
07962   #define MIIM_SUBMENU     0x00000004
07963   #define MIIM_CHECKMARKS  0x00000008
07964   #define MIIM_TYPE        0x00000010
07965   #define MIIM_DATA        0x00000020
07966   #define MIIM_STRING      0x00000040
07967   #define MIIM_BITMAP      0x00000080
07968   #define MIIM_FTYPE       0x00000100
07969 
07970 
07971 /* Flags for TrackPopupMenu */
07972   #define TPM_LEFTBUTTON  0x0000L
07973   #define TPM_RIGHTBUTTON 0x0002L
07974   #define TPM_LEFTALIGN   0x0000L
07975   #define TPM_CENTERALIGN 0x0004L
07976   #define TPM_RIGHTALIGN  0x0008L
07977   #define TPM_TOPALIGN        0x0000L
07978   #define TPM_VCENTERALIGN    0x0010L
07979   #define TPM_BOTTOMALIGN     0x0020L
07980 
07981   #define TPM_HORIZONTAL      0x0000L     /* Horz alignment matters more */
07982   #define TPM_VERTICAL        0x0040L     /* Vert alignment matters more */
07983   #define TPM_NONOTIFY        0x0080L     /* Don't send any notification msgs */
07984   #define TPM_RETURNCMD       0x0100L
07985 
07986   #define TPM_DESTROY         0x1000L       /* Destroy menu after tracking */
07987   #define TPM_SYSCMD          0x2000L       /* Send system command */
07988   #define TPM_DEFAULT         0x0000L       /* Default tracking flag */
07989 
07990 /* return codes for MSG_MENUCHAR */
07991 #define MNC_IGNORE  0
07992 #define MNC_CLOSE   1
07993 #define MNC_EXECUTE 2
07994 #define MNC_SELECT  3
07995 
07999 typedef struct _MENUITEMINFO {
08000 
08017     UINT                mask;
08018 
08045     UINT                type;
08046 
08060     UINT                state;
08061 
08063     int                 id;
08064 
08066     HMENU               hsubmenu;
08067 
08069     PBITMAP             uncheckedbmp;
08070 
08072     PBITMAP             checkedbmp;
08073 
08075     DWORD               itemdata; 
08076 
08078     DWORD               typedata;
08079 
08084     UINT                cch;
08085 } MENUITEMINFO;
08086 typedef MENUITEMINFO* PMENUITEMINFO;
08087 
08099 MG_EXPORT HMENU GUIAPI CreateMenu (void);
08100 
08115 MG_EXPORT HMENU GUIAPI CreatePopupMenu ( PMENUITEMINFO pmii);
08116 
08131 MG_EXPORT HMENU GUIAPI CreateSystemMenu (HWND hwnd, DWORD dwStyle);
08132 
08159 MG_EXPORT int GUIAPI InsertMenuItem (HMENU hmnu, int item, 
08160                             UINT flag, PMENUITEMINFO pmii);
08161 
08186 MG_EXPORT int GUIAPI RemoveMenu (HMENU hmnu, int item, UINT flag);
08187 
08211 MG_EXPORT int GUIAPI DeleteMenu (HMENU hmnu, int item, UINT flag);
08212 
08229 MG_EXPORT int GUIAPI DestroyMenu (HMENU hmnu);
08230 
08245 MG_EXPORT int GUIAPI IsMenu (HMENU hmnu);
08246 
08261 MG_EXPORT HMENU GUIAPI SetMenu (HWND hwnd, HMENU hmnu);
08262 
08275 MG_EXPORT HMENU GUIAPI GetMenu (HWND hwnd);
08276 
08289 MG_EXPORT void GUIAPI DrawMenuBar (HWND hwnd);
08290 
08305 MG_EXPORT int GUIAPI TrackMenuBar (HWND hwnd, int pos);
08306 
08344 MG_EXPORT int GUIAPI TrackPopupMenu (HMENU hmnu, UINT uFlags, 
08345                 int x, int y, HWND hwnd);
08346 
08364 MG_EXPORT HMENU GUIAPI GetMenuBarItemRect (HWND hwnd, int pos, RECT* prc);
08365 
08366 #define LFRDR_MENU_STATE_HILITE       0x01
08367 #define LFRDR_MENU_STATE_NORMAL       0x02
08368 #define LFRDR_MENU_STATE_DISABLED     0x04
08369 
08391 MG_EXPORT BOOL GUIAPI HiliteMenuBarItem (HWND hwnd, int pos, UINT flag);
08392 
08405 MG_EXPORT int GUIAPI GetMenuItemCount (HMENU hmnu);
08406 
08423 MG_EXPORT int GUIAPI GetMenuItemID (HMENU hmnu, int pos); 
08424 
08448 MG_EXPORT int GUIAPI GetMenuItemInfo (HMENU hmnu, int item, 
08449                             UINT flag, PMENUITEMINFO pmii);
08450 
08451 /*Reserved*/
08452 int GUIAPI GetMenuItemRect (HWND hwnd, HMENU hmnu, 
08453                 int item, PRECT prc);
08454 
08467 MG_EXPORT HMENU GUIAPI GetPopupSubMenu (HMENU hpppmnu);
08468 
08481 MG_EXPORT HMENU GUIAPI StripPopupHead (HMENU hpppmnu);
08482 
08500 MG_EXPORT HMENU GUIAPI GetSubMenu (HMENU hmnu, int pos);
08501 
08519 MG_EXPORT HMENU GUIAPI GetSystemMenu (HWND hwnd, BOOL flag);
08520 
08540 MG_EXPORT UINT GUIAPI EnableMenuItem (HMENU hmnu, int item, UINT flag);
08541 
08565 MG_EXPORT int GUIAPI CheckMenuRadioItem (HMENU hmnu, int first, int last, 
08566                             int checkitem, UINT flag);
08567 
08591 MG_EXPORT int GUIAPI SetMenuItemBitmaps (HMENU hmnu, int item, UINT flag, 
08592                             PBITMAP hBmpUnchecked, PBITMAP hBmpChecked);
08593 
08615 MG_EXPORT int GUIAPI SetMenuItemInfo (HMENU hmnu, int item, 
08616                             UINT flag, PMENUITEMINFO pmii);
08617 
08625 /* Dialog codes */
08630 #define DLGC_WANTARROWS     0x0001     
08631 
08635 #define DLGC_WANTTAB        0x0002    
08636 
08640 #define DLGC_WANTALLKEYS    0x0004   
08641 
08645 #define DLGC_WANTCHARS      0x0008  
08646 
08651 #define DLGC_WANTENTER      0x0010 
08652 
08656 #define DLGC_HASSETSEL      0x0080    
08657 
08662 #define DLGC_DEFPUSHBUTTON  0x0100   
08663 
08667 #define DLGC_PUSHBUTTON     0x0200  
08668 
08672 #define DLGC_RADIOBUTTON    0x0400 
08673 
08677 #define DLGC_3STATE         0x0800
08678 
08682 #define DLGC_STATIC         0x1000 
08683 
08687 #define DLGC_BUTTON         0x2000    
08688 
08692 typedef struct _CTRLDATA
08693 {
08695     const char* class_name;             
08697     DWORD       dwStyle;                
08699     int         x, y, w, h;             
08701     int         id;                     
08703     const char* caption;                
08705     DWORD       dwAddData;              
08707     DWORD       dwExStyle;              
08708 
08710     const char* werdr_name;
08711 
08713     const WINDOW_ELEMENT_ATTR* we_attrs;
08714 } CTRLDATA;
08715 typedef CTRLDATA* PCTRLDATA;
08716 
08724 typedef struct _DLGTEMPLATE
08725 {
08727     DWORD       dwStyle;                
08729     DWORD       dwExStyle;              
08731     int         x, y, w, h;             
08733     const char* caption;                
08735     HICON       hIcon;                  
08737     HMENU       hMenu;                  
08739     int         controlnr;              
08741     PCTRLDATA   controls;               
08743     DWORD       dwAddData;              
08744 } DLGTEMPLATE;
08745 typedef DLGTEMPLATE* PDLGTEMPLATE;
08746 
08778 MG_EXPORT HWND GUIAPI CreateMainWindowIndirectParamEx (PDLGTEMPLATE pDlgTemplate,
08779         HWND hOwner, WNDPROC WndProc, LPARAM lParam,
08780         const char* werdr_name, WINDOW_ELEMENT_ATTR* we_attrs,
08781         const char* window_name, const char* layer_name);
08782 
08795 static inline HWND GUIAPI CreateMainWindowIndirectParam (
08796                 PDLGTEMPLATE pDlgTemplate, HWND hOwner, 
08797                 WNDPROC WndProc, LPARAM lParam)
08798 {
08799     return CreateMainWindowIndirectParamEx (pDlgTemplate, hOwner, 
08800             WndProc, lParam, NULL, NULL, NULL, NULL);
08801 }
08802 
08814 static inline HWND GUIAPI CreateMainWindowIndirect (
08815                 PDLGTEMPLATE pDlgTemplate, HWND hOwner, WNDPROC WndProc)
08816 {
08817     return CreateMainWindowIndirectParam (pDlgTemplate, hOwner, WndProc, 0);
08818 }
08819 
08831 MG_EXPORT BOOL GUIAPI DestroyMainWindowIndirect (HWND hMainWin);
08832 
08866 MG_EXPORT int GUIAPI DialogBoxIndirectParamEx (PDLGTEMPLATE pDlgTemplate,
08867         HWND hOwner, WNDPROC DlgProc, LPARAM lParam,
08868         const char* werdr_name, WINDOW_ELEMENT_ATTR* we_attrs,
08869         const char* window_name, const char* layer_name);
08870 
08882 static inline int GUIAPI DialogBoxIndirectParam (PDLGTEMPLATE pDlgTemplate,
08883                 HWND hOwner, WNDPROC DlgProc, LPARAM lParam)
08884 {
08885     return DialogBoxIndirectParamEx (pDlgTemplate, hOwner, DlgProc, lParam,
08886                 NULL, NULL, NULL, NULL);
08887 }
08888 
08906 MG_EXPORT BOOL GUIAPI EndDialog (HWND hDlg, int endCode);
08907 
08918 MG_EXPORT void GUIAPI DestroyAllControls (HWND hWnd);
08919 
08931 MG_EXPORT HWND GUIAPI GetDlgDefPushButton (HWND hWnd);
08932 
08945 MG_EXPORT int GUIAPI GetDlgCtrlID (HWND hwndCtl);
08946 
08959 MG_EXPORT HWND GUIAPI GetDlgItem (HWND hDlg, int nIDDlgItem);
08960 
08991 MG_EXPORT UINT GUIAPI GetDlgItemInt (HWND hDlg, int nIDDlgItem, 
08992                 BOOL *lpTranslated, BOOL bSigned);
08993 
09014 MG_EXPORT int GUIAPI GetDlgItemText (HWND hDlg, int nIDDlgItem, 
09015                 char* lpString, int nMaxCount);
09016 
09035 MG_EXPORT char* GUIAPI GetDlgItemText2 (HWND hDlg, int id, int* lenPtr);
09036 
09056 MG_EXPORT HWND GUIAPI GetNextDlgGroupItem (HWND hDlg, 
09057                 HWND hCtl, BOOL bPrevious);
09058 
09077 MG_EXPORT HWND GUIAPI GetNextDlgTabItem (HWND hDlg, HWND hCtl, BOOL bPrevious);
09078 
09098 MG_EXPORT int GUIAPI SendDlgItemMessage ( HWND hDlg, int nIDDlgItem, 
09099                 int message, WPARAM wParam, LPARAM lParam);
09100 
09121 MG_EXPORT BOOL GUIAPI SetDlgItemInt (HWND hDlg, int nIDDlgItem, 
09122                 UINT uValue, BOOL bSigned);
09123 
09141 MG_EXPORT BOOL GUIAPI SetDlgItemText (HWND hDlg, int nIDDlgItem, 
09142                 const char* lpString);
09143 
09144 #ifdef _MGCTRL_BUTTON
09145 
09168 MG_EXPORT void GUIAPI CheckDlgButton (HWND hDlg, int nIDDlgItem, int nCheck);
09169 
09188 MG_EXPORT void GUIAPI CheckRadioButton (HWND hDlg, 
09189                 int idFirstButton, int idLastButton, int idCheckButton);
09190 
09216 MG_EXPORT int  GUIAPI IsDlgButtonChecked (HWND hDlg, int idButton); 
09217 #endif
09218 
09226 #if defined(_MGCTRL_STATIC) && defined (_MGCTRL_BUTTON)
09227 
09228 /* Standard control IDs */
09229 #define IDC_STATIC    0
09230 #define IDOK          1
09231 #define IDCANCEL      2
09232 #define IDABORT       3
09233 #define IDRETRY       4
09234 #define IDIGNORE      5
09235 #define IDYES         6
09236 #define IDNO          7
09237 
09238 #define MINID_RESERVED      0xF001
09239 #define MAXID_RESERVED      0xFFFF
09240 
09241 #define MB_OK                   0x00000000
09242 #define MB_OKCANCEL             0x00000001
09243 #define MB_YESNO                0x00000002
09244 #define MB_RETRYCANCEL          0x00000003
09245 #define MB_ABORTRETRYIGNORE     0x00000004
09246 #define MB_YESNOCANCEL          0x00000005
09247 #define MB_CANCELASBACK         0x00000008  /* customized style */
09248 #define MB_TYPEMASK             0x00000007
09249 
09250 #define MB_ICONHAND             0x00000010
09251 #define MB_ICONQUESTION         0x00000020
09252 #define MB_ICONEXCLAMATION      0x00000030
09253 #define MB_ICONASTERISK         0x00000040
09254 #define MB_ICONMASK             0x000000F0
09255 
09256 #define MB_ICONINFORMATION      MB_ICONASTERISK
09257 #define MB_ICONSTOP             MB_ICONHAND
09258 
09259 #define MB_DEFBUTTON1           0x00000000
09260 #define MB_DEFBUTTON2           0x00000100
09261 #define MB_DEFBUTTON3           0x00000200
09262 #define MB_DEFMASK              0x00000F00
09263 
09264 /* #define MB_APPLMODAL            0x00000000 */
09265 /* #define MB_SYSTEMMODAL          0x00001000 */
09266 /* #define MB_TASKMODAL            0x00002000 */
09267 
09268 #define MB_NOFOCUS              0x00008000
09269 
09270 #define MB_ALIGNCENTER          0x00000000
09271 #define MB_ALIGNTOPLEFT         0x00010000
09272 #define MB_ALIGNBTMLEFT         0x00020000
09273 #define MB_ALIGNTOPRIGHT        0x00030000
09274 #define MB_ALIGNBTMRIGHT        0x00040000
09275 #define MB_ALIGNMASK            0x00070000
09276 
09277 #define MB_BASEDONPARENT        0x00080000  /* default is desktop. */
09278 
09381 MG_EXPORT int GUIAPI MessageBox (HWND hParentWnd, const char* pszText, 
09382                       const char* pszCaption, DWORD dwStyle);
09383 
09384 #endif /* _MGCTRL_STATIC && _MGCTRL_BUTTON */
09385 
09396 MG_EXPORT void GUIAPI MessageBeep (DWORD dwBeep);
09397 
09416 MG_EXPORT int GUIAPI SetBitmapKeyColor (HDC hdc, PBITMAP bmp, Uint8 r, Uint8 g, Uint8 b);
09417 
09422 #ifdef __cplusplus
09423 }
09424 #endif  /* __cplusplus */
09425 
09426 #endif /* _MGUI_WINDOW_H */
09427 
Generated on Thu Apr 7 15:58:31 2011 for MiniGUI V3.0.12 API Reference by  doxygen 1.6.3