Moved some more code to the X11 driver.
[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 "class.h"
11 #include "ldt.h"
12 #include "windows.h"
13 #include "winproc.h"
14
15 #define WND_MAGIC     0x444e4957  /* 'WIND' */
16
17   /* Built-in class names (see _Undocumented_Windows_ p.418) */
18 #define POPUPMENU_CLASS_NAME "#32768"  /* PopupMenu */
19 #define DESKTOP_CLASS_NAME   "#32769"  /* Desktop */
20 #define DIALOG_CLASS_NAME    "#32770"  /* Dialog */
21 #define WINSWITCH_CLASS_NAME "#32771"  /* WinSwitch */
22 #define ICONTITLE_CLASS_NAME "#32772"  /* IconTitle */
23
24 #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768)  /* PopupMenu */
25 #define DESKTOP_CLASS_ATOM   ((ATOM)32769)       /* Desktop */
26 #define DIALOG_CLASS_ATOM    MAKEINTATOM(32770)  /* Dialog */
27 #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771)  /* WinSwitch */
28 #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772)  /* IconTitle */
29
30 /* Built-in 32-bit classes */
31 typedef enum
32 {
33     BIC32_BUTTON,
34     BIC32_EDIT,
35     BIC32_LISTBOX,
36     BIC32_COMBO,
37     BIC32_COMBOLB,
38     BIC32_POPUPMENU,
39     BIC32_STATIC,
40     BIC32_SCROLL,
41     BIC32_MDICLIENT,
42     BIC32_DESKTOP,
43     BIC32_DIALOG,
44     BIC32_ICONTITLE,
45     BIC32_NB_CLASSES
46 } BUILTIN_CLASS32;
47
48   /* PAINT_RedrawWindow() control flags */
49 #define RDW_C_USEHRGN           0x0001
50 #define RDW_C_DELETEHRGN        0x0002
51
52 struct tagCLASS;
53 struct tagDCE;
54 struct tagDC;
55 struct _WND_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     HWND32         hwndSelf;      /* Handle of this window */
67     HINSTANCE32    hInstance;     /* Window hInstance (from CreateWindow) */
68     RECT32         rectClient;    /* Client area rel. to parent client area */
69     RECT32         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     HWND32         hwndLastActive;/* Last active popup hwnd */
78     DWORD          dwStyle;       /* Window style (from CreateWindow) */
79     DWORD          dwExStyle;     /* Extended style (from CreateWindowEx) */
80     UINT32         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     DWORD          userdata;      /* User private data */
85     struct _WND_DRIVER *pDriver;  /* Window driver */
86     void          *pDriverData;   /* Window driver data */
87     DWORD          wExtra[1];     /* Window extra bytes */
88 } WND;
89
90 typedef struct _WND_DRIVER
91 {
92     void   (*pInitialize)(WND *);
93     void   (*pFinalize)(WND *);
94     BOOL32 (*pCreateDesktopWindow)(WND *, struct tagCLASS *, BOOL32);
95     BOOL32 (*pCreateWindow)(WND *, struct tagCLASS *, CREATESTRUCT32A *, BOOL32);
96     BOOL32 (*pDestroyWindow)(WND *);
97     WND*   (*pSetParent)(WND *, WND *);
98     void   (*pForceWindowRaise)(WND *);
99     void   (*pSetWindowPos)(WND *, const WINDOWPOS32 *, BOOL32);
100     void   (*pSetText)(WND *, LPCSTR);
101     void   (*pSetFocus)(WND *);
102     void   (*pPreSizeMove)(WND *);
103     void   (*pPostSizeMove)(WND *);
104     void   (*pScrollWindow)(WND *, struct tagDC *, INT32, INT32, const RECT32 *, BOOL32);
105     void   (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL32);
106     BOOL32 (*pIsSelfClipping)(WND *);
107 } WND_DRIVER;
108
109 typedef struct
110 {
111     RECT16         rectNormal;
112     POINT16        ptIconPos;
113     POINT16        ptMaxPos;
114     HWND16         hwndIconTitle;
115 } INTERNALPOS, *LPINTERNALPOS;
116
117   /* WND flags values */
118 #define WIN_NEEDS_BEGINPAINT   0x0001 /* WM_PAINT sent to window */
119 #define WIN_NEEDS_ERASEBKGND   0x0002 /* WM_ERASEBKGND must be sent to window*/
120 #define WIN_NEEDS_NCPAINT      0x0004 /* WM_NCPAINT must be sent to window */
121 #define WIN_RESTORE_MAX        0x0008 /* Maximize when restoring */
122 #define WIN_INTERNAL_PAINT     0x0010 /* Internal WM_PAINT message pending */
123 /* Used to have WIN_NO_REDRAW  0x0020 here */
124 #define WIN_NEED_SIZE          0x0040 /* Internal WM_SIZE is needed */
125 #define WIN_NCACTIVATED        0x0080 /* last WM_NCACTIVATE was positive */
126 #define WIN_MANAGED            0x0100 /* Window managed by the X wm */
127 #define WIN_ISDIALOG           0x0200 /* Window is a dialog */
128 #define WIN_ISWIN32            0x0400 /* Understands Win32 messages */
129 #define WIN_SAVEUNDER_OVERRIDE 0x0800
130
131   /* BuildWinArray() flags */
132 #define BWA_SKIPDISABLED        0x0001
133 #define BWA_SKIPHIDDEN          0x0002
134 #define BWA_SKIPOWNED           0x0004
135 #define BWA_SKIPICONIC          0x0008
136
137   /* Window functions */
138 extern WND*   WIN_FindWndPtr( HWND32 hwnd );
139 extern WND*   WIN_GetDesktop(void);
140 extern void   WIN_DumpWindow( HWND32 hwnd );
141 extern void   WIN_WalkWindows( HWND32 hwnd, int indent );
142 extern BOOL32 WIN_UnlinkWindow( HWND32 hwnd );
143 extern BOOL32 WIN_LinkWindow( HWND32 hwnd, HWND32 hwndInsertAfter );
144 extern HWND32 WIN_FindWinToRepaint( HWND32 hwnd, HQUEUE16 hQueue );
145 extern BOOL32 WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew);
146 extern BOOL32 WIN_CreateDesktopWindow(void);
147 extern HWND32 WIN_GetTopParent( HWND32 hwnd );
148 extern WND*   WIN_GetTopParentPtr( WND* pWnd );
149 extern BOOL32 WIN_IsWindowDrawable(WND*, BOOL32 );
150 extern HINSTANCE32 WIN_GetWindowInstance( HWND32 hwnd );
151 extern WND**  WIN_BuildWinArray( WND *wndPtr, UINT32 bwa, UINT32* pnum );
152
153 extern HWND32 CARET_GetHwnd(void);
154 extern void CARET_GetRect(LPRECT32 lprc);  /* windows/caret.c */
155
156 extern BOOL16 DRAG_QueryUpdate( HWND32, SEGPTR, BOOL32 );
157 extern void DEFWND_SetText( WND *wndPtr, LPCSTR text );
158 extern HBRUSH32 DEFWND_ControlColor( HDC32 hDC, UINT16 ctlType );     /* windows/defwnd.c */
159
160 extern void PROPERTY_RemoveWindowProps( WND *pWnd );                  /* windows/property.c */
161
162 extern BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate,
163                                   HRGN32 hrgnUpdate, UINT32 flags,
164                                   UINT32 control );                   /* windows/painting.c */
165
166 /* controls/widgets.c */
167 extern BOOL32 WIDGETS_Init( void );
168 extern BOOL32 WIDGETS_IsControl32( WND* pWnd, BUILTIN_CLASS32 cls );  
169
170 /* controls/icontitle.c */
171 extern HWND32 ICONTITLE_Create( WND* );
172 extern BOOL32 ICONTITLE_Init( void );
173
174 /* windows/focus.c */
175 extern void FOCUS_SwitchFocus( HWND32 , HWND32 );
176
177 #endif  /* __WINE_WIN_H */