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