server: Make the fd passing code slightly more portable.
[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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 #define INTERFACE ITextServices
34 DECLARE_INTERFACE_(ITextServices,IUnknown)
35 {
36     /*** IUnknown methods ***/
37     STDMETHOD(QueryInterface)(THIS_
38         REFIID riid,
39         void** ppvObject) PURE;
40
41     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
42
43     STDMETHOD_(ULONG,Release)(THIS) PURE;
44
45     /*** ITextServices methods ***/
46
47     STDMETHOD(TxSendMessage)( THIS_
48         UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) PURE;
49
50     STDMETHOD(TxDraw)( THIS_
51         DWORD dwDrawAspect,
52         LONG lindex,
53         void* pvAspect,
54         DVTARGETDEVICE* ptd,
55         HDC hdcDraw,
56         HDC hicTargetDev,
57         LPCRECTL lprcBounds,
58         LPCRECTL lprcWBounds,
59         LPRECT lprcUpdate,
60         BOOL (CALLBACK * pfnContinue)(DWORD),
61         DWORD dwContinue,
62         LONG lViewId) PURE;
63
64     STDMETHOD(TxGetHScroll)( THIS_
65         LONG* plMin,
66         LONG* plMax,
67         LONG* plPos,
68         LONG* plPage,
69         BOOL* pfEnabled) PURE;
70
71     STDMETHOD(TxGetVScroll)( THIS_
72         LONG* plMin,
73         LONG* plMax,
74         LONG* plPos,
75         LONG* plPage,
76         BOOL* pfEnabled) PURE;
77
78     STDMETHOD(OnTxSetCursor)( THIS_
79         DWORD dwDrawAspect,
80         LONG lindex,
81         void* pvAspect,
82         DVTARGETDEVICE* ptd,
83         HDC hdcDraw,
84         HDC hicTargetDev,
85         LPCRECT lprcClient,
86         INT x,
87         INT y) PURE;
88
89     STDMETHOD(TxQueryHitPoint)( THIS_
90         DWORD dwDrawAspect,
91         LONG lindex,
92         void* pvAspect,
93         DVTARGETDEVICE* ptd,
94         HDC hdcDraw,
95         HDC hicTargetDev,
96         LPCRECT lprcClient,
97         INT x,
98         INT y,
99         DWORD* pHitResult) PURE;
100
101     STDMETHOD(OnTxInplaceActivate)( THIS_
102         LPCRECT prcClient) PURE;
103
104     STDMETHOD(OnTxInplaceDeactivate)( THIS ) PURE;
105
106     STDMETHOD(OnTxUIActivate)( THIS ) PURE;
107
108     STDMETHOD(OnTxUIDeactivate)( THIS ) PURE;
109
110     STDMETHOD(TxGetText)( THIS_
111         BSTR* pbstrText) PURE;
112
113     STDMETHOD(TxSetText)( THIS_
114         LPCWSTR pszText) PURE;
115
116     STDMETHOD(TxGetCurrentTargetX)( THIS_
117         LONG* x) PURE;
118
119     STDMETHOD(TxGetBaseLinePos)( THIS_
120         LONG* x) PURE;
121
122     STDMETHOD(TxGetNaturalSize)( THIS_
123         DWORD dwAspect,
124         HDC hdcDraw,
125         HDC hicTargetDev,
126         DVTARGETDEVICE* ptd,
127         DWORD dwMode,
128         const SIZEL* psizelExtent,
129         LONG* pwidth,
130         LONG* pheight) PURE;
131
132     STDMETHOD(TxGetDropTarget)( THIS_
133         IDropTarget** ppDropTarget) PURE;
134
135     STDMETHOD(OnTxPropertyBitsChange)( THIS_
136         DWORD dwMask,
137         DWORD dwBits) PURE;
138
139     STDMETHOD(TxGetCachedSize)( THIS_
140         DWORD* pdwWidth,
141         DWORD* pdwHeight) PURE;
142
143 };
144
145 #ifdef COBJMACROS
146 /*** IUnknown methods ***/
147 #define ITextServices_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
148 #define ITextServices_AddRef(p) (p)->lpVtbl->AddRef(p)
149 #define ITextServices_Release(p) (p)->lpVtbl->Release(p)
150 #endif
151
152 #undef INTERFACE
153
154 typedef enum _TXTBACKSTYLE {
155     TXTBACK_TRANSPARENT = 0,
156     TXTBACK_OPAQUE
157 } TXTBACKSTYLE;
158
159 enum TXTHITRESULT {
160     TXTHITRESULT_NOHIT = 0,
161     TXTHITRESULT_TRANSPARENT = 1,
162     TXTHITRESULT_CLOSE = 2,
163     TXTHITRESULT_HIT = 3
164 };
165
166 enum TXTNATURALSIZE {
167     TXTNS_FITTOCONTENT = 1,
168     TXTNS_ROUNDTOLINE = 2
169 };
170
171 enum TXTVIEW {
172     TXTVIEW_ACTIVE = 0,
173     TXTVIEW_INACTIVE = 1
174 };
175
176 #define TXTBIT_RICHTEXT         0x000001
177 #define TXTBIT_MULTILINE        0x000002
178 #define TXTBIT_READONLY         0x000004
179 #define TXTBIT_SHOWACCELERATOR  0x000008
180 #define TXTBIT_USEPASSWORD      0x000010
181 #define TXTBIT_HIDESELECTION    0x000020
182 #define TXTBIT_SAVESELECTION    0x000040
183 #define TXTBIT_AUTOWORDSEL      0x000080
184 #define TXTBIT_VERTICAL         0x000100
185 #define TXTBIT_SELBARCHANGE     0x000200
186 #define TXTBIT_WORDWRAP         0x000400
187 #define TXTBIT_ALLOWBEEP        0x000800
188 #define TXTBIT_DISABLEDRAG      0x001000
189 #define TXTBIT_VIEWINSETCHANGE  0x002000
190 #define TXTBIT_BACKSTYLECHANGE  0x004000
191 #define TXTBIT_MAXLENGTHCHANGE  0x008000
192 #define TXTBIT_SCROLLBARCHANGE  0x010000
193 #define TXTBIT_CHARFORMATCHANGE 0x020000
194 #define TXTBIT_PARAFORMATCHANGE 0x040000
195 #define TXTBIT_EXTENTCHANGE     0x080000
196 #define TXTBIT_CLIENTRECTCHANGE 0x100000
197 #define TXTBIT_USECURRENTBKG    0x200000
198
199 /*****************************************************************************
200  * ITextHost interface
201  */
202 #define INTERFACE ITextHost
203 DECLARE_INTERFACE_(ITextHost,IUnknown)
204 {
205     /*** IUnknown methods ***/
206     STDMETHOD(QueryInterface)(THIS_
207         REFIID riid,
208         void** ppvObject) PURE;
209
210     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
211
212     STDMETHOD_(ULONG,Release)(THIS) PURE;
213
214     /*** ITextHost methods ***/
215     STDMETHOD_(HDC,TxGetDC)( THIS
216         ) PURE;
217
218     STDMETHOD_(INT,TxReleaseDC)( THIS_
219         HDC hdc) PURE;
220
221     STDMETHOD_(BOOL,TxShowScrollBar)( THIS_
222         INT fnBar,
223         BOOL fShow) PURE;
224
225     STDMETHOD_(BOOL,TxEnableScrollBar)( THIS_
226         INT fuSBFlags,
227         INT fuArrowflags) PURE;
228
229     STDMETHOD_(BOOL,TxSetScrollRange)( THIS_
230         INT fnBar,
231         LONG nMinPos,
232         INT nMaxPos,
233         BOOL fRedraw) PURE;
234
235     STDMETHOD_(BOOL,TxSetScrollPos)( THIS_
236         INT fnBar,
237         INT nPos,
238         BOOL fRedraw) PURE;
239
240     STDMETHOD_(void,TxInvalidateRect)( THIS_
241         LPCRECT prc,
242         BOOL fMode) PURE;
243
244     STDMETHOD_(void,TxViewChange)( THIS_
245         BOOL fUpdate) PURE;
246
247     STDMETHOD_(BOOL,TxCreateCaret)( THIS_
248         HBITMAP hbmp,
249         INT xWidth,
250         INT yHeight) PURE;
251
252     STDMETHOD_(BOOL,TxShowCaret)( THIS_
253         BOOL fShow) PURE;
254
255     STDMETHOD_(BOOL,TxSetCaretPos)( THIS_
256         INT x,
257         INT y) PURE;
258
259     STDMETHOD_(BOOL,TxSetTimer)( THIS_
260         UINT idTimer,
261         UINT uTimeout) PURE;
262
263     STDMETHOD_(void,TxKillTimer)( THIS_
264         UINT idTimer) PURE;
265
266     STDMETHOD_(void,TxScrollWindowEx)( THIS_
267         INT dx,
268         INT dy,
269         LPCRECT lprcScroll,
270         LPCRECT lprcClip,
271         HRGN hRgnUpdate,
272         LPRECT lprcUpdate,
273         UINT fuScroll) PURE;
274
275     STDMETHOD_(void,TxSetCapture)( THIS_
276         BOOL fCapture) PURE;
277
278     STDMETHOD_(void,TxSetFocus)( THIS
279         ) PURE;
280
281     STDMETHOD_(void,TxSetCursor)( THIS_
282         HCURSOR hcur,
283         BOOL fText) PURE;
284
285     STDMETHOD_(BOOL,TxScreenToClient)( THIS_
286         LPPOINT lppt) PURE;
287
288     STDMETHOD_(BOOL,TxClientToScreen)( THIS_
289         LPPOINT lppt) PURE;
290
291     STDMETHOD(TxActivate)( THIS_
292         LONG* plOldState) PURE;
293
294     STDMETHOD(TxDeactivate)( THIS_
295         LONG lNewState) PURE;
296
297     STDMETHOD(TxGetClientRect)( THIS_
298         LPRECT prc) PURE;
299
300     STDMETHOD(TxGetViewInset)( THIS_
301         LPRECT prc) PURE;
302
303     STDMETHOD(TxGetCharFormat)( THIS_
304         const CHARFORMATW** ppCF) PURE;
305
306     STDMETHOD(TxGetParaFormat)( THIS_
307         const PARAFORMAT** ppPF) PURE;
308
309     STDMETHOD_(COLORREF,TxGetSysColor)( THIS_
310         int nIndex) PURE;
311
312     STDMETHOD(TxGetBackStyle)( THIS_
313         TXTBACKSTYLE* pStyle) PURE;
314
315     STDMETHOD(TxGetMaxLength)( THIS_
316         DWORD* plength) PURE;
317
318     STDMETHOD(TxGetScrollBars)( THIS_
319         DWORD* pdwScrollBar) PURE;
320
321     STDMETHOD(TxGetPasswordChar)( THIS_
322         WCHAR* pch) PURE;
323
324     STDMETHOD(TxGetAcceleratorPos)( THIS_
325         LONG* pch) PURE;
326
327     STDMETHOD(TxGetExtent)( THIS_
328         LPSIZEL lpExtent) PURE;
329
330     STDMETHOD(OnTxCharFormatChange)( THIS_
331         const CHARFORMATW* pcf) PURE;
332
333     STDMETHOD(OnTxParaFormatChange)( THIS_
334         const PARAFORMAT* ppf) PURE;
335
336     STDMETHOD(TxGetPropertyBits)( THIS_
337         DWORD dwMask,
338         DWORD* pdwBits) PURE;
339
340     STDMETHOD(TxNotify)( THIS_
341         DWORD iNotify,
342         void* pv) PURE;
343
344     STDMETHOD_(HIMC,TxImmGetContext)( THIS
345         ) PURE;
346
347     STDMETHOD_(void,TxImmReleaseContext)( THIS_
348         HIMC himc) PURE;
349
350     STDMETHOD(TxGetSelectionBarWidth)( THIS_
351         LONG* lSelBarWidth) PURE;
352
353 };
354
355 #ifdef COBJMACROS
356 /*** IUnknown methods ***/
357 #define ITextHost_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
358 #define ITextHost_AddRef(p) (p)->lpVtbl->AddRef(p)
359 #define ITextHost_Release(p) (p)->lpVtbl->Release(p)
360 #endif
361
362 #undef INTERFACE
363
364 HRESULT WINAPI CreateTextServices(IUnknown*,ITextHost*,IUnknown**);
365
366 typedef HRESULT (WINAPI *PCreateTextServices)(IUnknown*,ITextHost*,IUnknown**);
367
368 #ifdef __cplusplus
369 }
370 #endif
371
372 #endif /* _TEXTSERV_H */