More code moved to the X11 driver (bitmap and palette and misc).
[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
96 /* Bit Gravity */
97
98 #define BGForget           0
99 #define BGNorthWest        1
100 #define BGNorth            2
101 #define BGNorthEast        3
102 #define BGWest             4
103 #define BGCenter           5
104 #define BGEast             6
105 #define BGSouthWest        7
106 #define BGSouth            8
107 #define BGSouthEast        9
108 #define BGStatic           10
109
110 typedef struct tagWND_DRIVER
111 {
112     void   (*pInitialize)(WND *);
113     void   (*pFinalize)(WND *);
114     BOOL (*pCreateDesktopWindow)(WND *, struct tagCLASS *, BOOL);
115     BOOL (*pCreateWindow)(WND *, struct tagCLASS *, CREATESTRUCTA *, BOOL);
116     BOOL (*pDestroyWindow)(WND *);
117     WND*   (*pSetParent)(WND *, WND *);
118     void   (*pForceWindowRaise)(WND *);
119     void   (*pSetWindowPos)(WND *, const WINDOWPOS *, BOOL);
120     void   (*pSetText)(WND *, LPCSTR);
121     void   (*pSetFocus)(WND *);
122     void   (*pPreSizeMove)(WND *);
123     void   (*pPostSizeMove)(WND *);
124     void   (*pSurfaceCopy)(WND *, struct tagDC *, INT, INT, const RECT *, BOOL);
125     void   (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL);
126     BOOL   (*pSetHostAttr)(WND *, INT haKey, INT value);
127     BOOL (*pIsSelfClipping)(WND *);
128 } WND_DRIVER;
129
130 extern WND_DRIVER *WND_Driver;
131
132 typedef struct
133 {
134     RECT16         rectNormal;
135     POINT16        ptIconPos;
136     POINT16        ptMaxPos;
137     HWND16         hwndIconTitle;
138 } INTERNALPOS, *LPINTERNALPOS;
139
140   /* WND flags values */
141 #define WIN_NEEDS_BEGINPAINT   0x0001 /* WM_PAINT sent to window */
142 #define WIN_NEEDS_ERASEBKGND   0x0002 /* WM_ERASEBKGND must be sent to window*/
143 #define WIN_NEEDS_NCPAINT      0x0004 /* WM_NCPAINT must be sent to window */
144 #define WIN_RESTORE_MAX        0x0008 /* Maximize when restoring */
145 #define WIN_INTERNAL_PAINT     0x0010 /* Internal WM_PAINT message pending */
146 #define WIN_NATIVE             0x0020 /* Directly mapped to the window provided by the driver */
147 #define WIN_NEED_SIZE          0x0040 /* Internal WM_SIZE is needed */
148 #define WIN_NCACTIVATED        0x0080 /* last WM_NCACTIVATE was positive */
149 #define WIN_MANAGED            0x0100 /* Window managed by the window system */
150 #define WIN_ISDIALOG           0x0200 /* Window is a dialog */
151 #define WIN_ISWIN32            0x0400 /* Understands Win32 messages */
152
153   /* BuildWinArray() flags */
154 #define BWA_SKIPDISABLED        0x0001
155 #define BWA_SKIPHIDDEN          0x0002
156 #define BWA_SKIPOWNED           0x0004
157 #define BWA_SKIPICONIC          0x0008
158
159   /* Window functions */
160 extern void   WIN_LockWnds();
161 extern void   WIN_UnlockWnds();
162 extern int    WIN_SuspendWndsLock();
163 extern void   WIN_RestoreWndsLock(int ipreviousLock);
164 extern WND*   WIN_FindWndPtr( HWND hwnd );
165 extern WND*   WIN_LockWndPtr(WND *wndPtr);
166 extern void   WIN_ReleaseWndPtr(WND *wndPtr);
167 extern void   WIN_UpdateWndPtr(WND **oldPtr,WND *newPtr);
168 extern WND*   WIN_GetDesktop(void);
169 extern void   WIN_ReleaseDesktop(void);
170 extern void   WIN_DumpWindow( HWND hwnd );
171 extern void   WIN_WalkWindows( HWND hwnd, int indent );
172 extern BOOL WIN_UnlinkWindow( HWND hwnd );
173 extern BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
174 extern HWND WIN_FindWinToRepaint( HWND hwnd, HQUEUE16 hQueue );
175 extern BOOL WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew);
176 extern BOOL WIN_CreateDesktopWindow(void);
177 extern HWND WIN_GetTopParent( HWND hwnd );
178 extern WND*   WIN_GetTopParentPtr( WND* pWnd );
179 extern BOOL WIN_IsWindowDrawable(WND*, BOOL );
180 extern HINSTANCE WIN_GetWindowInstance( HWND hwnd );
181 extern WND**  WIN_BuildWinArray( WND *wndPtr, UINT bwa, UINT* pnum );
182 extern void   WIN_ReleaseWinArray(WND **wndArray);
183
184 extern HWND CARET_GetHwnd(void);
185 extern void CARET_GetRect(LPRECT lprc);  /* windows/caret.c */
186
187 extern BOOL16 DRAG_QueryUpdate( HWND, SEGPTR, BOOL );
188 extern void DEFWND_SetText( WND *wndPtr, LPCSTR text );
189 extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT16 ctlType );     /* windows/defwnd.c */
190
191 extern void PROPERTY_RemoveWindowProps( WND *pWnd );                  /* windows/property.c */
192
193 extern BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
194                                   HRGN hrgnUpdate, UINT flags,
195                                   UINT control );                     /* windows/painting.c */
196 extern HRGN WIN_UpdateNCRgn(WND* wnd, BOOL bUpdate, BOOL bForce);     /* windows/painting.c */
197
198
199 /* controls/widgets.c */
200 extern BOOL WIDGETS_Init( void );
201 extern BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls );  
202
203 /* controls/icontitle.c */
204 extern HWND ICONTITLE_Create( WND* );
205 extern BOOL ICONTITLE_Init( void );
206
207 /* windows/focus.c */
208 extern void FOCUS_SwitchFocus( MESSAGEQUEUE *pMsgQ, HWND , HWND );
209
210 #endif  /* __WINE_WIN_H */