textserv.h 9.04 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
EXTERN_C const IID IID_ITextServices;
EXTERN_C const IID IID_ITextHost;
Mike McCormack's avatar
Mike McCormack committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102

/*****************************************************************************
 * 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 ***/

    STDMETHOD(TxSendMessage)( THIS_
        UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) PURE;

    STDMETHOD(TxDraw)( THIS_
        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;

    STDMETHOD(TxGetHScroll)( THIS_
        LONG* plMin,
        LONG* plMax,
        LONG* plPos,
        LONG* plPage,
        BOOL* pfEnabled) PURE;

    STDMETHOD(TxGetVScroll)( THIS_
        LONG* plMin,
        LONG* plMax,
        LONG* plPos,
        LONG* plPage,
        BOOL* pfEnabled) PURE;

    STDMETHOD(OnTxSetCursor)( THIS_
        DWORD dwDrawAspect,
        LONG lindex,
        void* pvAspect,
        DVTARGETDEVICE* ptd,
        HDC hdcDraw,
        HDC hicTargetDev,
        LPCRECT lprcClient,
        INT x,
        INT y) PURE;

    STDMETHOD(TxQueryHitPoint)( THIS_
        DWORD dwDrawAspect,
        LONG lindex,
        void* pvAspect,
        DVTARGETDEVICE* ptd,
        HDC hdcDraw,
        HDC hicTargetDev,
        LPCRECT lprcClient,
        INT x,
        INT y,
        DWORD* pHitResult) PURE;

    STDMETHOD(OnTxInplaceActivate)( THIS_
        LPCRECT prcClient) PURE;

103 104
    STDMETHOD(OnTxInplaceDeactivate)( THIS ) PURE;

Mike McCormack's avatar
Mike McCormack committed
105 106 107 108 109 110 111 112 113 114
    STDMETHOD(OnTxUIActivate)( THIS ) PURE;

    STDMETHOD(OnTxUIDeactivate)( THIS ) PURE;

    STDMETHOD(TxGetText)( THIS_
        BSTR* pbstrText) PURE;

    STDMETHOD(TxSetText)( THIS_
        LPCWSTR pszText) PURE;

115
    STDMETHOD(TxGetCurTargetX)( THIS_
Mike McCormack's avatar
Mike McCormack committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
        LONG* x) PURE;

    STDMETHOD(TxGetBaseLinePos)( THIS_
        LONG* x) PURE;

    STDMETHOD(TxGetNaturalSize)( THIS_
        DWORD dwAspect,
        HDC hdcDraw,
        HDC hicTargetDev,
        DVTARGETDEVICE* ptd,
        DWORD dwMode,
        const SIZEL* psizelExtent,
        LONG* pwidth,
        LONG* pheight) PURE;

    STDMETHOD(TxGetDropTarget)( THIS_
        IDropTarget** ppDropTarget) PURE;

    STDMETHOD(OnTxPropertyBitsChange)( THIS_
        DWORD dwMask,
        DWORD dwBits) PURE;

    STDMETHOD(TxGetCachedSize)( THIS_
        DWORD* pdwWidth,
        DWORD* pdwHeight) PURE;

};
143
#undef INTERFACE
Mike McCormack's avatar
Mike McCormack committed
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173

#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
};

174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
#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
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
/*****************************************************************************
 * 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 ***/
    STDMETHOD_(HDC,TxGetDC)( THIS
        ) PURE;

    STDMETHOD_(INT,TxReleaseDC)( THIS_
        HDC hdc) PURE;

    STDMETHOD_(BOOL,TxShowScrollBar)( THIS_
        INT fnBar,
        BOOL fShow) PURE;

    STDMETHOD_(BOOL,TxEnableScrollBar)( THIS_
        INT fuSBFlags,
        INT fuArrowflags) PURE;

    STDMETHOD_(BOOL,TxSetScrollRange)( THIS_
        INT fnBar,
        LONG nMinPos,
        INT nMaxPos,
        BOOL fRedraw) PURE;

    STDMETHOD_(BOOL,TxSetScrollPos)( THIS_
        INT fnBar,
        INT nPos,
        BOOL fRedraw) PURE;

    STDMETHOD_(void,TxInvalidateRect)( THIS_
        LPCRECT prc,
        BOOL fMode) PURE;

    STDMETHOD_(void,TxViewChange)( THIS_
        BOOL fUpdate) PURE;

    STDMETHOD_(BOOL,TxCreateCaret)( THIS_
        HBITMAP hbmp,
        INT xWidth,
        INT yHeight) PURE;

    STDMETHOD_(BOOL,TxShowCaret)( THIS_
        BOOL fShow) PURE;

