Add _MB_CP_* defines.
[wine] / include / textserv.h
1 /*
2  * Copyright (C) 2005 Mike McCormack
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #ifndef _TEXTSERV_H
20 #define _TEXTSERV_H
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 DEFINE_GUID(IID_ITextServices,0x8d33f740,0xcf58,0x11ce,0xa8,0x9d,0x00,0xaa,0x00,0x6c,0xad,0xc5);
27 DEFINE_GUID(IID_ITextHost,    0xc5bdd8d0,0xd26e,0x11ce,0xa8,0x9e,0x00,0xaa,0x00,0x6c,0xad,0xc5);
28 DEFINE_GUID(IID_ITextHost2,   0xc5bdd8d0,0xd26e,0x11ce,0xa8,0x9e,0x00,0xaa,0x00,0x6c,0xad,0xc5);
29
30 /*****************************************************************************
31  * ITextServices interface
32  */
33 typedef struct ITextServices ITextServices;
34
35 #define INTERFACE ITextServices
36 DECLARE_INTERFACE_(ITextServices,IUnknown)
37 {
38     /*** IUnknown methods ***/
39     STDMETHOD(QueryInterface)(THIS_
40         REFIID riid,
41         void** ppvObject) PURE;
42
43     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
44
45     STDMETHOD_(ULONG,Release)(THIS) PURE;
46
47     /*** ITextServices methods ***/
48
49     STDMETHOD(TxSendMessage)( THIS_
50         UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) PURE;
51
52     STDMETHOD(TxDraw)( THIS_
53         DWORD dwDrawAspect,
54         LONG lindex,
55         void* pvAspect,
56         DVTARGETDEVICE* ptd,
57         HDC hdcDraw,
58         HDC hicTargetDev,
59         LPCRECTL lprcBounds,
60         LPCRECTL lprcWBounds,
61         LPRECT lprcUpdate,
62         BOOL (CALLBACK * pfnContinue)(DWORD),
63         DWORD dwContinue,
64         LONG lViewId) PURE;
65
66     STDMETHOD(TxGetHScroll)( THIS_
67         LONG* plMin,
68         LONG* plMax,
69         LONG* plPos,
70         LONG* plPage,
71         BOOL* pfEnabled) PURE;
72
73     STDMETHOD(TxGetVScroll)( THIS_
74         LONG* plMin,
75         LONG* plMax,
76         LONG* plPos,
77         LONG* plPage,
78         BOOL* pfEnabled) PURE;
79
80     STDMETHOD(OnTxSetCursor)( THIS_
81         DWORD dwDrawAspect,
82         LONG lindex,
83         void* pvAspect,
84         DVTARGETDEVICE* ptd,
85         HDC hdcDraw,
86         HDC hicTargetDev,
87         LPCRECT lprcClient,
88         INT x,
89         INT y) PURE;
90
91     STDMETHOD(TxQueryHitPoint)( THIS_
92         DWORD dwDrawAspect,
93         LONG lindex,
94         void* pvAspect,
95         DVTARGETDEVICE* ptd,
96         HDC hdcDraw,
97         HDC hicTargetDev,
98         LPCRECT lprcClient,
99         INT x,
100         INT y,
101         DWORD* pHitResult) PURE;
102
103     STDMETHOD(OnTxInplaceActivate)( THIS_
104         LPCRECT prcClient) PURE;
105
106     STDMETHOD(OnTxInplaceDeactivate)( THIS ) PURE;
107
108     STDMETHOD(OnTxUIActivate)( THIS ) PURE;
109
110     STDMETHOD(OnTxUIDeactivate)( THIS ) PURE;
111
112     STDMETHOD(TxGetText)( THIS_
113         BSTR* pbstrText) PURE;
114
115     STDMETHOD(TxSetText)( THIS_
116         LPCWSTR pszText) PURE;
117
118     STDMETHOD(TxGetCurrentTargetX)( THIS_
119         LONG* x) PURE;
120
121     STDMETHOD(TxGetBaseLinePos)( THIS_
122         LONG* x) PURE;
123
124     STDMETHOD(TxGetNaturalSize)( THIS_
125         DWORD dwAspect,
126         HDC hdcDraw,
127         HDC hicTargetDev,
128         DVTARGETDEVICE* ptd,
129         DWORD dwMode,
130         const SIZEL* psizelExtent,
131         LONG* pwidth,
132         LONG* pheight) PURE;
133
134     STDMETHOD(TxGetDropTarget)( THIS_
135         IDropTarget** ppDropTarget) PURE;
136
137     STDMETHOD(OnTxPropertyBitsChange)( THIS_
138         DWORD dwMask,
139         DWORD dwBits) PURE;
140
141     STDMETHOD(TxGetCachedSize)( THIS_
142         DWORD* pdwWidth,
143         DWORD* pdwHeight) PURE;
144
145 };
146
147 #ifdef COBJMACROS
148 /*** IUnknown methods ***/
149 #define ITextServices_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
150 #define ITextServices_AddRef(p) (p)->lpVtbl->AddRef(p)
151 #define ITextServices_Release(p) (p)->lpVtbl->Release(p)
152 /*** ITextServices methods ***/
153 #define ITextServices_TxSendMessage(p,a,b,c,d) (p)->lpVtbl->TxSendMessage(p,a,b,c,d)
154 #define ITextServices_TxDraw(p,a,b,c,d,e,f,g,h,i,j,k,l) (p)->lpVtbl->TxDraw(p,a,b,c,d,e,f,g,h,i,j,k,l)
155 #define ITextServices_TxGetHScroll(p,a,b,c,d,e) (p)->lpVtbl->TxGetHScroll(p,a,b,c,d,e)
156 #define ITextServices_TxGetVScroll(p,a,b,c,d,e) (p)->lpVtbl->TxGetVScroll(p,a,b,c,d,e)
157 #define ITextServices_OnTxSetCursor(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->OnTxSetCursor(p,a,b,c,d,e,f,g,h,i)
158 #define ITextServices_TxQueryHitPoint(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->TxQueryHitPoint(p,a,b,c,d,e,f,g,h,i,j)
159 #define ITextServices_OnTxInplaceActivate(p,a) (p)->lpVtbl->OnTxInplaceActivate(p,a)
160 #define ITextServices_OnTxInplaceDeactivate(p) (p)->lpVtbl->OnTxInplaceDeactivate(p)
161 #define ITextServices_OnTxUIActivate(p) (p)->lpVtbl->OnTxUIActivate(p)
162 #define ITextServices_OnTxUIDeactivate(p) (p)->lpVtbl->OnTxUIDeactivate(p)
163 #define ITextServices_TxGetText(p,a) (p)->lpVtbl->TxGetText(p,a)
164 #define ITextServices_TxSetText(p,a) (p)->lpVtbl->TxSetText(p,a)
165 #define ITextServices_TxGetCurrentTargetX(p,a) (p)->lpVtbl->TxGetCurrentTargetX(p,a)
166 #define ITextServices_TxGetBaseLinePos(p,a) (p)->lpVtbl->TxGetBaseLinePos(p,a)
167 #define ITextServices_TxGetNaturalSize(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->TxGetNaturalSize(p,a,b,c,d,e,f,g,h)
168 #define ITextServices_TxGetDropTarget(p,a) (p)->lpVtbl->TxGetDropTarget(p,a)
169 #define ITextServices_OnTxPropertyBitsChange(p,a,b) (p)->lpVtbl->OnTxPropertyBitsChange(p,a,b)
170 #define ITextServices_TxGetCachedSize(p,a,b) (p)->lpVtbl->TxGetCachedSize(p,a,b)
171 #endif
172
173 #undef INTERFACE
174
175 typedef enum _TXTBACKSTYLE {
176     TXTBACK_TRANSPARENT = 0,
177     TXTBACK_OPAQUE
178 } TXTBACKSTYLE;
179
180 enum TXTHITRESULT {
181     TXTHITRESULT_NOHIT = 0,
182     TXTHITRESULT_TRANSPARENT = 1,
183     TXTHITRESULT_CLOSE = 2,
184     TXTHITRESULT_HIT = 3
185 };
186
187 enum TXTNATURALSIZE {
188     TXTNS_FITTOCONTENT = 1,
189     TXTNS_ROUNDTOLINE = 2
190 };
191
192 enum TXTVIEW {
193     TXTVIEW_ACTIVE = 0,
194     TXTVIEW_INACTIVE = 1
195 };
196
197 #define TXTBIT_RICHTEXT         0x000001
198 #define TXTBIT_MULTILINE        0x000002
199 #define TXTBIT_READONLY         0x000004
200 #define TXTBIT_SHOWACCELERATOR  0x000008
201 #define TXTBIT_USEPASSWORD      0x000010
202 #define TXTBIT_HIDESELECTION    0x000020
203 #define TXTBIT_SAVESELECTION    0x000040
204 #define TXTBIT_AUTOWORDSEL      0x000080
205 #define TXTBIT_VERTICAL         0x000100
206 #define TXTBIT_SELBARCHANGE     0x000200
207 #define TXTBIT_WORDWRAP         0x000400
208 #define TXTBIT_ALLOWBEEP        0x000800
209 #define TXTBIT_DISABLEDRAG      0x001000
210 #define TXTBIT_VIEWINSETCHANGE  0x002000
211 #define TXTBIT_BACKSTYLECHANGE  0x004000
212 #define TXTBIT_MAXLENGTHCHANGE  0x008000
213 #define TXTBIT_SCROLLBARCHANGE  0x010000
214 #define TXTBIT_CHARFORMATCHANGE 0x020000
215 #define TXTBIT_PARAFORMATCHANGE 0x040000
216 #define TXTBIT_EXTENTCHANGE     0x080000
217 #define TXTBIT_CLIENTRECTCHANGE 0x100000
218 #define TXTBIT_USECURRENTBKG    0x200000
219
220 typedef struct ITextHost ITextHost;
221
222 /*****************************************************************************
223  * ITextHost interface
224  */
225 #define INTERFACE ITextHost
226 DECLARE_INTERFACE_(ITextHost,IUnknown)
227 {
228     /*** IUnknown methods ***/
229     STDMETHOD(QueryInterface)(THIS_
230         REFIID riid,
231         void** ppvObject) PURE;
232
233     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
234
235     STDMETHOD_(ULONG,Release)(THIS) PURE;
236
237     /*** ITextHost methods ***/
238     STDMETHOD_(HDC,TxGetDC)( THIS
239         ) PURE;
240
241     STDMETHOD_(INT,TxReleaseDC)( THIS_
242         HDC hdc) PURE;
243
244     STDMETHOD_(BOOL,TxShowScrollBar)( THIS_
245         INT fnBar,
246         BOOL fShow) PURE;
247
248     STDMETHOD_(BOOL,TxEnableScrollBar)( THIS_
249         INT fuSBFlags,
250         INT fuArrowflags) PURE;
251
252     STDMETHOD_(BOOL,TxSetScrollRange)( THIS_
253         INT fnBar,
254         LONG nMinPos,
255         INT nMaxPos,
256         BOOL fRedraw) PURE;
257
258     STDMETHOD_(BOOL,TxSetScrollPos)( THIS_
259         INT fnBar,
260         INT nPos,
261         BOOL fRedraw) PURE;
262
263     STDMETHOD_(void,TxInvalidateRect)( THIS_
264         LPCRECT prc,
265         BOOL fMode) PURE;
266
267     STDMETHOD_(void,TxViewChange)( THIS_
268         BOOL fUpdate) PURE;
269
270     STDMETHOD_(BOOL,TxCreateCaret)( THIS_
271         HBITMAP hbmp,
272         INT xWidth,
273         INT yHeight) PURE;
274
275     STDMETHOD_(BOOL,TxShowCaret)( THIS_
276         BOOL fShow) PURE;
277
278     STDMETHOD_(BOOL,TxSetCarentPos)( THIS_
279         INT x,
280         INT y) PURE;
281
282     STDMETHOD_(BOOL,TxSetTimer)( THIS_
283         UINT idTimer,
284         UINT uTimeout) PURE;
285
286     STDMETHOD_(void,TxKillTimer)( THIS_
287         UINT idTimer) PURE;
288
289     STDMETHOD_(void,TxScrollWindowEx)( THIS_
290         INT dx,
291         INT dy,
292         LPCRECT lprcScroll,
293         LPCRECT lprcClip,
294         HRGN hRgnUpdate,
295         LPRECT lprcUpdate,
296         UINT fuScroll) PURE;
297
298     STDMETHOD_(void,TxSetCapture)( THIS_
299         BOOL fCapture) PURE;
300
301     STDMETHOD_(void,TxSetFocus)( THIS
302         ) PURE;
303
304     STDMETHOD_(void,TxSetCursor)( THIS_
305         HCURSOR hcur,
306         BOOL fText) PURE;
307
308     STDMETHOD_(BOOL,TxScreenToClient)( THIS_
309         LPPOINT lppt) PURE;
310
311     STDMETHOD_(BOOL,TxClientToScreen)( THIS_
312         LPPOINT lppt) PURE;
313
314     STDMETHOD(TxActivate)( THIS_
315         LONG* plOldState) PURE;
316
317     STDMETHOD(TxDeactivate)( THIS_
318         LONG lNewState) PURE;
319
320     STDMETHOD(TxGetClientRect)( THIS_
321         LPRECT prc) PURE;
322
323     STDMETHOD(TxGetViewInset)( THIS_
324         LPRECT prc) PURE;
325
326     STDMETHOD(TxGetCharFormat)( THIS_
327         const CHARFORMATW** ppCF) PURE;
328
329     STDMETHOD(TxGetParaFormat)( THIS_
330         const PARAFORMAT** ppPF) PURE;
331
332     STDMETHOD_(COLORREF,TxGetSysColor)( THIS_
333         int nIndex) PURE;
334
335     STDMETHOD(TxGetBackStyle)( THIS_
336         TXTBACKSTYLE* pStyle) PURE;
337
338     STDMETHOD(TxGetMaxLength)( THIS_
339         DWORD* plength) PURE;
340
341     STDMETHOD(TxGetScrollbars)( THIS_
342         DWORD* pdwScrollBar) PURE;
343
344     STDMETHOD(TxGetPasswordChar)( THIS_
345         WCHAR* pch) PURE;
346
347     STDMETHOD(TxGetAcceleratorPos)( THIS_
348         LONG* pch) PURE;
349
350     STDMETHOD(TxGetExtent)( THIS_
351         LPSIZEL lpExtent) PURE;
352
353     STDMETHOD(OnTxCharFormatChange)( THIS_
354         const CHARFORMATW* pcf) PURE;
355
356     STDMETHOD(OnTxParaFormatChange)( THIS_
357         const PARAFORMAT* ppf) PURE;
358
359     STDMETHOD(TxGetPropertyBits)( THIS_
360         DWORD dwMask,
361         DWORD* pdwBits) PURE;
362
363     STDMETHOD(TxNotify)( THIS_
364         DWORD iNotify,
365         void* pv) PURE;
366
367     STDMETHOD_(HIMC,TxImmGetContext)( THIS
368         ) PURE;
369
370     STDMETHOD_(void,TxImmReleaseContext)( THIS_
371         HIMC himc) PURE;
372
373     STDMETHOD(TxGetSelectionBarWidth)( THIS_
374         LONG* lSelBarWidth) PURE;
375
376 };
377
378 #ifdef COBJMACROS
379 /*** IUnknown methods ***/
380 #define ITextHost_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
381 #define ITextHost_AddRef(p) (p)->lpVtbl->AddRef(p)
382 #define ITextHost_Release(p) (p)->lpVtbl->Release(p)
383 /*** ITextHost methods ***/
384 #define ITextHost_TxGetDC(p) (p)->lpVtbl->TxGetDC(p)
385 #define ITextHost_TxReleaseDC(p,a) (p)->lpVtbl->TxReleaseDC(p,a)
386 #define ITextHost_TxShowScrollBar(p,a,b) (p)->lpVtbl->TxShowScrollBar(p,a,b)
387 #define ITextHost_TxEnableScrollBar(p,a,b) (p)->lpVtbl->TxEnableScrollBar(p,a,b)
388 #define ITextHost_TxSetScrollRange(p,a,b,c,d) (p)->lpVtbl->TxSetScrollRange(p,a,b,c,d)
389 #define ITextHost_TxSetScrollPos(p,a,b,c) (p)->lpVtbl->TxSetScrollPos(p,a,b,c)
390 #define ITextHost_TxInvalidateRect(p,a,b) (p)->lpVtbl->TxInvalidateRect(p,a,b)
391 #define ITextHost_TxViewChange(p,a) (p)->lpVtbl->TxViewChange(p,a)
392 #define ITextHost_TxCreateCaret(p,a,b,c) (p)->lpVtbl->TxCreateCaret(p,a,b,c)
393 #define ITextHost_TxShowCaret(p,a) (p)->lpVtbl->TxShowCaret(p,a)
394 #define ITextHost_TxSetCarentPos(p,a,b) (p)->lpVtbl->TxSetCarentPos(p,a,b)
395 #define ITextHost_TxSetTimer(p,a,b) (p)->lpVtbl->TxSetTimer(p,a,b)
396 #define ITextHost_TxKillTimer(p,a) (p)->lpVtbl->TxKillTimer(p,a)
397 #define ITextHost_TxScrollWindowEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->TxScrollWindowEx(p,a,b,c,d,e,f,g)
398 #define ITextHost_TxSetCapture(p,a) (p)->lpVtbl->TxSetCapture(p,a)
399 #define ITextHost_TxSetFocus(p) (p)->lpVtbl->TxSetFocus(p)
400 #define ITextHost_TxSetCursor(p,a,b) (p)->lpVtbl->TxSetCursor(p,a,b)
401 #define ITextHost_TxScreenToClient(p,a) (p)->lpVtbl->TxScreenToClient(p,a)
402 #define ITextHost_TxClientToScreen(p,a) (p)->lpVtbl->TxClientToScreen(p,a)
403 #define ITextHost_TxActivate(p,a) (p)->lpVtbl->TxActivate(p,a)
404 #define ITextHost_TxDeactivate(p,a) (p)->lpVtbl->TxDeactivate(p,a)
405 #define ITextHost_TxGetClientRect(p,a) (p)->lpVtbl->TxGetClientRect(p,a)
406 #define ITextHost_TxGetViewInset(p,a) (p)->lpVtbl->TxGetViewInset(p,a)
407 #define ITextHost_TxGetCharFormat(p,a) (p)->lpVtbl->TxGetCharFormat(p,a)
408 #define ITextHost_TxGetParaFormat(p,a) (p)->lpVtbl->TxGetParaFormat(p,a)
409 #define ITextHost_TxGetSysColor(p,a) (p)->lpVtbl->TxGetSysColor(p,a)
410 #define ITextHost_TxGetBackStyle(p,a) (p)->lpVtbl->TxGetBackStyle(p,a)
411 #define ITextHost_TxGetMaxLength(p,a) (p)->lpVtbl->TxGetMaxLength(p,a)
412 #define ITextHost_TxGetScrollbars(p,a) (p)->lpVtbl->TxGetScrollbars(p,a)
413 #define ITextHost_TxGetPasswordChar(p,a) (p)->lpVtbl->TxGetPasswordChar(p,a)
414 #define ITextHost_TxGetAcceleratorPos(p,a) (p)->lpVtbl->TxGetAcceleratorPos(p,a)
415 #define ITextHost_TxGetExtent(p,a) (p)->lpVtbl->TxGetExtent(p,a)
416 #define ITextHost_OnTxCharFormatChange(p,a) (p)->lpVtbl->OnTxCharFormatChange(p,a)
417 #define ITextHost_OnTxParaFormatChange(p,a) (p)->lpVtbl->OnTxParaFormatChange(p,a)
418 #define ITextHost_TxGetPropertyBits(p,a,b) (p)->lpVtbl->TxGetPropertyBits(p,a,b)
419 #define ITextHost_TxNotify(p,a,b) (p)->lpVtbl->TxNotify(p,a,b)
420 #define ITextHost_TxImmGetContext(p) (p)->lpVtbl->TxImmGetContext(p)
421 #define ITextHost_TxImmReleaseContext(p,a) (p)->lpVtbl->TxImmReleaseContext(p,a)
422 #define ITextHost_TxGetSelectionBarWidth(p,a) (p)->lpVtbl->TxGetSelectionBarWidth(p,a)
423 #endif
424
425 #undef INTERFACE
426
427 #ifdef __cplusplus
428 }
429 #endif
430
431 #endif /* _TEXTSERV_H */