Fixed DestroyAcceleratorTable and implemented CreateAcceleratorTableW.
[wine] / include / win.h
1 /*
2  * Window definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  */
6
7 #ifndef __WINE_WIN_H
8 #define __WINE_WIN_H
9
10 #include "winuser.h"
11 #include "queue.h"
12 #include "class.h"
13
14 #define WND_MAGIC     0x444e4957  /* 'WIND' */
15
16   /* Built-in class names (see _Undocumented_Windows_ p.418) */
17 #define POPUPMENU_CLASS_NAME "#32768"  /* PopupMenu */
18 #define DESKTOP_CLASS_NAME   "#32769"  /* Desktop */
19 #define DIALOG_CLASS_NAME    "#32770"  /* Dialog */
20 #define WINSWITCH_CLASS_NAME "#32771"  /* WinSwitch */
21 #define ICONTITLE_CLASS_NAME "#32772"  /* IconTitle */
22
23 #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768)  /* PopupMenu */
24 #define DESKTOP_CLASS_ATOM   ((ATOM)32769)       /* Desktop */
25 #define DIALOG_CLASS_ATOM    MAKEINTATOM(32770)  /* Dialog */
26 #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771)  /* WinSwitch */
27 #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772)  /* IconTitle */
28
29 /* Built-in 32-bit classes */
30 typedef enum
31 {
32     BIC32_BUTTON,
33     BIC32_EDIT,
34     BIC32_LISTBOX,
35     BIC32_COMBO,
36     BIC32_COMBOLB,
37     BIC32_POPUPMENU,
38     BIC32_STATIC,
39     BIC32_SCROLL,
40     BIC32_MDICLIENT,
41     BIC32_DESKTOP,
42     BIC32_DIALOG,
43     BIC32_ICONTITLE,
44     BIC32_NB_CLASSES
45 } BUILTIN_CLASS32;
46
47   /* PAINT_RedrawWindow() control flags */
48 #define RDW_EX_USEHRGN          0x0001
49 #define RDW_EX_DELETEHRGN       0x0002
50 #define RDW_EX_XYWINDOW         0x0004
51 #define RDW_EX_TOPFRAME         0x0010
52
53 struct tagCLASS;
54 struct tagDCE;
55 struct tagDC;
56 struct tagWND_DRIVER;
57
58 typedef struct tagWND
59 {
60     struct tagWND *next;          /* Next sibling */
61     struct tagWND *child;         /* First child */
62     struct tagWND *parent;        /* Window parent (from CreateWindow) */
63     struct tagWND *owner;         /* Window owner */
64     struct tagCLASS *class;       /* Window class */
65     HWINDOWPROC    winproc;       /* Window procedure */
66     DWORD          dwMagic;       /* Magic number (must be WND_MAGIC) */
67     HWND         hwndSelf;      /* Handle of this window */
68     HINSTANCE    hInstance;     /* Window hInstance (from CreateWindow) */
69     RECT         rectClient;    /* Client area rel. to parent client area */
70     RECT         rectWindow;    /* Whole window rel. to parent client area */
71     LPSTR          text;          /* Window text */
72     void          *pVScroll;      /* Vertical scroll-bar info */
73     void          *pHScroll;      /* Horizontal scroll-bar info */
74     void          *pProp;         /* Pointer to properties list */
75     struct tagDCE *dce;           /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
76     HGLOBAL16      hmemTaskQ;     /* Task queue global memory handle */
77     HRGN16         hrgnUpdate;    /* Update region */
78     HWND         hwndLastActive;/* Last active popup hwnd */
79     DWORD          dwStyle;       /* Window style (from CreateWindow) */
80     DWORD          dwExStyle;     /* Extended style (from CreateWindowEx) */
81     UINT         wIDmenu;       /* ID or hmenu (from CreateWindow) */
82     DWORD          helpContext;   /* Help context ID */
83     WORD           flags;         /* Misc. flags (see below) */
84     HMENU16        hSysMenu;      /* window's copy of System Menu */
85     int            irefCount;     /* window's reference count*/
86     DWORD          userdata;      /* User private data */
87     struct tagWND_DRIVER *pDriver;  /* Window driver */
88     void          *pDriverData;   /* Window driver data */
89     DWORD          wExtra[1];     /* Window extra bytes */
90 } WND;
91
92 /* Host attributes */
93
94 #define HAK_BITGRAVITY     1
95 #define HAK_ACCEPTFOCUS    2
96 #define HAK_ICONICSTATE    3
97
98 /* Bit Gravity */
99
100 #define BGForget           0
101 #define BGNorthWest        1
102 #define BGNorth            2
103 #define BGNorthEast        3
104 #define BGWest             4
105 #define BGCenter           5
106 #define BGEast             6
107 #define BGSouthWest        7
108 #define BGSouth            8
109 #define BGSouthEast        9
110 #define BGStatic           10
111
112 typedef struct tagWND_DRIVER
113 {
114     void   (*pInitialize)(WND *);
115     void   (*pFinalize)(WND *);
116     BOOL (*pCreateDesktopWindow)(WND *, struct tagCLASS *, BOOL);
117     BOOL (*pCreateWindow)(WND *, struct tagCLASS *, CREATESTRUCTA *, BOOL);
118     BOOL (*pDestroyWindow)(WND *);
119     WND*   (*pSetParent)(WND *, WND *);
120     void   (*pForceWindowRaise)(WND *);
121     void   (*pSetWindowPos)(WND *, const WINDOWPOS *, BOOL);
122     void   (*pSetText)(WND *, LPCSTR);
123     void   (*pSetFocus)(WND *);
124     void   (*pPreSizeMove)(WND *);
125     void   (*pPostSizeMove)(WND *);
126     void   (*pSurfaceCopy)(WND *, struct tagDC *, INT, INT, const RECT *, BOOL);
127     void   (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL);
128     BOOL   (*pSetHostAttr)(WND *, INT haKey, INT value);
129     BOOL (*pIsSelfClipping)(WND *);
130 } WND_DRIVER;
131
132 extern WND_DRIVER *WND_Driver;
133
134 typedef struct
135 {
136     RECT16         rectNormal;
137     POINT16        ptIconPos;
138     POINT16        ptMaxPos;
139     HWND16         hwndIconTitle;
140 } INTERNALPOS, *LPINTERNALPOS;
141
142   /* WND flags values */
143 #define WIN_NEEDS_BEGINPAINT   0x0001 /* WM_PAINT sent to window */
144 #define WIN_NEEDS_ERASEBKGND   0x0002 /* WM_ERASEBKGND must be sent to window*/
145 #define WIN_NEEDS_NCPAINT      0x0004 /* WM_NCPAINT must be sent to window */
146 #define WIN_RESTORE_MAX        0x0008 /* Maximize when restoring */
147 #define WIN_INTERNAL_PAINT     0x0010 /* Internal WM_PAINT message pending */
148 #define WIN_NATIVE             0x0020 /* Directly mapped to the window provided by the driver */
149 #define WIN_NEED_SIZE          0x0040 /* Internal WM_SIZE is needed */
150 #define WIN_NCACTIVATED        0x0080 /* last WM_NCACTIVATE was positive */
151 #define WIN_MANAGED            0x0100 /* Window managed by the window system */
152 #define WIN_ISDIALOG           0x0200 /* Window is a dialog */
153 #define WIN_ISWIN32            0x0400 /* Understands Win32 messages */
154
155   /* BuildWinArray() flags */
156 #define BWA_SKIPDISABLED        0x0001
157 #define BWA_SKIPHIDDEN          0x0002
158 #define BWA_SKIPOWNED           0x0004
159 #define BWA_SKIPICONIC          0x0008
160
161   /* WIN_UpdateNCRgn() flags */
162 #define UNC_CHECK               0x0001
163 #define UNC_ENTIRE              0x0002
164 #define UNC_REGION              0x0004
165 #define UNC_UPDATE              0x0008
166
167   /* Window functions */
168 extern void   WIN_Init( void );
169 extern void   WIN_LockWnds( void );
170 extern void   WIN_UnlockWnds( void );
171 extern int    WIN_SuspendWndsLock( void );
172 extern void   WIN_RestoreWndsLock(int ipreviousLock);
173 extern WND*   WIN_FindWndPtr( HWND hwnd );
174 extern WND*   WIN_LockWndPtr(WND *wndPtr);
175 extern void   WIN_ReleaseWndPtr(WND *wndPtr);
176 extern void   WIN_UpdateWndPtr(WND **oldPtr,WND *newPtr);
177 extern WND*   WIN_GetDesktop(void);
178 extern void   WIN_ReleaseDesktop(void);
179 extern void   WIN_DumpWindow( HWND hwnd );
180 extern void   WIN_WalkWindows( HWND hwnd, int indent );
181 extern BOOL WIN_UnlinkWindow( HWND hwnd );
182 extern BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
183 extern HWND WIN_FindWinToRepaint( HWND hwnd, HQUEUE16 hQueue );
184 extern BOOL WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew);
185 extern BOOL WIN_CreateDesktopWindow(void);
186 extern HWND WIN_GetTopParent( HWND hwnd );
187 extern WND*   WIN_GetTopParentPtr( WND* pWnd );
188 extern BOOL WIN_IsWindowDrawable(WND*, BOOL );
189 extern WND**  WIN_BuildWinArray( WND *wndPtr, UINT bwa, UINT* pnum );
190 extern void   WIN_ReleaseWinArray(WND **wndArray);
191
192 extern HWND CARET_GetHwnd(void);
193 extern void CARET_GetRect(LPRECT lprc);  /* windows/caret.c */
194
195 extern BOOL16 DRAG_QueryUpdate( HWND, SEGPTR, BOOL );
196 extern void DEFWND_SetText( WND *wndPtr, LPCSTR text );
197 extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT16 ctlType );     /* windows/defwnd.c */
198
199 extern void PROPERTY_RemoveWindowProps( WND *pWnd );                  /* windows/property.c */
200
201 extern BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
202                                   HRGN hrgnUpdate, UINT flags,
203                                   UINT control );                     /* windows/painting.c */
204 extern HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT flags);     /* windows/painting.c */
205
206 /* controls/widgets.c */
207 extern BOOL WIDGETS_Init( void );
208 extern BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls );  
209
210 /* controls/icontitle.c */
211 extern LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
212
213 extern HWND ICONTITLE_Create( WND* );
214 extern BOOL ICONTITLE_Init( void );
215
216 /* windows/focus.c */
217 extern void FOCUS_SwitchFocus( MESSAGEQUEUE *pMsgQ, HWND , HWND );
218
219 /* windows/edit.c */
220 extern LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
221
222 /* windows/listbox.c */
223 extern LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
224 extern LRESULT WINAPI ComboLBWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
225
226 #endif  /* __WINE_WIN_H */