253
    STDMETHOD_(BOOL,TxSetCaretPos)( THIS_
Mike McCormack's avatar
Mike McCormack committed
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
        INT x,
        INT y) PURE;

    STDMETHOD_(BOOL,TxSetTimer)( THIS_
        UINT idTimer,
        UINT uTimeout) PURE;

    STDMETHOD_(void,TxKillTimer)( THIS_
        UINT idTimer) PURE;

    STDMETHOD_(void,TxScrollWindowEx)( THIS_
        INT dx,
        INT dy,
        LPCRECT lprcScroll,
        LPCRECT lprcClip,
        HRGN hRgnUpdate,
        LPRECT lprcUpdate,
        UINT fuScroll) PURE;

    STDMETHOD_(void,TxSetCapture)( THIS_
        BOOL fCapture) PURE;

    STDMETHOD_(void,TxSetFocus)( THIS
        ) PURE;

    STDMETHOD_(void,TxSetCursor)( THIS_
        HCURSOR hcur,
        BOOL fText) PURE;

    STDMETHOD_(BOOL,TxScreenToClient)( THIS_
        LPPOINT lppt) PURE;

    STDMETHOD_(BOOL,TxClientToScreen)( THIS_
        LPPOINT lppt) PURE;

    STDMETHOD(TxActivate)( THIS_
        LONG* plOldState) PURE;

    STDMETHOD(TxDeactivate)( THIS_
        LONG lNewState) PURE;

    STDMETHOD(TxGetClientRect)( THIS_
        LPRECT prc) PURE;

    STDMETHOD(TxGetViewInset)( THIS_
        LPRECT prc) PURE;

    STDMETHOD(TxGetCharFormat)( THIS_
        const CHARFORMATW** ppCF) PURE;

    STDMETHOD(TxGetParaFormat)( THIS_
        const PARAFORMAT** ppPF) PURE;

    STDMETHOD_(COLORREF,TxGetSysColor)( THIS_
        int nIndex) PURE;

    STDMETHOD(TxGetBackStyle)( THIS_
        TXTBACKSTYLE* pStyle) PURE;

    STDMETHOD(TxGetMaxLength)( THIS_
        DWORD* plength) PURE;

316
    STDMETHOD(TxGetScrollBars)( THIS_
Mike McCormack's avatar
Mike McCormack committed
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
        DWORD* pdwScrollBar) PURE;

    STDMETHOD(TxGetPasswordChar)( THIS_
        WCHAR* pch) PURE;

    STDMETHOD(TxGetAcceleratorPos)( THIS_
        LONG* pch) PURE;

    STDMETHOD(TxGetExtent)( THIS_
        LPSIZEL lpExtent) PURE;

    STDMETHOD(OnTxCharFormatChange)( THIS_
        const CHARFORMATW* pcf) PURE;

    STDMETHOD(OnTxParaFormatChange)( THIS_
        const PARAFORMAT* ppf) PURE;

    STDMETHOD(TxGetPropertyBits)( THIS_
        DWORD dwMask,
        DWORD* pdwBits) PURE;

    STDMETHOD(TxNotify)( THIS_
        DWORD iNotify,
        void* pv) PURE;

    STDMETHOD_(HIMC,TxImmGetContext)( THIS
        ) PURE;

    STDMETHOD_(void,TxImmReleaseContext)( THIS_
        HIMC himc) PURE;

    STDMETHOD(TxGetSelectionBarWidth)( THIS_
        LONG* lSelBarWidth) PURE;

};
352
#undef INTERFACE
Mike McCormack's avatar
Mike McCormack committed
353 354 355 356 357 358 359 360

#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

361 362 363 364
HRESULT WINAPI CreateTextServices(IUnknown*,ITextHost*,IUnknown**);

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

Mike McCormack's avatar
Mike McCormack committed
365 366 367 368 369
#ifdef __cplusplus
}
#endif

#endif /* _TEXTSERV_H */