comctl32/treeview: Some tests to show edit item label problems.
[wine] / dlls / dinput / device_private.h
1 /*
2  * Copyright 2000 Lionel Ulmer
3  * Copyright 2000-2001 TransGaming Technologies Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19
20 #ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
21 #define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
22
23 #include <stdarg.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "dinput.h"
28 #include "wine/list.h"
29 #include "dinput_private.h"
30
31 typedef struct
32 {
33     int size;
34     int offset_in;
35     int offset_out;
36     int value;
37 } DataTransform;
38
39 typedef struct
40 {
41     int                         size;
42     int                         internal_format_size;
43     DataTransform              *dt;
44
45     int                        *offsets;     /* object offsets */
46     LPDIDATAFORMAT              wine_df;     /* wine internal data format */
47     LPDIDATAFORMAT              user_df;     /* user defined data format */
48 } DataFormat;
49
50 /* Device implementation */
51 typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl;
52 struct IDirectInputDevice2AImpl
53 {
54     const void                 *lpVtbl;
55     LONG                        ref;
56     GUID                        guid;
57     CRITICAL_SECTION            crit;
58     IDirectInputImpl           *dinput;
59     struct list                 entry;       /* entry into IDirectInput devices list */
60     HANDLE                      hEvent;
61     DWORD                       dwCoopLevel;
62     HWND                        win;
63     int                         acquired;
64     DI_EVENT_PROC               event_proc;  /* function to receive mouse & keyboard events */
65
66     LPDIDEVICEOBJECTDATA        data_queue;  /* buffer for 'GetDeviceData'.                 */
67     int                         queue_len;   /* size of the queue - set in 'SetProperty'    */
68     int                         queue_head;  /* position to write new event into queue      */
69     int                         queue_tail;  /* next event to read from queue               */
70     BOOL                        overflow;    /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
71
72     DataFormat                  data_format; /* user data format and wine to user format converter */
73 };
74
75 extern BOOL get_app_key(HKEY*, HKEY*);
76 extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD);
77
78 /* Routines to do DataFormat / WineFormat conversions */
79 extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) ;
80 extern void release_DataFormat(DataFormat *df) ;
81 extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int ofs, DWORD data, DWORD time, DWORD seq);
82 /* Helper functions to work with data format */
83 extern int id_to_object(LPCDIDATAFORMAT df, int id);
84 extern int id_to_offset(const DataFormat *df, int id);
85 extern int find_property(const DataFormat *df, LPCDIPROPHEADER ph);
86
87 /* Common joystick stuff */
88 typedef struct
89 {
90     LONG lDevMin;
91     LONG lDevMax;
92     LONG lMin;
93     LONG lMax;
94     LONG lDeadZone;
95     LONG lSaturation;
96 } ObjProps;
97
98 extern DWORD joystick_map_pov(POINTL *p);
99 extern LONG joystick_map_axis(ObjProps *props, int val);
100
101 typedef struct
102 {
103     struct list entry;
104     LPDIRECTINPUTEFFECT ref;
105 } effect_list_item;
106
107 extern const GUID DInput_Wine_Keyboard_GUID;
108 extern const GUID DInput_Wine_Mouse_GUID;
109
110 /* Various debug tools */
111 extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) ;
112 extern void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi) ;
113 extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) ;
114 extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) ;
115 extern const char *_dump_dinput_GUID(const GUID *guid) ;
116
117 /* And the stubs */
118 extern HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface);
119 extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
120 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
121         LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ;
122 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
123         LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ;
124 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
125         LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
126 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
127 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj);
128 extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj);
129 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
130         LPDIRECTINPUTDEVICE8A iface) ;
131 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
132         LPDIRECTINPUTDEVICE8A iface,
133         LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
134         LPVOID lpvRef,
135         DWORD dwFlags) ;
136 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
137         LPDIRECTINPUTDEVICE8W iface,
138         LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
139         LPVOID lpvRef,
140         DWORD dwFlags) ;
141 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph);
142 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph);
143 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
144         LPDIRECTINPUTDEVICE8A iface,
145         LPDIDEVICEOBJECTINSTANCEA pdidoi,
146         DWORD dwObj,
147         DWORD dwHow) ;
148 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, 
149                                                              LPDIDEVICEOBJECTINSTANCEW pdidoi,
150                                                              DWORD dwObj,
151                                                              DWORD dwHow);
152 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
153         DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags);
154 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
155         LPDIRECTINPUTDEVICE8A iface,
156         HWND hwndOwner,
157         DWORD dwFlags) ;
158 extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
159         LPDIRECTINPUTDEVICE8A iface,
160         HINSTANCE hinst,
161         DWORD dwVersion,
162         REFGUID rguid) ;
163 extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
164         LPDIRECTINPUTDEVICE8A iface,
165         REFGUID rguid,
166         LPCDIEFFECT lpeff,
167         LPDIRECTINPUTEFFECT *ppdef,
168         LPUNKNOWN pUnkOuter) ;
169 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
170         LPDIRECTINPUTDEVICE8A iface,
171         LPDIENUMEFFECTSCALLBACKA lpCallback,
172         LPVOID lpvRef,
173         DWORD dwFlags) ;
174 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
175         LPDIRECTINPUTDEVICE8W iface,
176         LPDIENUMEFFECTSCALLBACKW lpCallback,
177         LPVOID lpvRef,
178         DWORD dwFlags) ;
179 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
180         LPDIRECTINPUTDEVICE8A iface,
181         LPDIEFFECTINFOA lpdei,
182         REFGUID rguid) ;
183 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
184         LPDIRECTINPUTDEVICE8W iface,
185         LPDIEFFECTINFOW lpdei,
186         REFGUID rguid) ;
187 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
188         LPDIRECTINPUTDEVICE8A iface,
189         LPDWORD pdwOut) ;
190 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
191         LPDIRECTINPUTDEVICE8A iface,
192         DWORD dwFlags) ;
193 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
194         LPDIRECTINPUTDEVICE8A iface,
195         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
196         LPVOID lpvRef,
197         DWORD dwFlags) ;
198 extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
199         LPDIRECTINPUTDEVICE8A iface,
200         LPDIEFFESCAPE lpDIEEsc) ;
201 extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
202         LPDIRECTINPUTDEVICE8A iface) ;
203 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
204         LPDIRECTINPUTDEVICE8A iface,
205         DWORD cbObjectData,
206         LPCDIDEVICEOBJECTDATA rgdod,
207         LPDWORD pdwInOut,
208         DWORD dwFlags) ;
209 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
210                                                                  LPCSTR lpszFileName,
211                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
212                                                                  LPVOID pvRef,
213                                                                  DWORD dwFlags) ;
214 extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
215                                                                  LPCWSTR lpszFileName,
216                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
217                                                                  LPVOID pvRef,
218                                                                  DWORD dwFlags) ;
219 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
220                                                                  LPCSTR lpszFileName,
221                                                                  DWORD dwEntries,
222                                                                  LPDIFILEEFFECT rgDiFileEft,
223                                                                  DWORD dwFlags) ;
224 extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
225                                                                  LPCWSTR lpszFileName,
226                                                                  DWORD dwEntries,
227                                                                  LPDIFILEEFFECT rgDiFileEft,
228                                                                  DWORD dwFlags) ;
229 extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
230                                                               LPDIACTIONFORMATA lpdiaf,
231                                                               LPCSTR lpszUserName,
232                                                               DWORD dwFlags);
233 extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
234                                                               LPDIACTIONFORMATW lpdiaf,
235                                                               LPCWSTR lpszUserName,
236                                                               DWORD dwFlags);
237 extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
238                                                             LPDIACTIONFORMATA lpdiaf,
239                                                             LPCSTR lpszUserName,
240                                                             DWORD dwFlags);
241 extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
242                                                             LPDIACTIONFORMATW lpdiaf,
243                                                             LPCWSTR lpszUserName,
244                                                             DWORD dwFlags);
245 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
246                                                             LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
247 extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
248                                                             LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
249
250 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */