Moved some window painting functions to uitools.c.
[wine] / include / user.h
1 /*
2  * USER 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_USER_H
22 #define __WINE_USER_H
23
24 #include <stdarg.h>
25 #include <windef.h>
26 #include <winbase.h>
27 #include <wingdi.h>
28 #include <winuser.h>
29
30 #include <local.h>
31
32 extern WORD USER_HeapSel;
33
34 #define USER_HEAP_ALLOC(size) \
35             ((HANDLE)(ULONG_PTR)LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) ))
36 #define USER_HEAP_REALLOC(handle,size) \
37             ((HANDLE)(ULONG_PTR)LOCAL_ReAlloc( USER_HeapSel, LOWORD(handle), (size), LMEM_FIXED ))
38 #define USER_HEAP_FREE(handle) \
39             LOCAL_Free( USER_HeapSel, LOWORD(handle) )
40 #define USER_HEAP_LIN_ADDR(handle)  \
41          ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, LOWORD(handle))) : NULL)
42
43 #define GET_WORD(ptr)  (*(WORD *)(ptr))
44 #define GET_DWORD(ptr) (*(DWORD *)(ptr))
45
46 #define USUD_LOCALALLOC        0x0001
47 #define USUD_LOCALFREE         0x0002
48 #define USUD_LOCALCOMPACT      0x0003
49 #define USUD_LOCALHEAP         0x0004
50 #define USUD_FIRSTCLASS        0x0005
51
52 struct tagCURSORICONINFO;
53
54 /* internal messages codes */
55 enum wine_internal_message
56 {
57     WM_WINE_DESTROYWINDOW = 0x80000000,
58     WM_WINE_SETWINDOWPOS,
59     WM_WINE_SHOWWINDOW,
60     WM_WINE_SETPARENT,
61     WM_WINE_SETWINDOWLONG,
62     WM_WINE_ENABLEWINDOW,
63     WM_WINE_SETACTIVEWINDOW,
64     WM_WINE_KEYBOARD_LL_HOOK,
65     WM_WINE_MOUSE_LL_HOOK
66 };
67
68 /* internal SendInput codes (FIXME) */
69 #define WINE_INTERNAL_INPUT_MOUSE    (16+INPUT_MOUSE)
70 #define WINE_INTERNAL_INPUT_KEYBOARD (16+INPUT_KEYBOARD)
71
72 typedef struct tagUSER_DRIVER {
73     /* keyboard functions */
74     void   (*pInitKeyboard)(LPBYTE);
75     SHORT  (*pVkKeyScanEx)(WCHAR, HKL);
76     UINT   (*pMapVirtualKeyEx)(UINT, UINT, HKL);
77     INT    (*pGetKeyNameText)(LONG, LPWSTR, INT);
78     INT    (*pToUnicodeEx)(UINT, UINT, LPBYTE, LPWSTR, int, UINT, HKL);
79     UINT   (*pGetKeyboardLayoutList)(INT, HKL *);
80     HKL    (*pGetKeyboardLayout)(DWORD);
81     BOOL   (*pGetKeyboardLayoutName)(LPWSTR);
82     HKL    (*pLoadKeyboardLayout)(LPCWSTR, UINT);
83     HKL    (*pActivateKeyboardLayout)(HKL, UINT);
84     BOOL   (*pUnloadKeyboardLayout)(HKL);
85     void   (*pBeep)(void);
86     /* mouse functions */
87     void   (*pInitMouse)(LPBYTE);
88     void   (*pSetCursor)(struct tagCURSORICONINFO *);
89     void   (*pGetCursorPos)(LPPOINT);
90     void   (*pSetCursorPos)(INT,INT);
91     /* screen saver functions */
92     BOOL   (*pGetScreenSaveActive)(void);
93     void   (*pSetScreenSaveActive)(BOOL);
94     /* clipboard functions */
95     void   (*pAcquireClipboard)(HWND);                     /* Acquire selection */
96     BOOL   (*pCountClipboardFormats)(void);                /* Count available clipboard formats */
97     void   (*pEmptyClipboard)(BOOL);                       /* Empty clipboard data */
98     BOOL   (*pEndClipboardUpdate)(void);                   /* End clipboard update */
99     BOOL   (*pEnumClipboardFormats)(UINT);                 /* Enumerate clipboard formats */
100     BOOL   (*pGetClipboardData)(UINT, HANDLE16*, HANDLE*); /* Get specified selection data */
101     BOOL   (*pGetClipboardFormatName)(UINT, LPSTR, UINT);  /* Get a clipboard format name */
102     BOOL   (*pIsClipboardFormatAvailable)(UINT);           /* Check if specified format is available */
103     INT    (*pRegisterClipboardFormat)(LPCSTR);            /* Register a clipboard format */
104     void   (*pResetSelectionOwner)(HWND, BOOL);
105     BOOL   (*pSetClipboardData)(UINT, HANDLE16, HANDLE, BOOL);   /* Set specified selection data */
106     /* display modes */
107     LONG   (*pChangeDisplaySettingsExW)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
108     BOOL   (*pEnumDisplaySettingsExW)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
109     /* windowing functions */
110     BOOL   (*pCreateWindow)(HWND,CREATESTRUCTA*,BOOL);
111     BOOL   (*pDestroyWindow)(HWND);
112     BOOL   (*pGetDC)(HWND,HDC,HRGN,DWORD);
113     void   (*pForceWindowRaise)(HWND);
114     DWORD  (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
115     void   (*pReleaseDC)(HWND,HDC);
116     BOOL   (*pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT);
117     void   (*pSetFocus)(HWND);
118     HWND   (*pSetParent)(HWND,HWND);
119     BOOL   (*pSetWindowPos)(WINDOWPOS *);
120     int    (*pSetWindowRgn)(HWND,HRGN,BOOL);
121     void   (*pSetWindowIcon)(HWND,UINT,HICON);
122     void   (*pSetWindowStyle)(HWND,DWORD);
123     BOOL   (*pSetWindowText)(HWND,LPCWSTR);
124     BOOL   (*pShowWindow)(HWND,INT);
125     void   (*pSysCommandSizeMove)(HWND,WPARAM);
126 } USER_DRIVER;
127
128 extern USER_DRIVER USER_Driver;
129
130 extern HMODULE user32_module;
131
132 /* user lock */
133 extern void USER_Lock(void);
134 extern void USER_Unlock(void);
135 extern void USER_CheckNotLock(void);
136
137 extern BOOL USER_IsExitingThread( DWORD tid );
138
139 /* hook.c */
140 extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode );
141 extern BOOL HOOK_IsHooked( INT id );
142
143 /* input.c */
144 extern BYTE InputKeyStateTable[256];
145 extern BYTE AsyncKeyStateTable[256];
146
147 /* syscolor.c */
148 extern void SYSCOLOR_Init(void);
149 extern HPEN SYSCOLOR_GetPen( INT index );
150
151 /* sysmetrics.c */
152 extern void SYSMETRICS_Init(void);
153 extern INT SYSMETRICS_Set( INT index, INT value );
154
155 /* sysparams.c */
156 extern void SYSPARAMS_GetDoubleClickSize( INT *width, INT *height );
157 extern INT SYSPARAMS_GetMouseButtonSwap( void );
158
159 extern HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground );
160
161 extern BOOL CLIPBOARD_ReleaseOwner(void);
162
163 extern DWORD USER16_AlertableWait;
164
165 /* HANDLE16 <-> HANDLE conversions */
166 #define HCURSOR_16(h32)    (LOWORD(h32))
167 #define HICON_16(h32)      (LOWORD(h32))
168 #define HINSTANCE_16(h32)  (LOWORD(h32))
169
170 #define HCURSOR_32(h16)    ((HCURSOR)(ULONG_PTR)(h16))
171 #define HICON_32(h16)      ((HICON)(ULONG_PTR)(h16))
172 #define HINSTANCE_32(h16)  ((HINSTANCE)(ULONG_PTR)(h16))
173 #define HMODULE_32(h16)    ((HMODULE)(ULONG_PTR)(h16))
174
175 #endif  /* __WINE_USER_H */