2 * Copyright (C) 2005 Mike McCormack
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.
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.
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
27 #define THISCALLMETHOD_(type,method) virtual type __thiscall method
29 #define THISCALLMETHOD_(type,method) type (__thiscall *method)
32 EXTERN_C
const IID IID_ITextServices
;
33 EXTERN_C
const IID IID_ITextHost
;
34 EXTERN_C
const IID IID_ITextHost2
;
36 /*****************************************************************************
37 * ITextServices interface
39 #define INTERFACE ITextServices
40 DECLARE_INTERFACE_(ITextServices
,IUnknown
)
42 /*** IUnknown methods ***/
43 STDMETHOD(QueryInterface
)(THIS_
45 void** ppvObject
) PURE
;
47 STDMETHOD_(ULONG
,AddRef
)(THIS
) PURE
;
49 STDMETHOD_(ULONG
,Release
)(THIS
) PURE
;
51 /*** ITextServices methods ***/
53 THISCALLMETHOD_(HRESULT
,TxSendMessage
)( THIS_
54 UINT msg
, WPARAM wparam
, LPARAM lparam
, LRESULT
* plresult
) PURE
;
56 THISCALLMETHOD_(HRESULT
,TxDraw
)( THIS_
66 BOOL (CALLBACK
* pfnContinue
)(DWORD
),
70 THISCALLMETHOD_(HRESULT
,TxGetHScroll
)( THIS_
75 BOOL
* pfEnabled
) PURE
;
77 THISCALLMETHOD_(HRESULT
,TxGetVScroll
)( THIS_
82 BOOL
* pfEnabled
) PURE
;
84 THISCALLMETHOD_(HRESULT
,OnTxSetCursor
)( THIS_
95 THISCALLMETHOD_(HRESULT
,TxQueryHitPoint
)( THIS_
105 DWORD
* pHitResult
) PURE
;
107 THISCALLMETHOD_(HRESULT
,OnTxInPlaceActivate
)( THIS_
108 LPCRECT prcClient
) PURE
;
110 THISCALLMETHOD_(HRESULT
,OnTxInPlaceDeactivate
)( THIS
) PURE
;
112 THISCALLMETHOD_(HRESULT
,OnTxUIActivate
)( THIS
) PURE
;
114 THISCALLMETHOD_(HRESULT
,OnTxUIDeactivate
)( THIS
) PURE
;
116 THISCALLMETHOD_(HRESULT
,TxGetText
)( THIS_
117 BSTR
* pbstrText
) PURE
;
119 THISCALLMETHOD_(HRESULT
,TxSetText
)( THIS_
120 LPCWSTR pszText
) PURE
;
122 THISCALLMETHOD_(HRESULT
,TxGetCurTargetX
)( THIS_
125 THISCALLMETHOD_(HRESULT
,TxGetBaseLinePos
)( THIS_
128 THISCALLMETHOD_(HRESULT
,TxGetNaturalSize
)( THIS_
134 const SIZEL
* psizelExtent
,
138 THISCALLMETHOD_(HRESULT
,TxGetDropTarget
)( THIS_
139 IDropTarget
** ppDropTarget
) PURE
;
141 THISCALLMETHOD_(HRESULT
,OnTxPropertyBitsChange
)( THIS_
145 THISCALLMETHOD_(HRESULT
,TxGetCachedSize
)( THIS_
147 DWORD
* pdwHeight
) PURE
;
153 /*** IUnknown methods ***/
154 #define ITextServices_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
155 #define ITextServices_AddRef(p) (p)->lpVtbl->AddRef(p)
156 #define ITextServices_Release(p) (p)->lpVtbl->Release(p)
159 typedef enum _TXTBACKSTYLE
{
160 TXTBACK_TRANSPARENT
= 0,
165 TXTHITRESULT_NOHIT
= 0,
166 TXTHITRESULT_TRANSPARENT
= 1,
167 TXTHITRESULT_CLOSE
= 2,
171 enum TXTNATURALSIZE
{
172 TXTNS_FITTOCONTENT
= 1,
173 TXTNS_ROUNDTOLINE
= 2
178 TXTVIEW_INACTIVE
= -1
181 #define TXTBIT_RICHTEXT 0x000001
182 #define TXTBIT_MULTILINE 0x000002
183 #define TXTBIT_READONLY 0x000004
184 #define TXTBIT_SHOWACCELERATOR 0x000008
185 #define TXTBIT_USEPASSWORD 0x000010
186 #define TXTBIT_HIDESELECTION 0x000020
187 #define TXTBIT_SAVESELECTION 0x000040
188 #define TXTBIT_AUTOWORDSEL 0x000080
189 #define TXTBIT_VERTICAL 0x000100
190 #define TXTBIT_SELBARCHANGE 0x000200
191 #define TXTBIT_WORDWRAP 0x000400
192 #define TXTBIT_ALLOWBEEP 0x000800
193 #define TXTBIT_DISABLEDRAG 0x001000
194 #define TXTBIT_VIEWINSETCHANGE 0x002000
195 #define TXTBIT_BACKSTYLECHANGE 0x004000
196 #define TXTBIT_MAXLENGTHCHANGE 0x008000
197 #define TXTBIT_SCROLLBARCHANGE 0x010000
198 #define TXTBIT_CHARFORMATCHANGE 0x020000
199 #define TXTBIT_PARAFORMATCHANGE 0x040000
200 #define TXTBIT_EXTENTCHANGE 0x080000
201 #define TXTBIT_CLIENTRECTCHANGE 0x100000
202 #define TXTBIT_USECURRENTBKG 0x200000
204 /*****************************************************************************
205 * ITextHost interface
207 #define INTERFACE ITextHost
208 DECLARE_INTERFACE_(ITextHost
,IUnknown
)
210 /*** IUnknown methods ***/
211 STDMETHOD(QueryInterface
)(THIS_
213 void** ppvObject
) PURE
;
215 STDMETHOD_(ULONG
,AddRef
)(THIS
) PURE
;
217 STDMETHOD_(ULONG
,Release
)(THIS
) PURE
;
219 /*** ITextHost methods ***/
220 THISCALLMETHOD_(HDC
,TxGetDC
)( THIS
223 THISCALLMETHOD_(INT
,TxReleaseDC
)( THIS_
226 THISCALLMETHOD_(BOOL
,TxShowScrollBar
)( THIS_
230 THISCALLMETHOD_(BOOL
,TxEnableScrollBar
)( THIS_
232 INT fuArrowflags
) PURE
;
234 THISCALLMETHOD_(BOOL
,TxSetScrollRange
)( THIS_
240 THISCALLMETHOD_(BOOL
,TxSetScrollPos
)( THIS_
245 THISCALLMETHOD_(void,TxInvalidateRect
)( THIS_
249 THISCALLMETHOD_(void,TxViewChange
)( THIS_
252 THISCALLMETHOD_(BOOL
,TxCreateCaret
)( THIS_
257 THISCALLMETHOD_(BOOL
,TxShowCaret
)( THIS_
260 THISCALLMETHOD_(BOOL
,TxSetCaretPos
)( THIS_
264 THISCALLMETHOD_(BOOL
,TxSetTimer
)( THIS_
268 THISCALLMETHOD_(void,TxKillTimer
)( THIS_
271 THISCALLMETHOD_(void,TxScrollWindowEx
)( THIS_
280 THISCALLMETHOD_(void,TxSetCapture
)( THIS_
283 THISCALLMETHOD_(void,TxSetFocus
)( THIS
286 THISCALLMETHOD_(void,TxSetCursor
)( THIS_
290 THISCALLMETHOD_(BOOL
,TxScreenToClient
)( THIS_
293 THISCALLMETHOD_(BOOL
,TxClientToScreen
)( THIS_
296 THISCALLMETHOD_(HRESULT
,TxActivate
)( THIS_
297 LONG
* plOldState
) PURE
;
299 THISCALLMETHOD_(HRESULT
,TxDeactivate
)( THIS_
300 LONG lNewState
) PURE
;
302 THISCALLMETHOD_(HRESULT
,TxGetClientRect
)( THIS_
305 THISCALLMETHOD_(HRESULT
,TxGetViewInset
)( THIS_
308 THISCALLMETHOD_(HRESULT
,TxGetCharFormat
)( THIS_
309 const CHARFORMATW
** ppCF
) PURE
;
311 THISCALLMETHOD_(HRESULT
,TxGetParaFormat
)( THIS_
312 const PARAFORMAT
** ppPF
) PURE
;
314 THISCALLMETHOD_(COLORREF
,TxGetSysColor
)( THIS_
317 THISCALLMETHOD_(HRESULT
,TxGetBackStyle
)( THIS_
318 TXTBACKSTYLE
* pStyle
) PURE
;
320 THISCALLMETHOD_(HRESULT
,TxGetMaxLength
)( THIS_
321 DWORD
* plength
) PURE
;
323 THISCALLMETHOD_(HRESULT
,TxGetScrollBars
)( THIS_
324 DWORD
* pdwScrollBar
) PURE
;
326 THISCALLMETHOD_(HRESULT
,TxGetPasswordChar
)( THIS_
329 THISCALLMETHOD_(HRESULT
,TxGetAcceleratorPos
)( THIS_
332 THISCALLMETHOD_(HRESULT
,TxGetExtent
)( THIS_
333 LPSIZEL lpExtent
) PURE
;
335 THISCALLMETHOD_(HRESULT
,OnTxCharFormatChange
)( THIS_
336 const CHARFORMATW
* pcf
) PURE
;
338 THISCALLMETHOD_(HRESULT
,OnTxParaFormatChange
)( THIS_
339 const PARAFORMAT
* ppf
) PURE
;
341 THISCALLMETHOD_(HRESULT
,TxGetPropertyBits
)( THIS_
343 DWORD
* pdwBits
) PURE
;
345 THISCALLMETHOD_(HRESULT
,TxNotify
)( THIS_
349 THISCALLMETHOD_(HIMC
,TxImmGetContext
)( THIS
352 THISCALLMETHOD_(void,TxImmReleaseContext
)( THIS_
355 THISCALLMETHOD_(HRESULT
,TxGetSelectionBarWidth
)( THIS_
356 LONG
* lSelBarWidth
) PURE
;
362 /*** IUnknown methods ***/
363 #define ITextHost_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
364 #define ITextHost_AddRef(p) (p)->lpVtbl->AddRef(p)
365 #define ITextHost_Release(p) (p)->lpVtbl->Release(p)
368 /*****************************************************************************
369 * ITextHost2 interface
371 #define INTERFACE ITextHost2
372 DECLARE_INTERFACE_(ITextHost2
,ITextHost
)
374 /*** IUnknown methods ***/
375 STDMETHOD(QueryInterface
)( THIS_ REFIID riid
, void** ppvObject
) PURE
;
376 STDMETHOD_(ULONG
,AddRef
)( THIS
) PURE
;
377 STDMETHOD_(ULONG
,Release
)( THIS
) PURE
;
378 /*** ITextHost methods ***/
379 THISCALLMETHOD_(HDC
,TxGetDC
)( THIS
) PURE
;
380 THISCALLMETHOD_(INT
,TxReleaseDC
)( THIS_ HDC hdc
) PURE
;
381 THISCALLMETHOD_(BOOL
,TxShowScrollBar
)( THIS_ INT fnBar
, BOOL fShow
) PURE
;
382 THISCALLMETHOD_(BOOL
,TxEnableScrollBar
)( THIS_ INT fuSBFlags
, INT fuArrowflags
) PURE
;
383 THISCALLMETHOD_(BOOL
,TxSetScrollRange
)( THIS_ INT fnBar
, LONG nMinPos
, INT nMaxPos
, BOOL fRedraw
) PURE
;
384 THISCALLMETHOD_(BOOL
,TxSetScrollPos
)( THIS_ INT fnBar
, INT nPos
, BOOL fRedraw
) PURE
;
385 THISCALLMETHOD_(void,TxInvalidateRect
)( THIS_ LPCRECT prc
, BOOL fMode
) PURE
;
386 THISCALLMETHOD_(void,TxViewChange
)( THIS_ BOOL fUpdate
) PURE
;
387 THISCALLMETHOD_(BOOL
,TxCreateCaret
)( THIS_ HBITMAP hbmp
, INT xWidth
, INT yHeight
) PURE
;
388 THISCALLMETHOD_(BOOL
,TxShowCaret
)( THIS_ BOOL fShow
) PURE
;
389 THISCALLMETHOD_(BOOL
,TxSetCaretPos
)( THIS_ INT x
, INT y
) PURE
;
390 THISCALLMETHOD_(BOOL
,TxSetTimer
)( THIS_ UINT idTimer
, UINT uTimeout
) PURE
;
391 THISCALLMETHOD_(void,TxKillTimer
)( THIS_ UINT idTimer
) PURE
;
392 THISCALLMETHOD_(void,TxScrollWindowEx
)( THIS_ INT dx
, INT dy
, LPCRECT lprcScroll
, LPCRECT lprcClip
,
393 HRGN hRgnUpdate
, LPRECT lprcUpdate
, UINT fuScroll
) PURE
;
394 THISCALLMETHOD_(void,TxSetCapture
)( THIS_ BOOL fCapture
) PURE
;
395 THISCALLMETHOD_(void,TxSetFocus
)( THIS
) PURE
;
396 THISCALLMETHOD_(void,TxSetCursor
)( THIS_ HCURSOR hcur
, BOOL fText
) PURE
;
397 THISCALLMETHOD_(BOOL
,TxScreenToClient
)( THIS_ LPPOINT lppt
) PURE
;
398 THISCALLMETHOD_(BOOL
,TxClientToScreen
)( THIS_ LPPOINT lppt
) PURE
;
399 THISCALLMETHOD_(HRESULT
,TxActivate
)( THIS_ LONG
* plOldState
) PURE
;
400 THISCALLMETHOD_(HRESULT
,TxDeactivate
)( THIS_ LONG lNewState
) PURE
;
401 THISCALLMETHOD_(HRESULT
,TxGetClientRect
)( THIS_ LPRECT prc
) PURE
;
402 THISCALLMETHOD_(HRESULT
,TxGetViewInset
)( THIS_ LPRECT prc
) PURE
;
403 THISCALLMETHOD_(HRESULT
,TxGetCharFormat
)( THIS_
const CHARFORMATW
** ppCF
) PURE
;
404 THISCALLMETHOD_(HRESULT
,TxGetParaFormat
)( THIS_
const PARAFORMAT
** ppPF
) PURE
;
405 THISCALLMETHOD_(COLORREF
,TxGetSysColor
)( THIS_
int nIndex
) PURE
;
406 THISCALLMETHOD_(HRESULT
,TxGetBackStyle
)( THIS_ TXTBACKSTYLE
* pStyle
) PURE
;
407 THISCALLMETHOD_(HRESULT
,TxGetMaxLength
)( THIS_ DWORD
* plength
) PURE
;
408 THISCALLMETHOD_(HRESULT
,TxGetScrollBars
)( THIS_ DWORD
* pdwScrollBar
) PURE
;
409 THISCALLMETHOD_(HRESULT
,TxGetPasswordChar
)( THIS_ WCHAR
* pch
) PURE
;
410 THISCALLMETHOD_(HRESULT
,TxGetAcceleratorPos
)( THIS_ LONG
* pch
) PURE
;
411 THISCALLMETHOD_(HRESULT
,TxGetExtent
)( THIS_ LPSIZEL lpExtent
) PURE
;
412 THISCALLMETHOD_(HRESULT
,OnTxCharFormatChange
)( THIS_
const CHARFORMATW
* pcf
) PURE
;
413 THISCALLMETHOD_(HRESULT
,OnTxParaFormatChange
)( THIS_
const PARAFORMAT
* ppf
) PURE
;
414 THISCALLMETHOD_(HRESULT
,TxGetPropertyBits
)( THIS_ DWORD dwMask
, DWORD
* pdwBits
) PURE
;
415 THISCALLMETHOD_(HRESULT
,TxNotify
)( THIS_ DWORD iNotify
, void* pv
) PURE
;
416 THISCALLMETHOD_(HIMC
,TxImmGetContext
)( THIS
) PURE
;
417 THISCALLMETHOD_(void,TxImmReleaseContext
)( THIS_ HIMC himc
) PURE
;
418 THISCALLMETHOD_(HRESULT
,TxGetSelectionBarWidth
)( THIS_ LONG
* lSelBarWidth
) PURE
;
419 /* ITextHost2 methods */
420 THISCALLMETHOD_(BOOL
,TxIsDoubleClickPending
)( THIS
) PURE
;
421 THISCALLMETHOD_(HRESULT
,TxGetWindow
)( THIS_ HWND
*hwnd
) PURE
;
422 THISCALLMETHOD_(HRESULT
,TxSetForegroundWindow
)( THIS
) PURE
;
423 THISCALLMETHOD_(HPALETTE
,TxGetPalette
)( THIS
) PURE
;
424 THISCALLMETHOD_(HRESULT
,TxGetEastAsianFlags
)( THIS_ LONG
*flags
) PURE
;
425 THISCALLMETHOD_(HCURSOR
,TxSetCursor2
)( THIS_ HCURSOR cursor
, BOOL text
) PURE
;
426 THISCALLMETHOD_(void,TxFreeTextServicesNotification
)( THIS
) PURE
;
427 THISCALLMETHOD_(HRESULT
,TxGetEditStyle
)( THIS_ DWORD item
, DWORD
*data
) PURE
;
428 THISCALLMETHOD_(HRESULT
,TxGetWindowStyles
)( THIS_ DWORD
*style
, DWORD
*ex_style
) PURE
;
429 THISCALLMETHOD_(HRESULT
,TxShowDropCaret
)( THIS_ BOOL show
, HDC hdc
, const RECT
*rect
) PURE
;
430 THISCALLMETHOD_(HRESULT
,TxDestroyCaret
)( THIS
) PURE
;
431 THISCALLMETHOD_(HRESULT
,TxGetHorzExtent
)( THIS_ LONG
*horz_extent
) PURE
;
436 /*** IUnknown methods ***/
437 #define ITextHost2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
438 #define ITextHost2_AddRef(p) (p)->lpVtbl->AddRef(p)
439 #define ITextHost2_Release(p) (p)->lpVtbl->Release(p)
442 HRESULT WINAPI
CreateTextServices(IUnknown
*,ITextHost
*,IUnknown
**);
444 typedef HRESULT (WINAPI
*PCreateTextServices
)(IUnknown
*,ITextHost
*,IUnknown
**);
450 #endif /* _TEXTSERV_H */