Bugfixes & further updates for the month calendar common control.
[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 #define RDW_EX_DELAY_NCPAINT    0x0020
53
54 struct tagCLASS;
55 struct tagDCE;
56 struct tagDC;
57 struct tagWND_DRIVER;
58
59 typedef struct tagWND
60 {
61     struct tagWND *next;          /* Next sibling */
62     struct tagWND *child;         /* First child */
63     struct tagWND *parent;        /* Window parent (from CreateWindow) */
64     struct tagWND *owner;         /* Window owner */
65     struct tagCLASS *class;       /* Window class */
66     HWINDOWPROC    winproc;       /* Window procedure */
67     DWORD          dwMagic;       /* Magic number (must be WND_MAGIC) */
68     HWND         hwndSelf;      /* Handle of this window */
69     HINSTANCE    hInstance;     /* Window hInstance (from CreateWindow) */
70     RECT         rectClient;    /* Client area rel. to parent client area */
71     RECT         rectWindow;    /* Whole window rel. to parent client area */
72     LPSTR          text;          /* Window text */
73     void          *pVScroll;      /* Vertical scroll-bar info */
74     void          *pHScroll;      /* Horizontal scroll-bar info */
75     void          *pProp;         /* Pointer to properties list */
76     struct tagDCE *dce;           /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
77     HGLOBAL16      hmemTaskQ;     /* Task queue global memory handle */
78     HRGN16         hrgnUpdate;    /* Update region */
79     HWND         hwndLastActive;/* Last active popup hwnd */
80     DWORD          dwStyle;       /* Window style (from CreateWindow) */
81     DWORD          dwExStyle;     /* Extended style (from CreateWindowEx) */
82     UINT         wIDmenu;       /* ID or hmenu (from CreateWindow) */
83     DWORD          helpContext;   /* Help context ID */
84     WORD           flags;         /* Misc. flags (see below) */
85     HMENU16        hSysMenu;      /* window's copy of System Menu */
86     int            irefCount;     /* window's reference count*/
87     DWORD          userdata;      /* User private data */
88     struct tagWND_DRIVER *pDriver;  /* Window driver */
89     void          *pDriverData;   /* Window driver data */
90     DWORD          wExtra[1];     /* Window extra bytes */
91 } WND;
92
93 /* Host attributes */
94
95 #define HAK_BITGRAVITY     1
96 #define HAK_ACCEPTFOCUS    2
97 #define HAK_ICONICSTATE    3
98
99 /* Bit Gravity */
100
101 #define BGForget           0
102 #define BGNorthWest        1
103 #define BGNorth            2
104 #define BGNorthEast        3
105 #define BGWest             4
106 #define BGCenter           5
107 #define BGEast             6
108 #define BGSouthWest        7
109 #define BGSouth            8
110 #define BGSouthEast        9
111 #define BGStatic           10
112
113 typedef struct tagWND_DRIVER
114 {
115     void   (*pInitialize)(WND *);
116     void   (*pFinalize)(WND *);
117     BOOL (*pCreateDesktopWindow)(WND *, struct tagCLASS *, BOOL);
118     BOOL (*pCreateWindow)(WND *, struct tagCLASS *, CREATESTRUCTA *, BOOL);
119     BOOL (*pDestroyWindow)(WND *);
120     WND*   (*pSetParent)(WND *, WND *);
121     void   (*pForceWindowRaise)(WND *);
122     void   (*pSetWindowPos)(WND *, const WINDOWPOS *, BOOL);
123     void   (*pSetText)(WND *, LPCSTR);
124     void   (*pSetFocus)(WND *);
125     void   (*pPreSizeMove)(WND *);
126     void   (*pPostSizeMove)(WND *);
127     void   (*pSurfaceCopy)(WND *, struct tagDC *, INT, INT, const RECT *, BOOL);
128     void   (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL);
129     BOOL   (*pSetHostAttr)(WND *, INT haKey, INT value);
130     BOOL (*pIsSelfClipping)(WND *);
131 } WND_DRIVER;
132
133 extern WND_DRIVER *WND_Driver;
134
135 typedef struct
136 {
137     RECT16         rectNormal;
138     POINT16        ptIconPos;
139     POINT16        ptMaxPos;
140     HWND16         hwndIconTitle;
141 } INTERNALPOS, *LPINTERNALPOS;
142
143   /* WND flags values */
144 #define WIN_NEEDS_BEGINPAINT   0x0001 /* WM_PAINT sent to window */
145 #define WIN_NEEDS_ERASEBKGND   0x0002 /* WM_ERASEBKGND must be sent to window*/
146 #define WIN_NEEDS_NCPAINT      0x0004 /* WM_NCPAINT must be sent to window */
147 #define WIN_RESTORE_MAX        0x0008 /* Maximize when restoring */
148 #define WIN_INTERNAL_PAINT     0x0010 /* Internal WM_PAINT message pending */
149 #define WIN_NATIVE             0x0020 /* Directly mapped to the window provided by the driver */
150 #define WIN_NEED_SIZE          0x0040 /* Internal WM_SIZE is needed */
151 #define WIN_NCACTIVATED        0x0080 /* last WM_NCACTIVATE was positive */
152 #define WIN_MANAGED            0x0100 /* Window managed by the window system */
153 #define WIN_ISDIALOG           0x0200 /* Window is a dialog */
154 #define WIN_ISWIN32            0x0400 /* Understands Win32 messages */
155
156   /* BuildWinArray() flags */
157 #define BWA_SKIPDISABLED        0x0001
158 #define BWA_SKIPHIDDEN          0x0002
159 #define BWA_SKIPOWNED           0x0004
160 #define BWA_SKIPICONIC          0x0008
161
162   /* WIN_UpdateNCRgn() flags */
163 #define UNC_CHECK               0x0001
164 #define UNC_ENTIRE              0x0002
165 #define UNC_REGION              0x0004
166 #define UNC_UPDATE              0x0008
167 #define UNC_DELAY_NCPAINT       0x0010
168 #define UNC_IN_BEGINPAINT       0x0020
169
170   /* Window functions */
171 extern void   WIN_Init( void );
172 extern void   WIN_LockWnds( void );
173 extern void   WIN_UnlockWnds( void );
174 extern int    WIN_SuspendWndsLock( void );
175 extern void   WIN_RestoreWndsLock(int ipreviousLock);
176 extern WND*   WIN_FindWndPtr( HWND hwnd );
177 extern WND*   WIN_LockWndPtr(WND *wndPtr);
178 extern void   WIN_ReleaseWndPtr(WND *wndPtr);
179 extern void   WIN_UpdateWndPtr(WND **oldPtr,WND *newPtr);
180 extern WND*   WIN_GetDesktop(void);
181 extern void   WIN_ReleaseDesktop(void);
182 extern void   WIN_DumpWindow( HWND hwnd );
183 extern void   WIN_WalkWindows( HWND hwnd, int indent );
184 extern BOOL WIN_UnlinkWindow( HWND hwnd );
185 extern BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
186 extern HWND WIN_FindWinToRepaint( HWND hwnd, HQUEUE16 hQueue );
187 extern BOOL WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew);
188 extern BOOL WIN_CreateDesktopWindow(void);
189 extern HWND WIN_GetTopParent( HWND hwnd );
190 extern WND*   WIN_GetTopParentPtr( WND* pWnd );
191 extern BOOL WIN_IsWindowDrawable(WND*, BOOL );
192 extern WND**  WIN_BuildWinArray( WND *wndPtr, UINT bwa, UINT* pnum );
193 extern void   WIN_ReleaseWinArray(WND **wndArray);
194
195 extern HWND CARET_GetHwnd(void);
196 extern void CARET_GetRect(LPRECT lprc);  /* windows/caret.c */
197
198 extern BOOL16 DRAG_QueryUpdate( HWND, SEGPTR, BOOL );
199 extern void DEFWND_SetText( WND *wndPtr, LPCSTR text );
200 extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT16 ctlType );     /* windows/defwnd.c */
201
202 extern void PROPERTY_RemoveWindowProps( WND *pWnd );                  /* windows/property.c */
203
204 extern BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
205                                   HRGN hrgnUpdate, UINT flags,
206                                   UINT control );                     /* windows/painting.c */
207 extern HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT flags);     /* windows/painting.c */
208
209 /* controls/widgets.c */
210 extern BOOL WIDGETS_Init( void );
211 extern BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls );  
212
213 /* controls/icontitle.c */
214 extern LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
215
216 extern HWND ICONTITLE_Create( WND* );
217 extern BOOL ICONTITLE_Init( void );
218
219 /* windows/focus.c */
220 extern void FOCUS_SwitchFocus( MESSAGEQUEUE *pMsgQ, HWND , HWND );
221
222 /* windows/edit.c */
223 extern LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
224
225 /* windows/listbox.c */
226 extern LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
227 extern LRESULT WINAPI ComboLBWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
228
229 /* generic method that returns TRUE if the window properties ask for a 
230    window manager type of border */
231 extern BOOL WIN_WindowNeedsWMBorder( DWORD style, DWORD exStyle );
232
233 #endif  /* __WINE_WIN_H */