winuser.h now requires that we include winbase.h first.
[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 "windef.h"
11 #include "winbase.h"
12 #include "wingdi.h"
13 #include "winproc.h"
14 #include "winuser.h"
15 #include "wine/windef16.h"
16
17 #define WND_MAGIC     0x444e4957  /* 'WIND' */
18
19   /* PAINT_RedrawWindow() control flags */
20 #define RDW_EX_USEHRGN          0x0001
21 #define RDW_EX_DELETEHRGN       0x0002
22 #define RDW_EX_XYWINDOW         0x0004
23 #define RDW_EX_TOPFRAME         0x0010
24 #define RDW_EX_DELAY_NCPAINT    0x0020
25
26 struct tagCLASS;
27 struct tagDCE;
28 struct tagMESSAGEQUEUE;
29 struct tagWND_DRIVER;
30
31 typedef struct tagWND
32 {
33     struct tagWND *next;          /* Next sibling */
34     struct tagWND *child;         /* First child */
35     struct tagWND *parent;        /* Window parent (from CreateWindow) */
36     struct tagWND *owner;         /* Window owner */
37     struct tagCLASS *class;       /* Window class */
38     HWINDOWPROC    winproc;       /* Window procedure */
39     DWORD          dwMagic;       /* Magic number (must be WND_MAGIC) */
40     HWND         hwndSelf;      /* Handle of this window */
41     HINSTANCE    hInstance;     /* Window hInstance (from CreateWindow) */
42     RECT         rectClient;    /* Client area rel. to parent client area */
43     RECT         rectWindow;    /* Whole window rel. to parent client area */
44     LPWSTR        text;           /* Window text */
45     void          *pVScroll;      /* Vertical scroll-bar info */
46     void          *pHScroll;      /* Horizontal scroll-bar info */
47     void          *pProp;         /* Pointer to properties list */
48     struct tagDCE *dce;           /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
49     HGLOBAL16      hmemTaskQ;     /* Task queue global memory handle */
50     HRGN16         hrgnUpdate;    /* Update region */
51     HRGN           hrgnWnd;       /* window's region */
52     HWND           hwndLastActive;/* Last active popup hwnd */
53     DWORD          dwStyle;       /* Window style (from CreateWindow) */
54     DWORD          dwExStyle;     /* Extended style (from CreateWindowEx) */
55     DWORD          clsStyle;      /* Class style at window creation */
56     UINT           wIDmenu;       /* ID or hmenu (from CreateWindow) */
57     DWORD          helpContext;   /* Help context ID */
58     WORD           flags;         /* Misc. flags (see below) */
59     HMENU16        hSysMenu;      /* window's copy of System Menu */
60     int            cbWndExtra;    /* class cbWndExtra at window creation */
61     int            irefCount;     /* window's reference count*/
62     DWORD          userdata;      /* User private data */
63     struct tagWND_DRIVER *pDriver;  /* Window driver */
64     void          *pDriverData;   /* Window driver data */
65     DWORD          wExtra[1];     /* Window extra bytes */
66 } WND;
67
68 /* Host attributes */
69
70 #define HAK_BITGRAVITY     1
71 #define HAK_ACCEPTFOCUS    2
72 #define HAK_ICONICSTATE    3
73 #define HAK_ICONS          4
74
75 /* Bit Gravity */
76
77 #define BGForget           0
78 #define BGNorthWest        1
79 #define BGNorth            2
80 #define BGNorthEast        3
81 #define BGWest             4
82 #define BGCenter           5
83 #define BGEast             6
84 #define BGSouthWest        7
85 #define BGSouth            8
86 #define BGSouthEast        9
87 #define BGStatic           10
88
89 typedef struct tagWND_DRIVER
90 {
91     void   (*pInitialize)(WND *);
92     void   (*pFinalize)(WND *);
93     BOOL   (*pCreateDesktopWindow)(WND *);
94     BOOL   (*pCreateWindow)(WND *, CREATESTRUCTA *, BOOL);
95     BOOL (*pDestroyWindow)(WND *);
96     WND*   (*pSetParent)(WND *, WND *);
97     void   (*pForceWindowRaise)(WND *);
98     void   (*pSetWindowPos)(WND *, const WINDOWPOS *, BOOL);
99     void   (*pSetText)(WND *, LPCWSTR);
100     void   (*pSetFocus)(WND *);
101     void   (*pPreSizeMove)(WND *);
102     void   (*pPostSizeMove)(WND *);
103     void   (*pSurfaceCopy)(WND *, HDC, INT, INT, const RECT *, BOOL);
104     void   (*pSetDrawable)(WND *, HDC, WORD, BOOL);
105     BOOL   (*pSetHostAttr)(WND *, INT haKey, INT value);
106     BOOL (*pIsSelfClipping)(WND *);
107     void   (*pSetWindowRgn)(WND *, const HRGN);
108 } WND_DRIVER;
109
110 extern WND_DRIVER *WND_Driver;
111
112 typedef struct
113 {
114     RECT16         rectNormal;
115     POINT16        ptIconPos;
116     POINT16        ptMaxPos;
117     HWND16         hwndIconTitle;
118 } INTERNALPOS, *LPINTERNALPOS;
119
120   /* WND flags values */
121 #define WIN_NEEDS_BEGINPAINT   0x0001 /* WM_PAINT sent to window */
122 #define WIN_NEEDS_ERASEBKGND   0x0002 /* WM_ERASEBKGND must be sent to window*/
123 #define WIN_NEEDS_NCPAINT      0x0004 /* WM_NCPAINT must be sent to window */
124 #define WIN_RESTORE_MAX        0x0008 /* Maximize when restoring */
125 #define WIN_INTERNAL_PAINT     0x0010 /* Internal WM_PAINT message pending */
126 #define WIN_NATIVE             0x0020 /* Directly mapped to the window provided by the driver */
127 #define WIN_NEED_SIZE          0x0040 /* Internal WM_SIZE is needed */
128 #define WIN_NCACTIVATED        0x0080 /* last WM_NCACTIVATE was positive */
129 #define WIN_ISDIALOG           0x0200 /* Window is a dialog */
130 #define WIN_ISWIN32            0x0400 /* Understands Win32 messages */
131 #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0800 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
132 #define WIN_NEEDS_INTERNALSOP  0x1000 /* Window was hidden by WIN_InternalShowOwnedPopups */
133
134   /* BuildWinArray() flags */
135 #define BWA_SKIPDISABLED        0x0001
136 #define BWA_SKIPHIDDEN          0x0002
137 #define BWA_SKIPOWNED           0x0004
138 #define BWA_SKIPICONIC          0x0008
139
140   /* WIN_UpdateNCRgn() flags */
141 #define UNC_CHECK               0x0001
142 #define UNC_ENTIRE              0x0002
143 #define UNC_REGION              0x0004
144 #define UNC_UPDATE              0x0008
145 #define UNC_DELAY_NCPAINT       0x0010
146 #define UNC_IN_BEGINPAINT       0x0020
147
148   /* Window functions */
149 extern void   WIN_LockWnds( void );
150 extern void   WIN_UnlockWnds( void );
151 extern int    WIN_SuspendWndsLock( void );
152 extern void   WIN_RestoreWndsLock(int ipreviousLock);
153 extern WND*   WIN_FindWndPtr( HWND hwnd );
154 extern WND*   WIN_LockWndPtr(WND *wndPtr);
155 extern void   WIN_ReleaseWndPtr(WND *wndPtr);
156 extern void   WIN_UpdateWndPtr(WND **oldPtr,WND *newPtr);
157 extern WND*   WIN_GetDesktop(void);
158 extern void   WIN_ReleaseDesktop(void);
159 extern void   WIN_DumpWindow( HWND hwnd );
160 extern void   WIN_WalkWindows( HWND hwnd, int indent );
161 extern BOOL WIN_UnlinkWindow( HWND hwnd );
162 extern BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
163 extern HWND WIN_FindWinToRepaint( HWND hwnd, HQUEUE16 hQueue );
164 extern BOOL WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew);
165 extern BOOL WIN_CreateDesktopWindow(void);
166 extern HWND WIN_GetTopParent( HWND hwnd );
167 extern WND*   WIN_GetTopParentPtr( WND* pWnd );
168 extern BOOL WIN_IsWindowDrawable(WND*, BOOL );
169 extern WND**  WIN_BuildWinArray( WND *wndPtr, UINT bwa, UINT* pnum );
170 extern void   WIN_ReleaseWinArray(WND **wndArray);
171 extern BOOL WIN_InternalShowOwnedPopups( HWND owner, BOOL fShow, BOOL unmanagedOnly );
172
173 extern HICON16 NC_IconForWindow( WND *wndPtr );
174
175 extern HWND CARET_GetHwnd(void);
176 extern void CARET_GetRect(LPRECT lprc);  /* windows/caret.c */
177
178 extern BOOL16 DRAG_QueryUpdate( HWND, SEGPTR, BOOL );
179 extern void DEFWND_SetTextA( WND *wndPtr, LPCSTR text );
180 extern void DEFWND_SetTextW( WND *wndPtr, LPCWSTR text );
181 extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT16 ctlType );     /* windows/defwnd.c */
182
183 extern void PROPERTY_RemoveWindowProps( WND *pWnd );                  /* windows/property.c */
184
185 extern BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
186                                   HRGN hrgnUpdate, UINT flags,
187                                   UINT control );                     /* windows/painting.c */
188 extern HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT flags);     /* windows/painting.c */
189
190 /* Classes functions */
191 struct tagCLASS;  /* opaque structure */
192 struct builtin_class_descr;
193 extern ATOM CLASS_RegisterBuiltinClass( const struct builtin_class_descr *descr );
194 extern struct tagCLASS *CLASS_AddWindow( ATOM atom, HINSTANCE inst, WINDOWPROCTYPE type,
195                                          INT *winExtra, WNDPROC *winproc,
196                                          DWORD *style, struct tagDCE **dce );
197 extern void CLASS_RemoveWindow( struct tagCLASS *cls );
198 extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
199
200 /* windows/focus.c */
201 extern void FOCUS_SwitchFocus( struct tagMESSAGEQUEUE *pMsgQ, HWND , HWND );
202
203 /* generic method that returns TRUE if the window properties ask for a 
204    window manager type of border */
205 extern BOOL WIN_WindowNeedsWMBorder( DWORD style, DWORD exStyle );
206
207 #endif  /* __WINE_WIN_H */