Implemented processing for actions: SPI_GET/SETGRIDGRANULARITY,
[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 #include "user.h"
18
19 #define WND_MAGIC     0x444e4957  /* 'WIND' */
20
21 struct tagCLASS;
22 struct tagDCE;
23 struct tagMESSAGEQUEUE;
24
25 typedef struct tagWND
26 {
27     HWND           hwndSelf;      /* Handle of this window */
28     HWND           parent;        /* Window parent */
29     HWND           owner;         /* Window owner */
30     struct tagCLASS *class;       /* Window class */
31     HWINDOWPROC    winproc;       /* Window procedure */
32     DWORD          dwMagic;       /* Magic number (must be WND_MAGIC) */
33     DWORD          tid;           /* Owner thread id */
34     HINSTANCE    hInstance;     /* Window hInstance (from CreateWindow) */
35     RECT         rectClient;    /* Client area rel. to parent client area */
36     RECT         rectWindow;    /* Whole window rel. to parent client area */
37     LPWSTR        text;           /* Window text */
38     void          *pVScroll;      /* Vertical scroll-bar info */
39     void          *pHScroll;      /* Horizontal scroll-bar info */
40     struct tagDCE *dce;           /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
41     HGLOBAL16      hmemTaskQ;     /* Task queue global memory handle */
42     HRGN           hrgnUpdate;    /* Update region */
43     HRGN           hrgnWnd;       /* window's region */
44     HWND           hwndLastActive;/* Last active popup hwnd */
45     DWORD          dwStyle;       /* Window style (from CreateWindow) */
46     DWORD          dwExStyle;     /* Extended style (from CreateWindowEx) */
47     DWORD          clsStyle;      /* Class style at window creation */
48     UINT           wIDmenu;       /* ID or hmenu (from CreateWindow) */
49     DWORD          helpContext;   /* Help context ID */
50     UINT           flags;         /* Misc. flags (see below) */
51     HMENU16        hSysMenu;      /* window's copy of System Menu */
52     int            cbWndExtra;    /* class cbWndExtra at window creation */
53     int            irefCount;     /* window's reference count*/
54     DWORD          userdata;      /* User private data */
55     void          *pDriverData;   /* Window driver data */
56     DWORD          wExtra[1];     /* Window extra bytes */
57 } WND;
58
59 typedef struct
60 {
61     RECT16         rectNormal;
62     POINT16        ptIconPos;
63     POINT16        ptMaxPos;
64     HWND           hwndIconTitle;
65 } INTERNALPOS, *LPINTERNALPOS;
66
67   /* WND flags values */
68 #define WIN_NEEDS_BEGINPAINT   0x0001 /* WM_PAINT sent to window */
69 #define WIN_NEEDS_ERASEBKGND   0x0002 /* WM_ERASEBKGND must be sent to window*/
70 #define WIN_NEEDS_NCPAINT      0x0004 /* WM_NCPAINT must be sent to window */
71 #define WIN_RESTORE_MAX        0x0008 /* Maximize when restoring */
72 #define WIN_INTERNAL_PAINT     0x0010 /* Internal WM_PAINT message pending */
73 #define WIN_NEED_SIZE          0x0040 /* Internal WM_SIZE is needed */
74 #define WIN_NCACTIVATED        0x0080 /* last WM_NCACTIVATE was positive */
75 #define WIN_ISDIALOG           0x0200 /* Window is a dialog */
76 #define WIN_ISWIN32            0x0400 /* Understands Win32 messages */
77 #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0800 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
78 #define WIN_NEEDS_INTERNALSOP  0x1000 /* Window was hidden by WIN_InternalShowOwnedPopups */
79
80   /* Window functions */
81 extern WND *WIN_GetPtr( HWND hwnd );
82 extern int    WIN_SuspendWndsLock( void );
83 extern void   WIN_RestoreWndsLock(int ipreviousLock);
84 extern WND*   WIN_FindWndPtr( HWND hwnd );
85 extern void   WIN_ReleaseWndPtr(WND *wndPtr);
86 extern HWND WIN_Handle32( HWND16 hwnd16 );
87 extern HWND WIN_IsCurrentProcess( HWND hwnd );
88 extern HWND WIN_IsCurrentThread( HWND hwnd );
89 extern void WIN_LinkWindow( HWND hwnd, HWND parent, HWND hwndInsertAfter );
90 extern void WIN_UnlinkWindow( HWND hwnd );
91 extern void WIN_SetOwner( HWND hwnd, HWND owner );
92 extern LONG WIN_SetStyle( HWND hwnd, LONG style );
93 extern LONG WIN_SetExStyle( HWND hwnd, LONG style );
94 extern void WIN_SetRectangles( HWND hwnd, const RECT *rectWindow, const RECT *rectClient );
95 extern LRESULT WIN_DestroyWindow( HWND hwnd );
96 extern void WIN_DestroyThreadWindows( HWND hwnd );
97 extern BOOL WIN_CreateDesktopWindow(void);
98 extern BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL );
99 extern HWND *WIN_ListParents( HWND hwnd );
100 extern HWND *WIN_ListChildren( HWND hwnd );
101 extern BOOL WIN_InternalShowOwnedPopups( HWND owner, BOOL fShow, BOOL unmanagedOnly );
102
103 inline static HWND WIN_GetFullHandle( HWND hwnd )
104 {
105     if (!HIWORD(hwnd) && hwnd) hwnd = WIN_Handle32( LOWORD(hwnd) );
106     return hwnd;
107 }
108
109 inline static HWND16 WIN_Handle16( HWND hwnd )
110 {
111     return LOWORD(hwnd);
112 }
113
114 inline static WND *WIN_FindWndPtr16( HWND16 hwnd )
115 {
116     /* don't bother with full conversion */
117     return WIN_FindWndPtr( (HWND)(ULONG_PTR)hwnd );
118 }
119
120 /* to release pointers retrieved by WIN_GetPtr; do not confuse with WIN_ReleaseWndPtr!! */
121 inline static void WIN_ReleasePtr( WND *ptr )
122 {
123     USER_Unlock();
124 }
125
126 #define WND_OTHER_PROCESS ((WND *)1)  /* returned by WIN_GetPtr on unknown window handles */
127
128 extern HWND CARET_GetHwnd(void);
129 extern void CARET_GetRect(LPRECT lprc);  /* windows/caret.c */
130
131 extern BOOL16 DRAG_QueryUpdate( HWND, SEGPTR, BOOL );
132 extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType );  /* windows/defwnd.c */
133
134 /* Classes functions */
135 struct tagCLASS;  /* opaque structure */
136 struct builtin_class_descr;
137 extern ATOM CLASS_RegisterBuiltinClass( const struct builtin_class_descr *descr );
138 extern struct tagCLASS *CLASS_AddWindow( ATOM atom, HINSTANCE inst, WINDOWPROCTYPE type,
139                                          INT *winExtra, WNDPROC *winproc,
140                                          DWORD *style, struct tagDCE **dce );
141 extern void CLASS_RemoveWindow( struct tagCLASS *cls );
142 extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
143
144 /* windows/focus.c */
145 extern void FOCUS_SwitchFocus( struct tagMESSAGEQUEUE *pMsgQ, HWND , HWND );
146
147 #endif  /* __WINE_WIN_H */