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