blob: 1198ddb07555382599946f966529176b66539f4b [file] [log] [blame]
Alexandre Julliard75a839a1993-07-15 11:13:45 +00001/*
2 * Window definitions
3 *
4 * Copyright 1993 Alexandre Julliard
5 */
6
Alexandre Julliardc6c09441997-01-12 18:32:19 +00007#ifndef __WINE_WIN_H
8#define __WINE_WIN_H
Alexandre Julliard75a839a1993-07-15 11:13:45 +00009
Marcus Meissner623c0d61999-07-03 16:01:42 +000010#include "winuser.h"
Noel Borthwickb4278561999-02-05 10:37:53 +000011#include "queue.h"
Marcus Meissner317af321999-02-17 13:51:06 +000012#include "class.h"
Alexandre Julliard75a839a1993-07-15 11:13:45 +000013
14#define WND_MAGIC 0x444e4957 /* 'WIND' */
15
Alexandre Julliardfb9a9191994-03-01 19:48:04 +000016 /* Built-in class names (see _Undocumented_Windows_ p.418) */
17#define POPUPMENU_CLASS_NAME "#32768" /* PopupMenu */
18#define DESKTOP_CLASS_NAME "#32769" /* Desktop */
19#define DIALOG_CLASS_NAME "#32770" /* Dialog */
20#define WINSWITCH_CLASS_NAME "#32771" /* WinSwitch */
21#define ICONTITLE_CLASS_NAME "#32772" /* IconTitle */
Alexandre Julliard75a839a1993-07-15 11:13:45 +000022
Alexandre Julliard808cb041995-08-17 17:11:36 +000023#define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000024#define DESKTOP_CLASS_ATOM ((ATOM)32769) /* Desktop */
Alexandre Julliard808cb041995-08-17 17:11:36 +000025#define DIALOG_CLASS_ATOM MAKEINTATOM(32770) /* Dialog */
26#define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771) /* WinSwitch */
27#define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772) /* IconTitle */
28
Alexandre Julliarddf2673b1997-03-29 17:20:20 +000029/* Built-in 32-bit classes */
30typedef enum
31{
32 BIC32_BUTTON,
33 BIC32_EDIT,
34 BIC32_LISTBOX,
35 BIC32_COMBO,
36 BIC32_COMBOLB,
37 BIC32_POPUPMENU,
Alexandre Julliardd37eb361997-07-20 16:23:21 +000038 BIC32_STATIC,
Alexandre Julliarddf2673b1997-03-29 17:20:20 +000039 BIC32_SCROLL,
Alexandre Julliarda0b2b1d1997-11-16 17:38:29 +000040 BIC32_MDICLIENT,
Alexandre Julliarddf2673b1997-03-29 17:20:20 +000041 BIC32_DESKTOP,
42 BIC32_DIALOG,
Alexandre Julliard23946ad1997-06-16 17:43:53 +000043 BIC32_ICONTITLE,
Alexandre Julliarddf2673b1997-03-29 17:20:20 +000044 BIC32_NB_CLASSES
45} BUILTIN_CLASS32;
46
Alexandre Julliard1e37a181996-08-18 16:21:52 +000047 /* PAINT_RedrawWindow() control flags */
Alex Korobka4f1ac051999-03-28 09:37:57 +000048#define RDW_EX_USEHRGN 0x0001
49#define RDW_EX_DELETEHRGN 0x0002
50#define RDW_EX_XYWINDOW 0x0004
51#define RDW_EX_TOPFRAME 0x0010
Francis Beaudetc37dd061999-07-18 15:38:29 +000052#define RDW_EX_DELAY_NCPAINT 0x0020
Alexandre Julliard1e37a181996-08-18 16:21:52 +000053
Patrik Stridvall8d8703c1999-02-04 14:05:38 +000054struct tagCLASS;
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +000055struct tagDCE;
Patrik Stridvall151170c1998-12-26 12:00:43 +000056struct tagDC;
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +000057struct tagWND_DRIVER;
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +000058
Alexandre Julliard75a839a1993-07-15 11:13:45 +000059typedef struct tagWND
60{
Alexandre Julliard2ace16a1996-04-28 15:09:19 +000061 struct tagWND *next; /* Next sibling */
62 struct tagWND *child; /* First child */
63 struct tagWND *parent; /* Window parent (from CreateWindow) */
64 struct tagWND *owner; /* Window owner */
Patrik Stridvall8d8703c1999-02-04 14:05:38 +000065 struct tagCLASS *class; /* Window class */
Alexandre Julliard3051b641996-07-05 17:14:13 +000066 HWINDOWPROC winproc; /* Window procedure */
Alexandre Julliard2ace16a1996-04-28 15:09:19 +000067 DWORD dwMagic; /* Magic number (must be WND_MAGIC) */
Alexandre Julliarda3960291999-02-26 11:11:13 +000068 HWND hwndSelf; /* Handle of this window */
69 HINSTANCE hInstance; /* Window hInstance (from CreateWindow) */
70 RECT rectClient; /* Client area rel. to parent client area */
71 RECT rectWindow; /* Whole window rel. to parent client area */
Alexandre Julliard2d93d001996-05-21 15:01:41 +000072 LPSTR text; /* Window text */
Alexandre Julliardca22b331996-07-12 19:02:39 +000073 void *pVScroll; /* Vertical scroll-bar info */
74 void *pHScroll; /* Horizontal scroll-bar info */
Alexandre Julliardac9c9b01996-07-28 18:50:11 +000075 void *pProp; /* Pointer to properties list */
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +000076 struct tagDCE *dce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
Alexandre Julliardac9c9b01996-07-28 18:50:11 +000077 HGLOBAL16 hmemTaskQ; /* Task queue global memory handle */
78 HRGN16 hrgnUpdate; /* Update region */
Alexandre Julliarda3960291999-02-26 11:11:13 +000079 HWND hwndLastActive;/* Last active popup hwnd */
Alexandre Julliard2ace16a1996-04-28 15:09:19 +000080 DWORD dwStyle; /* Window style (from CreateWindow) */
81 DWORD dwExStyle; /* Extended style (from CreateWindowEx) */
Alexandre Julliarda3960291999-02-26 11:11:13 +000082 UINT wIDmenu; /* ID or hmenu (from CreateWindow) */
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000083 DWORD helpContext; /* Help context ID */
Alexandre Julliard2ace16a1996-04-28 15:09:19 +000084 WORD flags; /* Misc. flags (see below) */
Alexandre Julliardac9c9b01996-07-28 18:50:11 +000085 HMENU16 hSysMenu; /* window's copy of System Menu */
Francois Boisvert93e3f901999-02-25 17:32:31 +000086 int irefCount; /* window's reference count*/
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000087 DWORD userdata; /* User private data */
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +000088 struct tagWND_DRIVER *pDriver; /* Window driver */
Patrik Stridvall151170c1998-12-26 12:00:43 +000089 void *pDriverData; /* Window driver data */
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000090 DWORD wExtra[1]; /* Window extra bytes */
Alexandre Julliard75a839a1993-07-15 11:13:45 +000091} WND;
92
Alex Korobka4f1ac051999-03-28 09:37:57 +000093/* Host attributes */
94
95#define HAK_BITGRAVITY 1
96#define HAK_ACCEPTFOCUS 2
Alex Korobka44a1b591999-04-01 12:03:52 +000097#define HAK_ICONICSTATE 3
Alex Korobka4f1ac051999-03-28 09:37:57 +000098
99/* Bit Gravity */
100
101#define BGForget 0
102#define BGNorthWest 1
103#define BGNorth 2
104#define BGNorthEast 3
105#define BGWest 4
106#define BGCenter 5
107#define BGEast 6
108#define BGSouthWest 7
109#define BGSouth 8
110#define BGSouthEast 9
111#define BGStatic 10
112
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +0000113typedef struct tagWND_DRIVER
Patrik Stridvallea584721998-11-01 16:22:07 +0000114{
Patrik Stridvall151170c1998-12-26 12:00:43 +0000115 void (*pInitialize)(WND *);
116 void (*pFinalize)(WND *);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000117 BOOL (*pCreateDesktopWindow)(WND *, struct tagCLASS *, BOOL);
118 BOOL (*pCreateWindow)(WND *, struct tagCLASS *, CREATESTRUCTA *, BOOL);
119 BOOL (*pDestroyWindow)(WND *);
Patrik Stridvallea584721998-11-01 16:22:07 +0000120 WND* (*pSetParent)(WND *, WND *);
Patrik Stridvalle35d6361998-12-07 09:13:40 +0000121 void (*pForceWindowRaise)(WND *);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000122 void (*pSetWindowPos)(WND *, const WINDOWPOS *, BOOL);
Patrik Stridvalle35d6361998-12-07 09:13:40 +0000123 void (*pSetText)(WND *, LPCSTR);
124 void (*pSetFocus)(WND *);
125 void (*pPreSizeMove)(WND *);
126 void (*pPostSizeMove)(WND *);
Alex Korobka4f1ac051999-03-28 09:37:57 +0000127 void (*pSurfaceCopy)(WND *, struct tagDC *, INT, INT, const RECT *, BOOL);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000128 void (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL);
Alex Korobka4f1ac051999-03-28 09:37:57 +0000129 BOOL (*pSetHostAttr)(WND *, INT haKey, INT value);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000130 BOOL (*pIsSelfClipping)(WND *);
Patrik Stridvallea584721998-11-01 16:22:07 +0000131} WND_DRIVER;
132
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +0000133extern WND_DRIVER *WND_Driver;
134
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000135typedef struct
136{
137 RECT16 rectNormal;
138 POINT16 ptIconPos;
139 POINT16 ptMaxPos;
140 HWND16 hwndIconTitle;
141} INTERNALPOS, *LPINTERNALPOS;
142
Alexandre Julliard401710d1993-09-04 10:09:32 +0000143 /* WND flags values */
Alexandre Julliard0c126c71996-02-18 18:44:41 +0000144#define WIN_NEEDS_BEGINPAINT 0x0001 /* WM_PAINT sent to window */
145#define WIN_NEEDS_ERASEBKGND 0x0002 /* WM_ERASEBKGND must be sent to window*/
146#define WIN_NEEDS_NCPAINT 0x0004 /* WM_NCPAINT must be sent to window */
147#define WIN_RESTORE_MAX 0x0008 /* Maximize when restoring */
148#define WIN_INTERNAL_PAINT 0x0010 /* Internal WM_PAINT message pending */
Alex Korobka4f1ac051999-03-28 09:37:57 +0000149#define WIN_NATIVE 0x0020 /* Directly mapped to the window provided by the driver */
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000150#define WIN_NEED_SIZE 0x0040 /* Internal WM_SIZE is needed */
Alexandre Julliard0c126c71996-02-18 18:44:41 +0000151#define WIN_NCACTIVATED 0x0080 /* last WM_NCACTIVATE was positive */
Alex Korobka4f1ac051999-03-28 09:37:57 +0000152#define WIN_MANAGED 0x0100 /* Window managed by the window system */
Alexandre Julliard3051b641996-07-05 17:14:13 +0000153#define WIN_ISDIALOG 0x0200 /* Window is a dialog */
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000154#define WIN_ISWIN32 0x0400 /* Understands Win32 messages */
Alexandre Julliardaca05781994-10-17 18:12:41 +0000155
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000156 /* BuildWinArray() flags */
157#define BWA_SKIPDISABLED 0x0001
158#define BWA_SKIPHIDDEN 0x0002
159#define BWA_SKIPOWNED 0x0004
160#define BWA_SKIPICONIC 0x0008
161
Alex Korobka98447491999-05-08 17:57:09 +0000162 /* WIN_UpdateNCRgn() flags */
163#define UNC_CHECK 0x0001
164#define UNC_ENTIRE 0x0002
165#define UNC_REGION 0x0004
166#define UNC_UPDATE 0x0008
Francis Beaudetc37dd061999-07-18 15:38:29 +0000167#define UNC_DELAY_NCPAINT 0x0010
168#define UNC_IN_BEGINPAINT 0x0020
Alex Korobka98447491999-05-08 17:57:09 +0000169
Alexandre Julliardf0b23541993-09-29 12:21:49 +0000170 /* Window functions */
Ulrich Weigandef61c0b1999-05-08 09:45:50 +0000171extern void WIN_Init( void );
Patrik Stridvall1ed4ecf1999-06-26 14:58:24 +0000172extern void WIN_LockWnds( void );
173extern void WIN_UnlockWnds( void );
174extern int WIN_SuspendWndsLock( void );
Francois Boisvert93e3f901999-02-25 17:32:31 +0000175extern void WIN_RestoreWndsLock(int ipreviousLock);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000176extern WND* WIN_FindWndPtr( HWND hwnd );
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000177extern WND* WIN_LockWndPtr(WND *wndPtr);
Francois Boisvert93e3f901999-02-25 17:32:31 +0000178extern void WIN_ReleaseWndPtr(WND *wndPtr);
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000179extern void WIN_UpdateWndPtr(WND **oldPtr,WND *newPtr);
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000180extern WND* WIN_GetDesktop(void);
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000181extern void WIN_ReleaseDesktop(void);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000182extern void WIN_DumpWindow( HWND hwnd );
183extern void WIN_WalkWindows( HWND hwnd, int indent );
184extern BOOL WIN_UnlinkWindow( HWND hwnd );
185extern BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
186extern HWND WIN_FindWinToRepaint( HWND hwnd, HQUEUE16 hQueue );
187extern BOOL WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew);
188extern BOOL WIN_CreateDesktopWindow(void);
189extern HWND WIN_GetTopParent( HWND hwnd );
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000190extern WND* WIN_GetTopParentPtr( WND* pWnd );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000191extern BOOL WIN_IsWindowDrawable(WND*, BOOL );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000192extern WND** WIN_BuildWinArray( WND *wndPtr, UINT bwa, UINT* pnum );
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000193extern void WIN_ReleaseWinArray(WND **wndArray);
Alexandre Julliard75a839a1993-07-15 11:13:45 +0000194
Alexandre Julliarda3960291999-02-26 11:11:13 +0000195extern HWND CARET_GetHwnd(void);
196extern void CARET_GetRect(LPRECT lprc); /* windows/caret.c */
Alexandre Julliarda845b881998-06-01 10:44:35 +0000197
Alexandre Julliarda3960291999-02-26 11:11:13 +0000198extern BOOL16 DRAG_QueryUpdate( HWND, SEGPTR, BOOL );
Alexandre Julliarda0b2b1d1997-11-16 17:38:29 +0000199extern void DEFWND_SetText( WND *wndPtr, LPCSTR text );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000200extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT16 ctlType ); /* windows/defwnd.c */
Alexandre Julliard2d93d001996-05-21 15:01:41 +0000201
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000202extern void PROPERTY_RemoveWindowProps( WND *pWnd ); /* windows/property.c */
Alexandre Julliardac9c9b01996-07-28 18:50:11 +0000203
Alexandre Julliarda3960291999-02-26 11:11:13 +0000204extern BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
205 HRGN hrgnUpdate, UINT flags,
206 UINT control ); /* windows/painting.c */
Alex Korobka98447491999-05-08 17:57:09 +0000207extern HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT flags); /* windows/painting.c */
Alexandre Julliard1e37a181996-08-18 16:21:52 +0000208
Alexandre Julliarda845b881998-06-01 10:44:35 +0000209/* controls/widgets.c */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000210extern BOOL WIDGETS_Init( void );
211extern BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls );
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000212
Alexandre Julliarda845b881998-06-01 10:44:35 +0000213/* controls/icontitle.c */
Patrik Stridvall1ed4ecf1999-06-26 14:58:24 +0000214extern LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
215
Alexandre Julliarda3960291999-02-26 11:11:13 +0000216extern HWND ICONTITLE_Create( WND* );
217extern BOOL ICONTITLE_Init( void );
Alexandre Julliarda845b881998-06-01 10:44:35 +0000218
219/* windows/focus.c */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000220extern void FOCUS_SwitchFocus( MESSAGEQUEUE *pMsgQ, HWND , HWND );
Alexandre Julliard23946ad1997-06-16 17:43:53 +0000221
Patrik Stridvall1ed4ecf1999-06-26 14:58:24 +0000222/* windows/edit.c */
223extern LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
224
225/* windows/listbox.c */
226extern LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
227extern LRESULT WINAPI ComboLBWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
228
Sylvain St-Germain00bf3811999-07-24 12:11:22 +0000229/* generic method that returns TRUE if the window properties ask for a
230 window manager type of border */
231extern BOOL WIN_WindowNeedsWMBorder( DWORD style, DWORD exStyle );
232
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000233#endif /* __WINE_WIN_H */