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