Moved most files from the windows directory to dlls/user.
[wine] / dlls / user / user_private.h
1 /*
2  * USER private 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_PRIVATE_H
22 #define __WINE_USER_PRIVATE_H
23
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "local.h"
30
31 extern WORD USER_HeapSel;
32
33 #define USER_HEAP_ALLOC(size) \
34             ((HANDLE)(ULONG_PTR)LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) ))
35 #define USER_HEAP_REALLOC(handle,size) \
36             ((HANDLE)(ULONG_PTR)LOCAL_ReAlloc( USER_HeapSel, LOWORD(handle), (size), LMEM_FIXED ))
37 #define USER_HEAP_FREE(handle) \
38             LOCAL_Free( USER_HeapSel, LOWORD(handle) )
39 #define USER_HEAP_LIN_ADDR(handle)  \
40          ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, LOWORD(handle))) : NULL)
41
42 #define GET_WORD(ptr)  (*(const WORD *)(ptr))
43 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
44
45 /* internal messages codes */
46 enum wine_internal_message
47 {
48     WM_WINE_DESTROYWINDOW = 0x80000000,
49     WM_WINE_SETWINDOWPOS,
50     WM_WINE_SHOWWINDOW,
51     WM_WINE_SETPARENT,
52     WM_WINE_SETWINDOWLONG,
53     WM_WINE_ENABLEWINDOW,
54     WM_WINE_SETACTIVEWINDOW,
55     WM_WINE_KEYBOARD_LL_HOOK,
56     WM_WINE_MOUSE_LL_HOOK,
57     WM_WINE_FIRST_DRIVER_MSG = 0x80001000,  /* range of messages reserved for the USER driver */
58     WM_WINE_LAST_DRIVER_MSG = 0x80001fff
59 };
60
61 struct tagCURSORICONINFO;
62
63 typedef struct tagUSER_DRIVER {
64     /* keyboard functions */
65     HKL    (*pActivateKeyboardLayout)(HKL, UINT);
66     void   (*pBeep)(void);
67     SHORT  (*pGetAsyncKeyState)(INT);
68     INT    (*pGetKeyNameText)(LONG, LPWSTR, INT);
69     HKL    (*pGetKeyboardLayout)(DWORD);
70     UINT   (*pGetKeyboardLayoutList)(INT, HKL *);
71     BOOL   (*pGetKeyboardLayoutName)(LPWSTR);
72     HKL    (*pLoadKeyboardLayout)(LPCWSTR, UINT);
73     UINT   (*pMapVirtualKeyEx)(UINT, UINT, HKL);
74     UINT   (*pSendInput)(UINT, LPINPUT, int);
75     INT    (*pToUnicodeEx)(UINT, UINT, LPBYTE, LPWSTR, int, UINT, HKL);
76     BOOL   (*pUnloadKeyboardLayout)(HKL);
77     SHORT  (*pVkKeyScanEx)(WCHAR, HKL);
78     /* mouse functions */
79     void   (*pSetCursor)(struct tagCURSORICONINFO *);
80     BOOL   (*pGetCursorPos)(LPPOINT);
81     BOOL   (*pSetCursorPos)(INT,INT);
82     /* screen saver functions */
83     BOOL   (*pGetScreenSaveActive)(void);
84     void   (*pSetScreenSaveActive)(BOOL);
85     /* clipboard functions */
86     void   (*pAcquireClipboard)(HWND);                     /* Acquire selection */
87     BOOL   (*pCountClipboardFormats)(void);                /* Count available clipboard formats */
88     void   (*pEmptyClipboard)(BOOL);                       /* Empty clipboard data */
89     BOOL   (*pEndClipboardUpdate)(void);                   /* End clipboard update */
90     BOOL   (*pEnumClipboardFormats)(UINT);                 /* Enumerate clipboard formats */
91     BOOL   (*pGetClipboardData)(UINT, HANDLE16*, HANDLE*); /* Get specified selection data */
92     BOOL   (*pGetClipboardFormatName)(UINT, LPWSTR, UINT); /* Get a clipboard format name */
93     BOOL   (*pIsClipboardFormatAvailable)(UINT);           /* Check if specified format is available */
94     INT    (*pRegisterClipboardFormat)(LPCWSTR);           /* Register a clipboard format */
95     void   (*pResetSelectionOwner)(HWND, BOOL);
96     BOOL   (*pSetClipboardData)(UINT, HANDLE16, HANDLE, BOOL);   /* Set specified selection data */
97     /* display modes */
98     LONG   (*pChangeDisplaySettingsExW)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
99     BOOL   (*pEnumDisplaySettingsExW)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
100     /* windowing functions */
101     BOOL   (*pCreateWindow)(HWND,CREATESTRUCTA*,BOOL);
102     BOOL   (*pDestroyWindow)(HWND);
103     HDC    (*pGetDCEx)(HWND,HRGN,DWORD);
104     DWORD  (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
105     BOOL   (*pReleaseDC)(HWND,HDC,BOOL);
106     BOOL   (*pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT);
107     void   (*pSetFocus)(HWND);
108     HWND   (*pSetParent)(HWND,HWND);
109     BOOL   (*pSetWindowPos)(WINDOWPOS *);
110     int    (*pSetWindowRgn)(HWND,HRGN,BOOL);
111     void   (*pSetWindowIcon)(HWND,UINT,HICON);
112     void   (*pSetWindowStyle)(HWND,DWORD);
113     BOOL   (*pSetWindowText)(HWND,LPCWSTR);
114     BOOL   (*pShowWindow)(HWND,INT);
115     void   (*pSysCommandSizeMove)(HWND,WPARAM);
116     HWND   (*pWindowFromDC)(HDC);
117     LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
118 } USER_DRIVER;
119
120 extern USER_DRIVER USER_Driver;
121
122 extern HMODULE user32_module;
123 extern DWORD USER16_AlertableWait;
124 extern HBRUSH SYSCOLOR_55AABrush;
125
126 extern BOOL CLIPBOARD_ReleaseOwner(void);
127 extern BOOL FOCUS_MouseActivate( HWND hwnd );
128 extern BOOL HOOK_IsHooked( INT id );
129 extern void SYSCOLOR_Init(void);
130 extern HPEN SYSCOLOR_GetPen( INT index );
131 extern void SYSPARAMS_Init(void);
132 extern void USER_CheckNotLock(void);
133 extern BOOL USER_IsExitingThread( DWORD tid );
134
135 /* HANDLE16 <-> HANDLE conversions */
136 #define HCURSOR_16(h32)    (LOWORD(h32))
137 #define HICON_16(h32)      (LOWORD(h32))
138 #define HINSTANCE_16(h32)  (LOWORD(h32))
139
140 #define HCURSOR_32(h16)    ((HCURSOR)(ULONG_PTR)(h16))
141 #define HICON_32(h16)      ((HICON)(ULONG_PTR)(h16))
142 #define HINSTANCE_32(h16)  ((HINSTANCE)(ULONG_PTR)(h16))
143 #define HMODULE_32(h16)    ((HMODULE)(ULONG_PTR)(h16))
144
145 #endif /* __WINE_USER_PRIVATE_H */