textserv.h 9.79 KB
Newer Older
Mike McCormack's avatar
Mike McCormack committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (C) 2005 Mike McCormack
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
Mike McCormack's avatar
Mike McCormack committed
17 18 19 20 21 22 23 24 25
 */

#ifndef _TEXTSERV_H
#define _TEXTSERV_H

#ifdef __cplusplus
extern "C" {
#endif

26 27 28 29 30 31
#ifdef __cplusplus
#define THISCALLMETHOD_(type,method)  virtual type __thiscall method
#else
#define THISCALLMETHOD_(type,method)  type (__thiscall *method)
#endif

32 33
EXTERN_C const IID IID_ITextServices;
EXTERN_C const IID IID_ITextHost;
Mike McCormack's avatar
Mike McCormack committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

/*****************************************************************************
 * ITextServices interface
 */
#define INTERFACE ITextServices
DECLARE_INTERFACE_(ITextServices,IUnknown)
{
    /*** IUnknown methods ***/
    STDMETHOD(QueryInterface)(THIS_
        REFIID riid,
        void** ppvObject) PURE;

    STDMETHOD_(ULONG,AddRef)(THIS) PURE;

    STDMETHOD_(ULONG,Release)(THIS) PURE;

    /*** ITextServices methods ***/

52
    THISCALLMETHOD_(HRESULT,TxSendMessage)( THIS_
Mike McCormack's avatar
Mike McCormack committed
53 54
        UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) PURE;

55
    THISCALLMETHOD_(HRESULT,TxDraw)( THIS_
Mike McCormack's avatar
Mike McCormack committed
56 57 58 59 60 61 62 63 64 65 66 67 68
        DWORD dwDrawAspect,
        LONG lindex,
        void* pvAspect,
        DVTARGETDEVICE* ptd,
        HDC hdcDraw,
        HDC hicTargetDev,
        LPCRECTL lprcBounds,
        LPCRECTL lprcWBounds,
        LPRECT lprcUpdate,
        BOOL (CALLBACK * pfnContinue)(DWORD),
        DWORD dwContinue,
        LONG lViewId) PURE;

69
    THISCALLMETHOD_(HRESULT,TxGetHScroll)( THIS_
Mike McCormack's avatar
Mike McCormack committed
70 71 72 73 74 75
        LONG* plMin,
        LONG* plMax,
        LONG* plPos,
        LONG* plPage,
        BOOL* pfEnabled) PURE;

76
    THISCALLMETHOD_(HRESULT,TxGetVScroll)( THIS_
Mike McCormack's avatar
Mike McCormack committed
77 78 79 80 81 82
        LONG* plMin,
        LONG* plMax,
        LONG* plPos,
        LONG* plPage,
        BOOL* pfEnabled) PURE;

83
    THISCALLMETHOD_(HRESULT,OnTxSetCursor)( THIS_
Mike McCormack's avatar
Mike McCormack committed
84 85 86 87 88 89 90 91 92 93
        DWORD dwDrawAspect,
        LONG lindex,
        void* pvAspect,
        DVTARGETDEVICE* ptd,
        HDC hdcDraw,
        HDC hicTargetDev,
        LPCRECT lprcClient,
        INT x,
        INT y) PURE;

94
    THISCALLMETHOD_(HRESULT,TxQueryHitPoint)( THIS_
Mike McCormack's avatar
Mike McCormack committed
95 96 97 98 99 100 101 102 103 104 105
        DWORD dwDrawAspect,
        LONG lindex,
        void* pvAspect,
        DVTARGETDEVICE* ptd,
        HDC hdcDraw,
        HDC hicTargetDev,
        LPCRECT lprcClient,
        INT x,
        INT y,
        DWORD* pHitResult) PURE;

106
    THISCALLMETHOD_(HRESULT,OnTxInplaceActivate)( THIS_
Mike McCormack's avatar
Mike McCormack committed
107 108
        LPCRECT prcClient) PURE;

109
    THISCALLMETHOD_(HRESULT,OnTxInplaceDeactivate)( THIS ) PURE;
110

111
    THISCALLMETHOD_(HRESULT,OnTxUIActivate)( THIS ) PURE;
Mike McCormack's avatar
Mike McCormack committed
112

113
    THISCALLMETHOD_(HRESULT,OnTxUIDeactivate)( THIS ) PURE;
Mike McCormack's avatar
Mike McCormack committed
114

115
    THISCALLMETHOD_(HRESULT,TxGetText)( THIS_
Mike McCormack's avatar
Mike McCormack committed
116 117
        BSTR* pbstrText) PURE;

118
    THISCALLMETHOD_(HRESULT,TxSetText)( THIS_
Mike McCormack's avatar
Mike McCormack committed
119 120
        LPCWSTR pszText) PURE;

121
    THISCALLMETHOD_(HRESULT,TxGetCurTargetX)( THIS_
Mike McCormack's avatar
Mike McCormack committed
122 123
        LONG* x) PURE;

124
    THISCALLMETHOD_(HRESULT,TxGetBaseLinePos)( THIS_
Mike McCormack's avatar
Mike McCormack committed
125 126
        LONG* x) PURE;

127
    THISCALLMETHOD_(HRESULT,TxGetNaturalSize)( THIS_
Mike McCormack's avatar
Mike McCormack committed
128 129 130 131 132 133 134 135 136
        DWORD dwAspect,
        HDC hdcDraw,
        HDC hicTargetDev,
        DVTARGETDEVICE* ptd,
        DWORD dwMode,
        const SIZEL* psizelExtent,
        LONG* pwidth,
        LONG* pheight) PURE;

137
    THISCALLMETHOD_(HRESULT,TxGetDropTarget)( THIS_
Mike McCormack's avatar
Mike McCormack committed
138 139
        IDropTarget** ppDropTarget) PURE;

140
    THISCALLMETHOD_(HRESULT,OnTxPropertyBitsChange)( THIS_
Mike McCormack's avatar
Mike McCormack committed
141 142 143
        DWORD dwMask,
        DWORD dwBits) PURE;

144
    THISCALLMETHOD_(HRESULT,TxGetCachedSize)( THIS_
Mike McCormack's avatar
Mike McCormack committed
145 146 147 148
        DWORD* pdwWidth,
        DWORD* pdwHeight) PURE;

};
149
#undef INTERFACE
Mike McCormack's avatar
Mike McCormack committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179

#ifdef COBJMACROS
/*** IUnknown methods ***/
#define ITextServices_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define ITextServices_AddRef(p) (p)->lpVtbl->AddRef(p)
#define ITextServices_Release(p) (p)->lpVtbl->Release(p)
#endif

typedef enum _TXTBACKSTYLE {
    TXTBACK_TRANSPARENT = 0,
    TXTBACK_OPAQUE
} TXTBACKSTYLE;

enum TXTHITRESULT {
    TXTHITRESULT_NOHIT = 0,
    TXTHITRESULT_TRANSPARENT = 1,
    TXTHITRESULT_CLOSE = 2,
    TXTHITRESULT_HIT = 3
};

enum TXTNATURALSIZE {
    TXTNS_FITTOCONTENT = 1,
    TXTNS_ROUNDTOLINE = 2
};

enum TXTVIEW {
    TXTVIEW_ACTIVE = 0,
    TXTVIEW_INACTIVE = 1
};

180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
#define TXTBIT_RICHTEXT         0x000001
#define TXTBIT_MULTILINE        0x000002
#define TXTBIT_READONLY         0x000004
#define TXTBIT_SHOWACCELERATOR  0x000008
#define TXTBIT_USEPASSWORD      0x000010
#define TXTBIT_HIDESELECTION    0x000020
#define TXTBIT_SAVESELECTION    0x000040
#define TXTBIT_AUTOWORDSEL      0x000080
#define TXTBIT_VERTICAL         0x000100
#define TXTBIT_SELBARCHANGE     0x000200
#define TXTBIT_WORDWRAP         0x000400
#define TXTBIT_ALLOWBEEP        0x000800
#define TXTBIT_DISABLEDRAG      0x001000
#define TXTBIT_VIEWINSETCHANGE  0x002000
#define TXTBIT_BACKSTYLECHANGE  0x004000
#define TXTBIT_MAXLENGTHCHANGE  0x008000
#define TXTBIT_SCROLLBARCHANGE  0x010000
#define TXTBIT_CHARFORMATCHANGE 0x020000
#define TXTBIT_PARAFORMATCHANGE 0x040000
#define TXTBIT_EXTENTCHANGE     0x080000
#define TXTBIT_CLIENTRECTCHANGE 0x100000
#define TXTBIT_USECURRENTBKG    0x200000

Mike McCormack's avatar
Mike McCormack committed
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
/*****************************************************************************
 * ITextHost interface
 */
#define INTERFACE ITextHost
DECLARE_INTERFACE_(ITextHost,IUnknown)
{
    /*** IUnknown methods ***/
    STDMETHOD(QueryInterface)(THIS_
        REFIID riid,
        void** ppvObject) PURE;

    STDMETHOD_(ULONG,AddRef)(THIS) PURE;

    STDMETHOD_(ULONG,Release)(THIS) PURE;

    /*** ITextHost methods ***/
219
    THISCALLMETHOD_(HDC,TxGetDC)( THIS
Mike McCormack's avatar
Mike McCormack committed
220 221
        ) PURE;

222
    THISCALLMETHOD_(INT,TxReleaseDC)( THIS_
Mike McCormack's avatar
Mike McCormack committed
223 224
        HDC hdc) PURE;

225
    THISCALLMETHOD_(BOOL,TxShowScrollBar)( THIS_
Mike McCormack's avatar
Mike McCormack committed
226 227 228
        INT fnBar,
        BOOL fShow) PURE;

229
    THISCALLMETHOD_(BOOL,TxEnableScrollBar)( THIS_
Mike McCormack's avatar
Mike McCormack committed
230 231 232
        INT fuSBFlags,
        INT fuArrowflags) PURE;

233
    THISCALLMETHOD_(BOOL,TxSetScrollRange)( THIS_
Mike McCormack's avatar
Mike McCormack committed
234 235 236 237 238
        INT fnBar,
        LONG nMinPos,
        INT nMaxPos,
        BOOL fRedraw) PURE;

239
    THISCALLMETHOD_(BOOL,TxSetScrollPos)( THIS_
Mike McCormack's avatar
Mike McCormack committed
240 241 242 243
        INT fnBar,
        INT nPos,
        BOOL fRedraw) PURE;

244
    THISCALLMETHOD_(void,TxInvalidateRect)( THIS_
Mike McCormack's avatar
Mike McCormack committed
245 246 247
        LPCRECT prc,
        BOOL fMode) PURE;

248
    THISCALLMETHOD_(void,TxViewChange)( THIS_
Mike McCormack's avatar
Mike McCormack committed
249 250
        BOOL fUpdate) PURE;

251
    THISCALLMETHOD_(BOOL,TxCreateCaret)( THIS_
Mike McCormack's avatar
Mike McCormack committed
252 253 254 255
        HBITMAP hbmp,
        INT xWidth,
        INT yHeight) PURE;

256
    THISCALLMETHOD_(BOOL,TxShowCaret)( THIS_
Mike McCormack's avatar
Mike McCormack committed
257 258
        BOOL fShow) PURE;

259
    THISCALLMETHOD_(BOOL,TxSetCaretPos)( THIS_
Mike McCormack's avatar
Mike McCormack committed
260 261 262
        INT x,
        INT y) PURE;

263
    THISCALLMETHOD_(BOOL,TxSetTimer)( THIS_
Mike McCormack's avatar
Mike McCormack committed
264 265 266
        UINT idTimer,
        UINT uTimeout) PURE;

267
    THISCALLMETHOD_(void,TxKillTimer)( THIS_
Mike McCormack's avatar
Mike McCormack committed
268 269
        UINT idTimer) PURE;

270
    THISCALLMETHOD_(void,TxScrollWindowEx)( THIS_
Mike McCormack's avatar
Mike McCormack committed
271 272 273 274 275 276 277 278
        INT dx,
        INT dy,
        LPCRECT lprcScroll,
        LPCRECT lprcClip,
        HRGN hRgnUpdate,
        LPRECT lprcUpdate,
        UINT fuScroll) PURE;

279
    THISCALLMETHOD_(void,TxSetCapture)( THIS_
Mike McCormack's avatar
Mike McCormack committed
280 281
        BOOL fCapture) PURE;

282
    THISCALLMETHOD_(void,TxSetFocus)( THIS
Mike McCormack's avatar
Mike McCormack committed
283 284
        ) PURE;

285
    THISCALLMETHOD_(void,TxSetCursor)( THIS_
Mike McCormack's avatar
Mike McCormack committed
286 287 288
        HCURSOR hcur,
        BOOL fText) PURE;

289
    THISCALLMETHOD_(BOOL,TxScreenToClient)( THIS_
Mike McCormack's avatar
Mike McCormack committed
290 291
        LPPOINT lppt) PURE;

292
    THISCALLMETHOD_(BOOL,TxClientToScreen)( THIS_
Mike McCormack's avatar
Mike McCormack committed
293 294
        LPPOINT lppt) PURE;

295
    THISCALLMETHOD_(HRESULT,TxActivate)( THIS_
Mike McCormack's avatar
Mike McCormack committed
296 297
        LONG* plOldState) PURE;

298
    THISCALLMETHOD_(HRESULT,TxDeactivate)( THIS_
Mike McCormack's avatar
Mike McCormack committed
299 300
        LONG lNewState) PURE;

301
    THISCALLMETHOD_(HRESULT,TxGetClientRect)( THIS_
Mike McCormack's avatar
Mike McCormack committed
302 303
        LPRECT prc) PURE;

304
    THISCALLMETHOD_(HRESULT,TxGetViewInset)( THIS_
Mike McCormack's avatar
Mike McCormack committed
305 306
        LPRECT prc) PURE;

307
    THISCALLMETHOD_(HRESULT,TxGetCharFormat)( THIS_
Mike McCormack's avatar
Mike McCormack committed
308 309
        const CHARFORMATW** ppCF) PURE;

310
    THISCALLMETHOD_(HRESULT,TxGetParaFormat)( THIS_
Mike McCormack's avatar
Mike McCormack committed
311 312
        const PARAFORMAT** ppPF) PURE;

313
    THISCALLMETHOD_(COLORREF,TxGetSysColor)( THIS_
Mike McCormack's avatar
Mike McCormack committed
314 315
        int nIndex) PURE;

316
    THISCALLMETHOD_(HRESULT,TxGetBackStyle)( THIS_
Mike McCormack's avatar
Mike McCormack committed
317 318
        TXTBACKSTYLE* pStyle) PURE;

319
    THISCALLMETHOD_(HRESULT,TxGetMaxLength)( THIS_
Mike McCormack's avatar
Mike McCormack committed
320 321
        DWORD* plength) PURE;

322
    THISCALLMETHOD_(HRESULT,TxGetScrollBars)( THIS_
Mike McCormack's avatar
Mike McCormack committed
323 324
        DWORD* pdwScrollBar) PURE;

325
    THISCALLMETHOD_(HRESULT,TxGetPasswordChar)( THIS_
Mike McCormack's avatar
Mike McCormack committed
326 327
        WCHAR* pch) PURE;

328
    THISCALLMETHOD_(HRESULT,TxGetAcceleratorPos)( THIS_
Mike McCormack's avatar
Mike McCormack committed
329 330
        LONG* pch) PURE;

331
    THISCALLMETHOD_(HRESULT,TxGetExtent)( THIS_
Mike McCormack's avatar
Mike McCormack committed
332 333
        LPSIZEL lpExtent) PURE;

334
    THISCALLMETHOD_(HRESULT,OnTxCharFormatChange)( THIS_
Mike McCormack's avatar
Mike McCormack committed
335 336
        const CHARFORMATW* pcf) PURE;

337
    THISCALLMETHOD_(HRESULT,OnTxParaFormatChange)( THIS_
Mike McCormack's avatar
Mike McCormack committed
338 339
        const PARAFORMAT* ppf) PURE;

340
    THISCALLMETHOD_(HRESULT,TxGetPropertyBits)( THIS_
Mike McCormack's avatar
Mike McCormack committed
341 342 343
        DWORD dwMask,
        DWORD* pdwBits) PURE;

344
    THISCALLMETHOD_(HRESULT,TxNotify)( THIS_
Mike McCormack's avatar
Mike McCormack committed
345 346 347
        DWORD iNotify,
        void* pv) PURE;

348
    THISCALLMETHOD_(HIMC,TxImmGetContext)( THIS
Mike McCormack's avatar
Mike McCormack committed
349 350
        ) PURE;

351
    THISCALLMETHOD_(void,TxImmReleaseContext)( THIS_
Mike McCormack's avatar
Mike McCormack committed
352 353
        HIMC himc) PURE;

354
    THISCALLMETHOD_(HRESULT,TxGetSelectionBarWidth)( THIS_
Mike McCormack's avatar
Mike McCormack committed
355 356 357
        LONG* lSelBarWidth) PURE;

};
358
#undef INTERFACE
Mike McCormack's avatar
Mike McCormack committed
359 360 361 362 363 364 365 366

#ifdef COBJMACROS
/*** IUnknown methods ***/
#define ITextHost_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define ITextHost_AddRef(p) (p)->lpVtbl->AddRef(p)
#define ITextHost_Release(p) (p)->lpVtbl->Release(p)
#endif

367 368 369 370
HRESULT WINAPI CreateTextServices(IUnknown*,ITextHost*,IUnknown**);

typedef HRESULT (WINAPI *PCreateTextServices)(IUnknown*,ITextHost*,IUnknown**);

Mike McCormack's avatar
Mike McCormack committed
371 372 373 374 375
#ifdef __cplusplus
}
#endif

#endif /* _TEXTSERV_H */