Unicode fixes.
[wine] / include / win.h
1 /*
2  * Window definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __WINE_WIN_H
22 #define __WINE_WIN_H
23
24 #include <stdarg.h>
25 #include <windef.h>
26 #include <winbase.h>
27 #include <wingdi.h>
28 #include <winuser.h>
29 #include <wine/windef16.h>
30
31 #include <user.h>
32
33 #define WND_MAGIC     0x444e4957  /* 'WIND' */
34
35 struct tagCLASS;
36 struct tagDCE;
37 struct tagMESSAGEQUEUE;
38
39 typedef struct tagWND
40 {
41     HWND           hwndSelf;      /* Handle of this window */
42     HWND           parent;        /* Window parent */
43     HWND           owner;         /* Window owner */
44     struct tagCLASS *class;       /* Window class */
45     WNDPROC        winproc;       /* Window procedure */
46     DWORD          dwMagic;       /* Magic number (must be WND_MAGIC) */
47     DWORD          tid;           /* Owner thread id */
48     HINSTANCE      hInstance;     /* Window hInstance (from CreateWindow) */
49     RECT           rectClient;    /* Client area rel. to parent client area */
50     RECT           rectWindow;    /* Whole window rel. to parent client area */
51     LPWSTR         text;          /* Window text */
52     void          *pVScroll;      /* Vertical scroll-bar info */
53     void          *pHScroll;      /* Horizontal scroll-bar info */
54     struct tagDCE *dce;           /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
55     DWORD          dwStyle;       /* Window style (from CreateWindow) */
56     DWORD          dwExStyle;     /* Extended style (from CreateWindowEx) */
57     DWORD          clsStyle;      /* Class style at window creation */
58     UINT           wIDmenu;       /* ID or hmenu (from CreateWindow) */
59     DWORD          helpContext;   /* Help context ID */
60     UINT           flags;         /* Misc. flags (see below) */
61     HMENU          hSysMenu;      /* window's copy of System Menu */
62     HICON          hIcon;         /* window's icon */
63     HICON          hIconSmall;    /* window's small icon */
64     int            cbWndExtra;    /* class cbWndExtra at window creation */
65     int            irefCount;     /* window's reference count*/
66     DWORD          userdata;      /* User private data */
67     void          *pDriverData;   /* Window driver data */
68     DWORD          wExtra[1];     /* Window extra bytes */
69 } WND;
70
71 typedef struct
72 {
73     RECT16         rectNormal;
74     POINT16        ptIconPos;
75     POINT16        ptMaxPos;
76     HWND           hwndIconTitle;
77 } INTERNALPOS, *LPINTERNALPOS;
78
79   /* WND flags values */
80 #define WIN_RESTORE_MAX           0x0001 /* Maximize when restoring */
81 #define WIN_NEED_SIZE             0x0002 /* Internal WM_SIZE is needed */
82 #define WIN_NCACTIVATED           0x0004 /* last WM_NCACTIVATE was positive */
83 #define WIN_ISMDICLIENT           0x0008 /* Window is an MDIClient */
84 #define WIN_ISDIALOG              0x0010 /* Window is a dialog */
85 #define WIN_ISWIN32               0x0020 /* Understands Win32 messages */
86 #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0040 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
87 #define WIN_NEEDS_INTERNALSOP     0x0080 /* Window was hidden by WIN_InternalShowOwnedPopups */
88
89   /* Window functions */
90 extern WND *WIN_GetPtr( HWND hwnd );
91 extern int    WIN_SuspendWndsLock( void );
92 extern void   WIN_RestoreWndsLock(int ipreviousLock);
93 extern WND*   WIN_FindWndPtr( HWND hwnd );
94 extern void   WIN_ReleaseWndPtr(WND *wndPtr);
95 extern HWND WIN_Handle32( HWND16 hwnd16 );
96 extern HWND WIN_IsCurrentProcess( HWND hwnd );
97 extern HWND WIN_IsCurrentThread( HWND hwnd );
98 extern void WIN_LinkWindow( HWND hwnd, HWND parent, HWND hwndInsertAfter );
99 extern void WIN_UnlinkWindow( HWND hwnd );
100 extern HWND WIN_SetOwner( HWND hwnd, HWND owner );
101 extern LONG WIN_SetStyle( HWND hwnd, LONG style );
102 extern LONG WIN_SetExStyle( HWND hwnd, LONG style );
103 extern BOOL WIN_GetRectangles( HWND hwnd, RECT *rectWindow, RECT *rectClient );
104 extern LRESULT WIN_DestroyWindow( HWND hwnd );
105 extern void WIN_DestroyThreadWindows( HWND hwnd );
106 extern BOOL WIN_CreateDesktopWindow(void);
107 extern BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL );
108 extern HWND *WIN_ListParents( HWND hwnd );
109 extern HWND *WIN_ListChildren( HWND hwnd );
110 extern BOOL WIN_InternalShowOwnedPopups( HWND owner, BOOL fShow, BOOL unmanagedOnly );
111 extern void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta );
112
113 inline static HWND WIN_GetFullHandle( HWND hwnd )
114 {
115     if (!HIWORD(hwnd) && hwnd) hwnd = WIN_Handle32( LOWORD(hwnd) );
116     return hwnd;
117 }
118
119 inline static WND *WIN_FindWndPtr16( HWND16 hwnd )
120 {
121     /* don't bother with full conversion */
122     return WIN_FindWndPtr( (HWND)(ULONG_PTR)hwnd );
123 }
124
125 /* to release pointers retrieved by WIN_GetPtr; do not confuse with WIN_ReleaseWndPtr!! */
126 inline static void WIN_ReleasePtr( WND *ptr )
127 {
128     USER_Unlock();
129 }
130
131 #define WND_OTHER_PROCESS ((WND *)1)  /* returned by WIN_GetPtr on unknown window handles */
132
133 extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType );  /* windows/defwnd.c */
134
135 extern BOOL FOCUS_MouseActivate( HWND hwnd );
136
137 extern BOOL MENU_SetMenu(HWND, HMENU);
138
139 /* check if hwnd is a broadcast magic handle */
140 inline static BOOL is_broadcast( HWND hwnd )
141 {
142     return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
143 }
144
145 #endif  /* __WINE_WIN_H */