wer: Add new stubbed wer.dll.
[wine/hramrach.git] / dlls / riched20 / txthost.c
blob68f44372659463bdcd0c7d757a2114e0f7cbf40a
1 /*
2 * RichEdit - ITextHost implementation for windowed richedit controls
4 * Copyright 2009 by Dylan Smith
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #define NONAMELESSSTRUCT
25 #define NONAMELESSUNION
26 #define COBJMACROS
28 #include "editor.h"
29 #include "ole2.h"
30 #include "richole.h"
31 #include "imm.h"
32 #include "textserv.h"
33 #include "wine/debug.h"
34 #include "editstr.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
38 typedef struct ITextHostImpl {
39 const ITextHostVtbl *lpVtbl;
40 LONG ref;
41 HWND hWnd;
42 BOOL bEmulateVersion10;
43 } ITextHostImpl;
45 static const ITextHostVtbl textHostVtbl;
47 ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10)
49 ITextHostImpl *texthost;
50 texthost = CoTaskMemAlloc(sizeof(*texthost));
51 if (texthost)
53 ME_TextEditor *editor;
55 texthost->lpVtbl = &textHostVtbl;
56 texthost->ref = 1;
57 texthost->hWnd = hwnd;
58 texthost->bEmulateVersion10 = bEmulateVersion10;
60 editor = ME_MakeEditor((ITextHost*)texthost, bEmulateVersion10);
61 editor->exStyleFlags = GetWindowLongW(hwnd, GWL_EXSTYLE);
62 editor->styleFlags |= GetWindowLongW(hwnd, GWL_STYLE) & ES_WANTRETURN;
63 editor->hWnd = hwnd; /* FIXME: Remove editor's dependence on hWnd */
64 editor->hwndParent = cs->hwndParent;
65 SetWindowLongPtrW(hwnd, 0, (LONG_PTR)editor);
68 return (ITextHost*)texthost;
71 static HRESULT WINAPI ITextHostImpl_QueryInterface(ITextHost *iface,
72 REFIID riid,
73 LPVOID *ppvObject)
75 ITextHostImpl *This = (ITextHostImpl *)iface;
77 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextHost)) {
78 *ppvObject = This;
79 ITextHost_AddRef((ITextHost *)*ppvObject);
80 return S_OK;
83 FIXME("Unknown interface: %s\n", debugstr_guid(riid));
84 return E_NOINTERFACE;
87 static ULONG WINAPI ITextHostImpl_AddRef(ITextHost *iface)
89 ITextHostImpl *This = (ITextHostImpl *)iface;
90 ULONG ref = InterlockedIncrement(&This->ref);
91 return ref;
94 static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
96 ITextHostImpl *This = (ITextHostImpl *)iface;
97 ULONG ref = InterlockedDecrement(&This->ref);
99 if (!ref)
101 SetWindowLongPtrW(This->hWnd, 0, 0);
102 CoTaskMemFree(This);
104 return ref;
107 HDC WINAPI ITextHostImpl_TxGetDC(ITextHost *iface)
109 ITextHostImpl *This = (ITextHostImpl *)iface;
110 return GetDC(This->hWnd);
113 INT WINAPI ITextHostImpl_TxReleaseDC(ITextHost *iface,
114 HDC hdc)
116 ITextHostImpl *This = (ITextHostImpl *)iface;
117 return ReleaseDC(This->hWnd, hdc);
120 BOOL WINAPI ITextHostImpl_TxShowScrollBar(ITextHost *iface,
121 INT fnBar,
122 BOOL fShow)
124 ITextHostImpl *This = (ITextHostImpl *)iface;
125 return ShowScrollBar(This->hWnd, fnBar, fShow);
128 BOOL WINAPI ITextHostImpl_TxEnableScrollBar(ITextHost *iface,
129 INT fuSBFlags,
130 INT fuArrowflags)
132 ITextHostImpl *This = (ITextHostImpl *)iface;
133 return EnableScrollBar(This->hWnd, fuSBFlags, fuArrowflags);
136 BOOL WINAPI ITextHostImpl_TxSetScrollRange(ITextHost *iface,
137 INT fnBar,
138 LONG nMinPos,
139 INT nMaxPos,
140 BOOL fRedraw)
142 ITextHostImpl *This = (ITextHostImpl *)iface;
143 return SetScrollRange(This->hWnd, fnBar, nMinPos, nMaxPos, fRedraw);
146 BOOL WINAPI ITextHostImpl_TxSetScrollPos(ITextHost *iface,
147 INT fnBar,
148 INT nPos,
149 BOOL fRedraw)
151 ITextHostImpl *This = (ITextHostImpl *)iface;
152 int pos = SetScrollPos(This->hWnd, fnBar, nPos, fRedraw);
153 return (pos ? TRUE : FALSE);
156 void WINAPI ITextHostImpl_TxInvalidateRect(ITextHost *iface,
157 LPCRECT prc,
158 BOOL fMode)
160 ITextHostImpl *This = (ITextHostImpl *)iface;
161 InvalidateRect(This->hWnd, prc, fMode);
164 void WINAPI ITextHostImpl_TxViewChange(ITextHost *iface,
165 BOOL fUpdate)
167 ITextHostImpl *This = (ITextHostImpl *)iface;
168 if (fUpdate)
169 UpdateWindow(This->hWnd);
172 BOOL WINAPI ITextHostImpl_TxCreateCaret(ITextHost *iface,
173 HBITMAP hbmp,
174 INT xWidth, INT yHeight)
176 ITextHostImpl *This = (ITextHostImpl *)iface;
177 return CreateCaret(This->hWnd, hbmp, xWidth, yHeight);
180 BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow)
182 ITextHostImpl *This = (ITextHostImpl *)iface;
183 if (fShow)
184 return ShowCaret(This->hWnd);
185 else
186 return HideCaret(This->hWnd);
189 BOOL WINAPI ITextHostImpl_TxSetCaretPos(ITextHost *iface,
190 INT x, INT y)
192 return SetCaretPos(x, y);
195 BOOL WINAPI ITextHostImpl_TxSetTimer(ITextHost *iface,
196 UINT idTimer, UINT uTimeout)
198 ITextHostImpl *This = (ITextHostImpl *)iface;
199 return SetTimer(This->hWnd, idTimer, uTimeout, NULL) != 0;
202 void WINAPI ITextHostImpl_TxKillTimer(ITextHost *iface,
203 UINT idTimer)
205 ITextHostImpl *This = (ITextHostImpl *)iface;
206 KillTimer(This->hWnd, idTimer);
209 void WINAPI ITextHostImpl_TxScrollWindowEx(ITextHost *iface,
210 INT dx, INT dy,
211 LPCRECT lprcScroll,
212 LPCRECT lprcClip,
213 HRGN hRgnUpdate,
214 LPRECT lprcUpdate,
215 UINT fuScroll)
217 ITextHostImpl *This = (ITextHostImpl *)iface;
218 ScrollWindowEx(This->hWnd, dx, dy, lprcScroll, lprcClip,
219 hRgnUpdate, lprcUpdate, fuScroll);
222 void WINAPI ITextHostImpl_TxSetCapture(ITextHost *iface,
223 BOOL fCapture)
225 ITextHostImpl *This = (ITextHostImpl *)iface;
226 if (fCapture)
227 SetCapture(This->hWnd);
228 else
229 ReleaseCapture();
232 void WINAPI ITextHostImpl_TxSetFocus(ITextHost *iface)
234 ITextHostImpl *This = (ITextHostImpl *)iface;
235 SetFocus(This->hWnd);
238 void WINAPI ITextHostImpl_TxSetCursor(ITextHost *iface,
239 HCURSOR hcur,
240 BOOL fText)
242 SetCursor(hcur);
245 BOOL WINAPI ITextHostImpl_TxScreenToClient(ITextHost *iface,
246 LPPOINT lppt)
248 ITextHostImpl *This = (ITextHostImpl *)iface;
249 return ScreenToClient(This->hWnd, lppt);
252 BOOL WINAPI ITextHostImpl_TxClientToScreen(ITextHost *iface,
253 LPPOINT lppt)
255 ITextHostImpl *This = (ITextHostImpl *)iface;
256 return ClientToScreen(This->hWnd, lppt);
259 HRESULT WINAPI ITextHostImpl_TxActivate(ITextHost *iface,
260 LONG *plOldState)
262 ITextHostImpl *This = (ITextHostImpl *)iface;
263 *plOldState = HandleToLong(SetActiveWindow(This->hWnd));
264 return (*plOldState ? S_OK : E_FAIL);
267 HRESULT WINAPI ITextHostImpl_TxDeactivate(ITextHost *iface,
268 LONG lNewState)
270 HWND ret = SetActiveWindow(LongToHandle(lNewState));
271 return (ret ? S_OK : E_FAIL);
274 HRESULT WINAPI ITextHostImpl_TxGetClientRect(ITextHost *iface,
275 LPRECT prc)
277 ITextHostImpl *This = (ITextHostImpl *)iface;
278 int ret = GetClientRect(This->hWnd, prc);
279 return (ret ? S_OK : E_FAIL);
282 HRESULT WINAPI ITextHostImpl_TxGetViewInset(ITextHost *iface,
283 LPRECT prc)
285 prc->top = 0;
286 prc->left = 0;
287 prc->bottom = 0;
288 prc->right = 0;
289 return S_OK;
292 HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface,
293 const CHARFORMATW **ppCF)
295 return E_NOTIMPL;
298 HRESULT WINAPI ITextHostImpl_TxGetParaFormat(ITextHost *iface,
299 const PARAFORMAT **ppPF)
301 return E_NOTIMPL;
304 COLORREF WINAPI ITextHostImpl_TxGetSysColor(ITextHost *iface,
305 int nIndex)
307 return GetSysColor(nIndex);
310 HRESULT WINAPI ITextHostImpl_TxGetBackStyle(ITextHost *iface,
311 TXTBACKSTYLE *pStyle)
313 *pStyle = TXTBACK_OPAQUE;
314 return S_OK;
317 HRESULT WINAPI ITextHostImpl_TxGetMaxLength(ITextHost *iface,
318 DWORD *pLength)
320 *pLength = INFINITE;
321 return S_OK;
324 HRESULT WINAPI ITextHostImpl_TxGetScrollBars(ITextHost *iface,
325 DWORD *pdwScrollBar)
327 ITextHostImpl *This = (ITextHostImpl *)iface;
328 ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0);
329 const DWORD mask = WS_VSCROLL|
330 WS_HSCROLL|
331 ES_AUTOVSCROLL|
332 ES_AUTOHSCROLL|
333 ES_DISABLENOSCROLL;
334 if (editor)
336 *pdwScrollBar = editor->styleFlags & mask;
337 } else {
338 DWORD style = GetWindowLongW(This->hWnd, GWL_STYLE);
339 if (style & WS_VSCROLL)
340 style |= ES_AUTOVSCROLL;
341 if (!This->bEmulateVersion10 && (style & WS_HSCROLL))
342 style |= ES_AUTOHSCROLL;
343 *pdwScrollBar = style & mask;
345 return S_OK;
348 HRESULT WINAPI ITextHostImpl_TxGetPasswordChar(ITextHost *iface,
349 WCHAR *pch)
351 *pch = '*';
352 return S_OK;
355 HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface,
356 LONG *pch)
358 *pch = -1;
359 return S_OK;
362 HRESULT WINAPI ITextHostImpl_TxGetExtent(ITextHost *iface,
363 LPSIZEL lpExtent)
365 return E_NOTIMPL;
368 HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange(ITextHost *iface,
369 const CHARFORMATW *pcf)
371 return S_OK;
374 HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange(ITextHost *iface,
375 const PARAFORMAT *ppf)
377 return S_OK;
380 HRESULT WINAPI ITextHostImpl_TxGetPropertyBits(ITextHost *iface,
381 DWORD dwMask,
382 DWORD *pdwBits)
384 ITextHostImpl *This = (ITextHostImpl *)iface;
385 ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(This->hWnd, 0);
386 DWORD style;
387 DWORD dwBits = 0;
389 if (editor)
391 style = editor->styleFlags;
392 if (editor->mode & TM_RICHTEXT)
393 dwBits |= TXTBIT_RICHTEXT;
394 if (editor->bWordWrap)
395 dwBits |= TXTBIT_WORDWRAP;
396 if (style & ECO_AUTOWORDSELECTION)
397 dwBits |= TXTBIT_AUTOWORDSEL;
398 } else {
399 DWORD dwScrollBar;
401 style = GetWindowLongW(This->hWnd, GWL_STYLE);
402 ITextHostImpl_TxGetScrollBars(iface, &dwScrollBar);
404 dwBits |= TXTBIT_RICHTEXT|TXTBIT_AUTOWORDSEL;
405 if (!(dwScrollBar & ES_AUTOHSCROLL))
406 dwBits |= TXTBIT_WORDWRAP;
409 /* Bits that correspond to window styles. */
410 if (style & ES_MULTILINE)
411 dwBits |= TXTBIT_MULTILINE;
412 if (style & ES_READONLY)
413 dwBits |= TXTBIT_READONLY;
414 if (style & ES_PASSWORD)
415 dwBits |= TXTBIT_USEPASSWORD;
416 if (!(style & ES_NOHIDESEL))
417 dwBits |= TXTBIT_HIDESELECTION;
418 if (style & ES_SAVESEL)
419 dwBits |= TXTBIT_SAVESELECTION;
420 if (style & ES_VERTICAL)
421 dwBits |= TXTBIT_VERTICAL;
422 if (style & ES_NOOLEDRAGDROP)
423 dwBits |= TXTBIT_DISABLEDRAG;
425 dwBits |= TXTBIT_ALLOWBEEP;
427 /* The following bits are always FALSE because they are probably only
428 * needed for ITextServices_OnTxPropertyBitsChange:
429 * TXTBIT_VIEWINSETCHANGE
430 * TXTBIT_BACKSTYLECHANGE
431 * TXTBIT_MAXLENGTHCHANGE
432 * TXTBIT_CHARFORMATCHANGE
433 * TXTBIT_PARAFORMATCHANGE
434 * TXTBIT_SHOWACCELERATOR
435 * TXTBIT_EXTENTCHANGE
436 * TXTBIT_SELBARCHANGE
437 * TXTBIT_SCROLLBARCHANGE
438 * TXTBIT_CLIENTRECTCHANGE
440 * Documented by MSDN as not supported:
441 * TXTBIT_USECURRENTBKG
444 *pdwBits = dwBits & dwMask;
445 return S_OK;
448 HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface,
449 DWORD iNotify,
450 void *pv)
452 ITextHostImpl *This = (ITextHostImpl *)iface;
453 ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0);
454 HWND hwnd = This->hWnd;
455 UINT id;
457 if (!editor || !editor->hwndParent) return S_OK;
459 id = GetWindowLongW(hwnd, GWLP_ID);
461 switch (iNotify)
463 case EN_DROPFILES:
464 case EN_LINK:
465 case EN_OLEOPFAILED:
466 case EN_PROTECTED:
467 case EN_REQUESTRESIZE:
468 case EN_SAVECLIPBOARD:
469 case EN_SELCHANGE:
470 case EN_STOPNOUNDO:
472 /* FIXME: Verify this assumption that pv starts with NMHDR. */
473 NMHDR *info = pv;
474 if (!info)
475 return E_FAIL;
477 info->hwndFrom = hwnd;
478 info->idFrom = id;
479 info->code = iNotify;
480 SendMessageW(editor->hwndParent, WM_NOTIFY, id, (LPARAM)info);
481 break;
484 case EN_UPDATE:
485 /* Only sent when the window is visible. */
486 if (!IsWindowVisible(hwnd))
487 break;
488 /* Fall through */
489 case EN_CHANGE:
490 case EN_ERRSPACE:
491 case EN_HSCROLL:
492 case EN_KILLFOCUS:
493 case EN_MAXTEXT:
494 case EN_SETFOCUS:
495 case EN_VSCROLL:
496 SendMessageW(editor->hwndParent, WM_COMMAND, MAKEWPARAM(id, iNotify), (LPARAM)hwnd);
497 break;
499 case EN_MSGFILTER:
500 FIXME("EN_MSGFILTER is documented as not being sent to TxNotify\n");
501 /* fall through */
502 default:
503 return E_FAIL;
505 return S_OK;
508 HIMC WINAPI ITextHostImpl_TxImmGetContext(ITextHost *iface)
510 ITextHostImpl *This = (ITextHostImpl *)iface;
511 return ImmGetContext(This->hWnd);
514 void WINAPI ITextHostImpl_TxImmReleaseContext(ITextHost *iface,
515 HIMC himc)
517 ITextHostImpl *This = (ITextHostImpl *)iface;
518 ImmReleaseContext(This->hWnd, himc);
521 HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface,
522 LONG *lSelBarWidth)
524 ITextHostImpl *This = (ITextHostImpl *)iface;
525 ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(This->hWnd, 0);
527 DWORD style = editor ? editor->styleFlags
528 : GetWindowLongW(This->hWnd, GWL_STYLE);
529 *lSelBarWidth = (style & ES_SELECTIONBAR) ? 225 : 0; /* in HIMETRIC */
530 return S_OK;
534 #ifdef __i386__ /* thiscall functions are i386-specific */
536 #define THISCALL(func) __thiscall_ ## func
537 #define DEFINE_THISCALL_WRAPPER(func,args) \
538 extern typeof(func) THISCALL(func); \
539 __ASM_STDCALL_FUNC(__thiscall_ ## func, args, \
540 "popl %eax\n\t" \
541 "pushl %ecx\n\t" \
542 "pushl %eax\n\t" \
543 "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
545 #else /* __i386__ */
547 #define THISCALL(func) func
548 #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
550 #endif /* __i386__ */
552 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetDC,4)
553 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxReleaseDC,8)
554 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowScrollBar,12)
555 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxEnableScrollBar,12)
556 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollRange,20)
557 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollPos,16)
558 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxInvalidateRect,12)
559 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxViewChange,8)
560 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxCreateCaret,16)
561 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowCaret,8)
562 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCaretPos,12)
563 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetTimer,12)
564 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxKillTimer,8)
565 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScrollWindowEx,32)
566 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCapture,8)
567 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetFocus,4)
568 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCursor,12)
569 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScreenToClient,8)
570 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxClientToScreen,8)
571 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxActivate,8)
572 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxDeactivate,8)
573 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetClientRect,8)
574 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetViewInset,8)
575 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetCharFormat,8)
576 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetParaFormat,8)
577 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSysColor,8)
578 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetBackStyle,8)
579 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetMaxLength,8)
580 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetScrollBars,8)
581 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPasswordChar,8)
582 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetAcceleratorPos,8)
583 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetExtent,8)
584 DEFINE_THISCALL_WRAPPER(ITextHostImpl_OnTxCharFormatChange,8)
585 DEFINE_THISCALL_WRAPPER(ITextHostImpl_OnTxParaFormatChange,8)
586 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPropertyBits,12)
587 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxNotify,12)
588 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmGetContext,4)
589 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmReleaseContext,8)
590 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
592 #ifdef __i386__ /* thiscall functions are i386-specific */
594 #define STDCALL(func) __stdcall_ ## func
595 #define DEFINE_STDCALL_WRAPPER(num,func,args) \
596 extern typeof(func) __stdcall_ ## func; \
597 __ASM_STDCALL_FUNC(__stdcall_ ## func, args, \
598 "popl %eax\n\t" \
599 "popl %ecx\n\t" \
600 "pushl %eax\n\t" \
601 "movl (%ecx), %eax\n\t" \
602 "jmp *(4*(" #num "))(%eax)" )
604 DEFINE_STDCALL_WRAPPER(3,ITextHostImpl_TxGetDC,4)
605 DEFINE_STDCALL_WRAPPER(4,ITextHostImpl_TxReleaseDC,8)
606 DEFINE_STDCALL_WRAPPER(5,ITextHostImpl_TxShowScrollBar,12)
607 DEFINE_STDCALL_WRAPPER(6,ITextHostImpl_TxEnableScrollBar,12)
608 DEFINE_STDCALL_WRAPPER(7,ITextHostImpl_TxSetScrollRange,20)
609 DEFINE_STDCALL_WRAPPER(8,ITextHostImpl_TxSetScrollPos,16)
610 DEFINE_STDCALL_WRAPPER(9,ITextHostImpl_TxInvalidateRect,12)
611 DEFINE_STDCALL_WRAPPER(10,ITextHostImpl_TxViewChange,8)
612 DEFINE_STDCALL_WRAPPER(11,ITextHostImpl_TxCreateCaret,16)
613 DEFINE_STDCALL_WRAPPER(12,ITextHostImpl_TxShowCaret,8)
614 DEFINE_STDCALL_WRAPPER(13,ITextHostImpl_TxSetCaretPos,12)
615 DEFINE_STDCALL_WRAPPER(14,ITextHostImpl_TxSetTimer,12)
616 DEFINE_STDCALL_WRAPPER(15,ITextHostImpl_TxKillTimer,8)
617 DEFINE_STDCALL_WRAPPER(16,ITextHostImpl_TxScrollWindowEx,32)
618 DEFINE_STDCALL_WRAPPER(17,ITextHostImpl_TxSetCapture,8)
619 DEFINE_STDCALL_WRAPPER(18,ITextHostImpl_TxSetFocus,4)
620 DEFINE_STDCALL_WRAPPER(19,ITextHostImpl_TxSetCursor,12)
621 DEFINE_STDCALL_WRAPPER(20,ITextHostImpl_TxScreenToClient,8)
622 DEFINE_STDCALL_WRAPPER(21,ITextHostImpl_TxClientToScreen,8)
623 DEFINE_STDCALL_WRAPPER(22,ITextHostImpl_TxActivate,8)
624 DEFINE_STDCALL_WRAPPER(23,ITextHostImpl_TxDeactivate,8)
625 DEFINE_STDCALL_WRAPPER(24,ITextHostImpl_TxGetClientRect,8)
626 DEFINE_STDCALL_WRAPPER(25,ITextHostImpl_TxGetViewInset,8)
627 DEFINE_STDCALL_WRAPPER(26,ITextHostImpl_TxGetCharFormat,8)
628 DEFINE_STDCALL_WRAPPER(27,ITextHostImpl_TxGetParaFormat,8)
629 DEFINE_STDCALL_WRAPPER(28,ITextHostImpl_TxGetSysColor,8)
630 DEFINE_STDCALL_WRAPPER(29,ITextHostImpl_TxGetBackStyle,8)
631 DEFINE_STDCALL_WRAPPER(30,ITextHostImpl_TxGetMaxLength,8)
632 DEFINE_STDCALL_WRAPPER(31,ITextHostImpl_TxGetScrollBars,8)
633 DEFINE_STDCALL_WRAPPER(32,ITextHostImpl_TxGetPasswordChar,8)
634 DEFINE_STDCALL_WRAPPER(33,ITextHostImpl_TxGetAcceleratorPos,8)
635 DEFINE_STDCALL_WRAPPER(34,ITextHostImpl_TxGetExtent,8)
636 DEFINE_STDCALL_WRAPPER(35,ITextHostImpl_OnTxCharFormatChange,8)
637 DEFINE_STDCALL_WRAPPER(36,ITextHostImpl_OnTxParaFormatChange,8)
638 DEFINE_STDCALL_WRAPPER(37,ITextHostImpl_TxGetPropertyBits,12)
639 DEFINE_STDCALL_WRAPPER(38,ITextHostImpl_TxNotify,12)
640 DEFINE_STDCALL_WRAPPER(39,ITextHostImpl_TxImmGetContext,4)
641 DEFINE_STDCALL_WRAPPER(40,ITextHostImpl_TxImmReleaseContext,8)
642 DEFINE_STDCALL_WRAPPER(41,ITextHostImpl_TxGetSelectionBarWidth,8)
644 const ITextHostVtbl itextHostStdcallVtbl = {
645 NULL,
646 NULL,
647 NULL,
648 __stdcall_ITextHostImpl_TxGetDC,
649 __stdcall_ITextHostImpl_TxReleaseDC,
650 __stdcall_ITextHostImpl_TxShowScrollBar,
651 __stdcall_ITextHostImpl_TxEnableScrollBar,
652 __stdcall_ITextHostImpl_TxSetScrollRange,
653 __stdcall_ITextHostImpl_TxSetScrollPos,
654 __stdcall_ITextHostImpl_TxInvalidateRect,
655 __stdcall_ITextHostImpl_TxViewChange,
656 __stdcall_ITextHostImpl_TxCreateCaret,
657 __stdcall_ITextHostImpl_TxShowCaret,
658 __stdcall_ITextHostImpl_TxSetCaretPos,
659 __stdcall_ITextHostImpl_TxSetTimer,
660 __stdcall_ITextHostImpl_TxKillTimer,
661 __stdcall_ITextHostImpl_TxScrollWindowEx,
662 __stdcall_ITextHostImpl_TxSetCapture,
663 __stdcall_ITextHostImpl_TxSetFocus,
664 __stdcall_ITextHostImpl_TxSetCursor,
665 __stdcall_ITextHostImpl_TxScreenToClient,
666 __stdcall_ITextHostImpl_TxClientToScreen,
667 __stdcall_ITextHostImpl_TxActivate,
668 __stdcall_ITextHostImpl_TxDeactivate,
669 __stdcall_ITextHostImpl_TxGetClientRect,
670 __stdcall_ITextHostImpl_TxGetViewInset,
671 __stdcall_ITextHostImpl_TxGetCharFormat,
672 __stdcall_ITextHostImpl_TxGetParaFormat,
673 __stdcall_ITextHostImpl_TxGetSysColor,
674 __stdcall_ITextHostImpl_TxGetBackStyle,
675 __stdcall_ITextHostImpl_TxGetMaxLength,
676 __stdcall_ITextHostImpl_TxGetScrollBars,
677 __stdcall_ITextHostImpl_TxGetPasswordChar,
678 __stdcall_ITextHostImpl_TxGetAcceleratorPos,
679 __stdcall_ITextHostImpl_TxGetExtent,
680 __stdcall_ITextHostImpl_OnTxCharFormatChange,
681 __stdcall_ITextHostImpl_OnTxParaFormatChange,
682 __stdcall_ITextHostImpl_TxGetPropertyBits,
683 __stdcall_ITextHostImpl_TxNotify,
684 __stdcall_ITextHostImpl_TxImmGetContext,
685 __stdcall_ITextHostImpl_TxImmReleaseContext,
686 __stdcall_ITextHostImpl_TxGetSelectionBarWidth,
689 #endif /* __i386__ */
691 static const ITextHostVtbl textHostVtbl = {
692 ITextHostImpl_QueryInterface,
693 ITextHostImpl_AddRef,
694 ITextHostImpl_Release,
695 THISCALL(ITextHostImpl_TxGetDC),
696 THISCALL(ITextHostImpl_TxReleaseDC),
697 THISCALL(ITextHostImpl_TxShowScrollBar),
698 THISCALL(ITextHostImpl_TxEnableScrollBar),
699 THISCALL(ITextHostImpl_TxSetScrollRange),
700 THISCALL(ITextHostImpl_TxSetScrollPos),
701 THISCALL(ITextHostImpl_TxInvalidateRect),
702 THISCALL(ITextHostImpl_TxViewChange),
703 THISCALL(ITextHostImpl_TxCreateCaret),
704 THISCALL(ITextHostImpl_TxShowCaret),
705 THISCALL(ITextHostImpl_TxSetCaretPos),
706 THISCALL(ITextHostImpl_TxSetTimer),
707 THISCALL(ITextHostImpl_TxKillTimer),
708 THISCALL(ITextHostImpl_TxScrollWindowEx),
709 THISCALL(ITextHostImpl_TxSetCapture),
710 THISCALL(ITextHostImpl_TxSetFocus),
711 THISCALL(ITextHostImpl_TxSetCursor),
712 THISCALL(ITextHostImpl_TxScreenToClient),
713 THISCALL(ITextHostImpl_TxClientToScreen),
714 THISCALL(ITextHostImpl_TxActivate),
715 THISCALL(ITextHostImpl_TxDeactivate),
716 THISCALL(ITextHostImpl_TxGetClientRect),
717 THISCALL(ITextHostImpl_TxGetViewInset),
718 THISCALL(ITextHostImpl_TxGetCharFormat),
719 THISCALL(ITextHostImpl_TxGetParaFormat),
720 THISCALL(ITextHostImpl_TxGetSysColor),
721 THISCALL(ITextHostImpl_TxGetBackStyle),
722 THISCALL(ITextHostImpl_TxGetMaxLength),
723 THISCALL(ITextHostImpl_TxGetScrollBars),
724 THISCALL(ITextHostImpl_TxGetPasswordChar),
725 THISCALL(ITextHostImpl_TxGetAcceleratorPos),
726 THISCALL(ITextHostImpl_TxGetExtent),
727 THISCALL(ITextHostImpl_OnTxCharFormatChange),
728 THISCALL(ITextHostImpl_OnTxParaFormatChange),
729 THISCALL(ITextHostImpl_TxGetPropertyBits),
730 THISCALL(ITextHostImpl_TxNotify),
731 THISCALL(ITextHostImpl_TxImmGetContext),
732 THISCALL(ITextHostImpl_TxImmReleaseContext),
733 THISCALL(ITextHostImpl_TxGetSelectionBarWidth),