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