ReactOS  0.4.14-dev-376-gaedba84
txthost.c File Reference
#include "config.h"
#include "wine/port.h"
#include "editor.h"
#include "ole2.h"
#include "richole.h"
#include "imm.h"
#include "textserv.h"
#include "wine/debug.h"
#include "editstr.h"
Include dependency graph for txthost.c:

Go to the source code of this file.

Classes

struct  ITextHostImpl
 

Macros

#define COBJMACROS
 
#define THISCALL(func)   func
 
#define DEFINE_THISCALL_WRAPPER(func, args)   /* nothing */
 

Typedefs

typedef struct ITextHostImpl ITextHostImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (richedit)
 
ITextHost * ME_CreateTextHost (HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10)
 
static ITextHostImplimpl_from_ITextHost (ITextHost *iface)
 
static HRESULT WINAPI ITextHostImpl_QueryInterface (ITextHost *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI ITextHostImpl_AddRef (ITextHost *iface)
 
static ULONG WINAPI ITextHostImpl_Release (ITextHost *iface)
 
DECLSPEC_HIDDEN HDC WINAPI ITextHostImpl_TxGetDC (ITextHost *iface)
 
DECLSPEC_HIDDEN INT WINAPI ITextHostImpl_TxReleaseDC (ITextHost *iface, HDC hdc)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxShowScrollBar (ITextHost *iface, INT fnBar, BOOL fShow)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxEnableScrollBar (ITextHost *iface, INT fuSBFlags, INT fuArrowflags)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetScrollRange (ITextHost *iface, INT fnBar, LONG nMinPos, INT nMaxPos, BOOL fRedraw)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetScrollPos (ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw)
 
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxInvalidateRect (ITextHost *iface, LPCRECT prc, BOOL fMode)
 
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxViewChange (ITextHost *iface, BOOL fUpdate)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxCreateCaret (ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxShowCaret (ITextHost *iface, BOOL fShow)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetCaretPos (ITextHost *iface, INT x, INT y)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetTimer (ITextHost *iface, UINT idTimer, UINT uTimeout)
 
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxKillTimer (ITextHost *iface, UINT idTimer)
 
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxScrollWindowEx (ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll, LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate, UINT fuScroll)
 
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetCapture (ITextHost *iface, BOOL fCapture)
 
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetFocus (ITextHost *iface)
 
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetCursor (ITextHost *iface, HCURSOR hcur, BOOL fText)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxScreenToClient (ITextHost *iface, LPPOINT lppt)
 
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxClientToScreen (ITextHost *iface, LPPOINT lppt)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxActivate (ITextHost *iface, LONG *plOldState)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxDeactivate (ITextHost *iface, LONG lNewState)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetClientRect (ITextHost *iface, LPRECT prc)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetViewInset (ITextHost *iface, LPRECT prc)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetCharFormat (ITextHost *iface, const CHARFORMATW **ppCF)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetParaFormat (ITextHost *iface, const PARAFORMAT **fmt)
 
DECLSPEC_HIDDEN COLORREF WINAPI ITextHostImpl_TxGetSysColor (ITextHost *iface, int nIndex)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetBackStyle (ITextHost *iface, TXTBACKSTYLE *pStyle)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetMaxLength (ITextHost *iface, DWORD *pLength)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetScrollBars (ITextHost *iface, DWORD *pdwScrollBar)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetPasswordChar (ITextHost *iface, WCHAR *pch)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos (ITextHost *iface, LONG *pch)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetExtent (ITextHost *iface, LPSIZEL lpExtent)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange (ITextHost *iface, const CHARFORMATW *pcf)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange (ITextHost *iface, const PARAFORMAT *ppf)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetPropertyBits (ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxNotify (ITextHost *iface, DWORD iNotify, void *pv)
 
DECLSPEC_HIDDEN HIMC WINAPI ITextHostImpl_TxImmGetContext (ITextHost *iface)
 
DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxImmReleaseContext (ITextHost *iface, HIMC himc)
 
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth (ITextHost *iface, LONG *lSelBarWidth)
 

Variables

static const ITextHostVtbl textHostVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file txthost.c.

◆ DEFINE_THISCALL_WRAPPER

#define DEFINE_THISCALL_WRAPPER (   func,
  args 
)    /* nothing */

Definition at line 527 of file txthost.c.

◆ THISCALL

#define THISCALL (   func)    func

Definition at line 526 of file txthost.c.

Typedef Documentation

◆ ITextHostImpl

Function Documentation

◆ impl_from_ITextHost()

◆ ITextHostImpl_AddRef()

static ULONG WINAPI ITextHostImpl_AddRef ( ITextHost *  iface)
static

Definition at line 88 of file txthost.c.

89 {
92  return ref;
93 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ ITextHostImpl_OnTxCharFormatChange()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange ( ITextHost *  iface,
const CHARFORMATW pcf 
)

Definition at line 342 of file txthost.c.

344 {
345  return S_OK;
346 }
#define S_OK
Definition: intsafe.h:59

◆ ITextHostImpl_OnTxParaFormatChange()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange ( ITextHost *  iface,
const PARAFORMAT ppf 
)

Definition at line 348 of file txthost.c.

350 {
351  return S_OK;
352 }
#define S_OK
Definition: intsafe.h:59

◆ ITextHostImpl_QueryInterface()

static HRESULT WINAPI ITextHostImpl_QueryInterface ( ITextHost *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 74 of file txthost.c.

75 {
77 
78  if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextHost)) {
79  *ppvObject = &This->ITextHost_iface;
80  ITextHost_AddRef((ITextHost *)*ppvObject);
81  return S_OK;
82  }
83 
84  FIXME("Unknown interface: %s\n", debugstr_guid(riid));
85  return E_NOINTERFACE;
86 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IUnknown
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ ITextHostImpl_Release()

static ULONG WINAPI ITextHostImpl_Release ( ITextHost *  iface)
static

Definition at line 95 of file txthost.c.

96 {
99 
100  if (!ref)
101  {
102  SetWindowLongPtrW(This->hWnd, 0, 0);
104  }
105  return ref;
106 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define SetWindowLongPtrW
Definition: winuser.h:5247

◆ ITextHostImpl_TxActivate()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxActivate ( ITextHost *  iface,
LONG plOldState 
)

Definition at line 234 of file txthost.c.

235 {
237  *plOldState = HandleToLong(SetActiveWindow(This->hWnd));
238  return (*plOldState ? S_OK : E_FAIL);
239 }
#define E_FAIL
Definition: ddrawi.h:102
HWND WINAPI SetActiveWindow(_In_ HWND)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
#define S_OK
Definition: intsafe.h:59
#define HandleToLong(h)
Definition: basetsd.h:80

◆ ITextHostImpl_TxClientToScreen()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxClientToScreen ( ITextHost *  iface,
LPPOINT  lppt 
)

Definition at line 228 of file txthost.c.

229 {
231  return ClientToScreen(This->hWnd, lppt);
232 }
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69

◆ ITextHostImpl_TxCreateCaret()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxCreateCaret ( ITextHost *  iface,
HBITMAP  hbmp,
INT  xWidth,
INT  yHeight 
)

Definition at line 158 of file txthost.c.

159 {
161  return CreateCaret(This->hWnd, hbmp, xWidth, yHeight);
162 }
BOOL WINAPI CreateCaret(_In_ HWND, _In_opt_ HBITMAP, _In_ int, _In_ int)
HBITMAP hbmp
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69

◆ ITextHostImpl_TxDeactivate()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxDeactivate ( ITextHost *  iface,
LONG  lNewState 
)

Definition at line 241 of file txthost.c.

243 {
244  HWND ret = SetActiveWindow(LongToHandle(lNewState));
245  return (ret ? S_OK : E_FAIL);
246 }
#define E_FAIL
Definition: ddrawi.h:102
HWND WINAPI SetActiveWindow(_In_ HWND)
int ret
#define LongToHandle(h)
Definition: basetsd.h:82
#define S_OK
Definition: intsafe.h:59

◆ ITextHostImpl_TxEnableScrollBar()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxEnableScrollBar ( ITextHost *  iface,
INT  fuSBFlags,
INT  fuArrowflags 
)

Definition at line 126 of file txthost.c.

127 {
129  return EnableScrollBar(This->hWnd, fuSBFlags, fuArrowflags);
130 }
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
BOOL WINAPI EnableScrollBar(_In_ HWND, _In_ UINT, _In_ UINT)

◆ ITextHostImpl_TxGetAcceleratorPos()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos ( ITextHost *  iface,
LONG pch 
)

Definition at line 329 of file txthost.c.

331 {
332  *pch = -1;
333  return S_OK;
334 }
#define pch(ap)
Definition: match.c:418
#define S_OK
Definition: intsafe.h:59

◆ ITextHostImpl_TxGetBackStyle()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetBackStyle ( ITextHost *  iface,
TXTBACKSTYLE pStyle 
)

Definition at line 285 of file txthost.c.

287 {
288  *pStyle = TXTBACK_OPAQUE;
289  return S_OK;
290 }
#define S_OK
Definition: intsafe.h:59

◆ ITextHostImpl_TxGetCharFormat()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetCharFormat ( ITextHost *  iface,
const CHARFORMATW **  ppCF 
)

Definition at line 265 of file txthost.c.

267 {
268  return E_NOTIMPL;
269 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ITextHostImpl_TxGetClientRect()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetClientRect ( ITextHost *  iface,
LPRECT  prc 
)

Definition at line 248 of file txthost.c.

249 {
251  int ret = GetClientRect(This->hWnd, prc);
252  return (ret ? S_OK : E_FAIL);
253 }
#define E_FAIL
Definition: ddrawi.h:102
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
int ret
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:59
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ ITextHostImpl_TxGetDC()

DECLSPEC_HIDDEN HDC WINAPI ITextHostImpl_TxGetDC ( ITextHost *  iface)

Definition at line 108 of file txthost.c.

109 {
111  return GetDC(This->hWnd);
112 }
HDC WINAPI GetDC(_In_opt_ HWND)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69

◆ ITextHostImpl_TxGetExtent()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetExtent ( ITextHost *  iface,
LPSIZEL  lpExtent 
)

Definition at line 336 of file txthost.c.

338 {
339  return E_NOTIMPL;
340 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ITextHostImpl_TxGetMaxLength()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetMaxLength ( ITextHost *  iface,
DWORD pLength 
)

Definition at line 292 of file txthost.c.

294 {
295  *pLength = INFINITE;
296  return S_OK;
297 }
#define S_OK
Definition: intsafe.h:59
#define INFINITE
Definition: serial.h:102

◆ ITextHostImpl_TxGetParaFormat()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetParaFormat ( ITextHost *  iface,
const PARAFORMAT **  fmt 
)

Definition at line 271 of file txthost.c.

273 {
275  *fmt = (const PARAFORMAT *)&This->para_fmt;
276  return S_OK;
277 }
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
#define S_OK
Definition: intsafe.h:59
Definition: dsound.c:943

◆ ITextHostImpl_TxGetPasswordChar()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetPasswordChar ( ITextHost *  iface,
WCHAR pch 
)

Definition at line 322 of file txthost.c.

324 {
325  *pch = '*';
326  return S_OK;
327 }
#define pch(ap)
Definition: match.c:418
#define S_OK
Definition: intsafe.h:59

◆ ITextHostImpl_TxGetPropertyBits()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetPropertyBits ( ITextHost *  iface,
DWORD  dwMask,
DWORD pdwBits 
)

Definition at line 354 of file txthost.c.

355 {
357  ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(This->hWnd, 0);
358  DWORD style;
359  DWORD dwBits = 0;
360 
361  if (editor)
362  {
363  style = editor->styleFlags;
364  if (editor->mode & TM_RICHTEXT)
365  dwBits |= TXTBIT_RICHTEXT;
366  if (editor->bWordWrap)
367  dwBits |= TXTBIT_WORDWRAP;
369  dwBits |= TXTBIT_AUTOWORDSEL;
370  } else {
371  DWORD dwScrollBar;
372 
374  ITextHostImpl_TxGetScrollBars(iface, &dwScrollBar);
375 
377  if (!(dwScrollBar & ES_AUTOHSCROLL))
378  dwBits |= TXTBIT_WORDWRAP;
379  }
380 
381  /* Bits that correspond to window styles. */
382  if (style & ES_MULTILINE)
383  dwBits |= TXTBIT_MULTILINE;
384  if (style & ES_READONLY)
385  dwBits |= TXTBIT_READONLY;
386  if (style & ES_PASSWORD)
387  dwBits |= TXTBIT_USEPASSWORD;
388  if (!(style & ES_NOHIDESEL))
389  dwBits |= TXTBIT_HIDESELECTION;
390  if (style & ES_SAVESEL)
391  dwBits |= TXTBIT_SAVESELECTION;
392  if (style & ES_VERTICAL)
393  dwBits |= TXTBIT_VERTICAL;
394  if (style & ES_NOOLEDRAGDROP)
395  dwBits |= TXTBIT_DISABLEDRAG;
396 
397  dwBits |= TXTBIT_ALLOWBEEP;
398 
399  /* The following bits are always FALSE because they are probably only
400  * needed for ITextServices_OnTxPropertyBitsChange:
401  * TXTBIT_VIEWINSETCHANGE
402  * TXTBIT_BACKSTYLECHANGE
403  * TXTBIT_MAXLENGTHCHANGE
404  * TXTBIT_CHARFORMATCHANGE
405  * TXTBIT_PARAFORMATCHANGE
406  * TXTBIT_SHOWACCELERATOR
407  * TXTBIT_EXTENTCHANGE
408  * TXTBIT_SELBARCHANGE
409  * TXTBIT_SCROLLBARCHANGE
410  * TXTBIT_CLIENTRECTCHANGE
411  *
412  * Documented by MSDN as not supported:
413  * TXTBIT_USECURRENTBKG
414  */
415 
416  *pdwBits = dwBits & dwMask;
417  return S_OK;
418 }
#define ES_VERTICAL
Definition: richedit.h:229
DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetScrollBars(ITextHost *iface, DWORD *pdwScrollBar)
Definition: txthost.c:299
DWORD styleFlags
Definition: editstr.h:392
#define ES_MULTILINE
Definition: pedump.c:667
#define ECO_AUTOWORDSELECTION
Definition: richedit.h:456
#define ES_READONLY
Definition: pedump.c:675
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define ES_PASSWORD
Definition: pedump.c:670
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define TXTBIT_USEPASSWORD
Definition: textserv.h:180
#define TXTBIT_AUTOWORDSEL
Definition: textserv.h:183
#define TXTBIT_SAVESELECTION
Definition: textserv.h:182
#define TXTBIT_HIDESELECTION
Definition: textserv.h:181
#define TXTBIT_WORDWRAP
Definition: textserv.h:186
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TXTBIT_READONLY
Definition: textserv.h:178
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
#define ES_NOHIDESEL
Definition: pedump.c:673
#define TXTBIT_MULTILINE
Definition: textserv.h:177
#define ES_SAVESEL
Definition: richedit.h:226
#define TXTBIT_RICHTEXT
Definition: textserv.h:176
#define TM_RICHTEXT
Definition: richedit.h:1029
#define GWL_STYLE
Definition: winuser.h:846
#define S_OK
Definition: intsafe.h:59
#define TXTBIT_ALLOWBEEP
Definition: textserv.h:187
Arabic default style
Definition: afstyles.h:93
#define TXTBIT_VERTICAL
Definition: textserv.h:184
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define ES_NOOLEDRAGDROP
Definition: richedit.h:223
#define TXTBIT_DISABLEDRAG
Definition: textserv.h:188

◆ ITextHostImpl_TxGetScrollBars()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetScrollBars ( ITextHost *  iface,
DWORD pdwScrollBar 
)

Definition at line 299 of file txthost.c.

300 {
302  ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0);
303  const DWORD mask = WS_VSCROLL|
304  WS_HSCROLL|
308  if (editor)
309  {
310  *pdwScrollBar = editor->styleFlags & mask;
311  } else {
313  if (style & WS_VSCROLL)
315  if (!This->bEmulateVersion10 && (style & WS_HSCROLL))
317  *pdwScrollBar = style & mask;
318  }
319  return S_OK;
320 }
DWORD styleFlags
Definition: editstr.h:392
#define GetWindowLongPtrW
Definition: winuser.h:4730
GLenum GLint GLuint mask
Definition: glext.h:6028
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define ES_AUTOVSCROLL
Definition: pedump.c:671
unsigned long DWORD
Definition: ntddk_ex.h:95
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
#define WS_HSCROLL
Definition: pedump.c:628
#define ES_DISABLENOSCROLL
Definition: richedit.h:224
#define GWL_STYLE
Definition: winuser.h:846
#define S_OK
Definition: intsafe.h:59
#define WS_VSCROLL
Definition: pedump.c:627
Arabic default style
Definition: afstyles.h:93
#define ES_AUTOHSCROLL
Definition: pedump.c:672

Referenced by ITextHostImpl_TxGetPropertyBits().

◆ ITextHostImpl_TxGetSelectionBarWidth()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth ( ITextHost *  iface,
LONG lSelBarWidth 
)

Definition at line 490 of file txthost.c.

491 {
493  ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(This->hWnd, 0);
494 
495  DWORD style = editor ? editor->styleFlags
496  : GetWindowLongW(This->hWnd, GWL_STYLE);
497  *lSelBarWidth = (style & ES_SELECTIONBAR) ? 225 : 0; /* in HIMETRIC */
498  return S_OK;
499 }
DWORD styleFlags
Definition: editstr.h:392
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define ES_SELECTIONBAR
Definition: richedit.h:230
unsigned long DWORD
Definition: ntddk_ex.h:95
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
#define GWL_STYLE
Definition: winuser.h:846
#define S_OK
Definition: intsafe.h:59
Arabic default style
Definition: afstyles.h:93

◆ ITextHostImpl_TxGetSysColor()

DECLSPEC_HIDDEN COLORREF WINAPI ITextHostImpl_TxGetSysColor ( ITextHost *  iface,
int  nIndex 
)

Definition at line 279 of file txthost.c.

281 {
282  return GetSysColor(nIndex);
283 }
DWORD WINAPI GetSysColor(_In_ int)

◆ ITextHostImpl_TxGetViewInset()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetViewInset ( ITextHost *  iface,
LPRECT  prc 
)

Definition at line 255 of file txthost.c.

257 {
258  prc->top = 0;
259  prc->left = 0;
260  prc->bottom = 0;
261  prc->right = 0;
262  return S_OK;
263 }
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define S_OK
Definition: intsafe.h:59
LONG bottom
Definition: windef.h:294
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ ITextHostImpl_TxImmGetContext()

DECLSPEC_HIDDEN HIMC WINAPI ITextHostImpl_TxImmGetContext ( ITextHost *  iface)

Definition at line 478 of file txthost.c.

479 {
481  return ImmGetContext(This->hWnd);
482 }
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1518
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69

◆ ITextHostImpl_TxImmReleaseContext()

DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxImmReleaseContext ( ITextHost *  iface,
HIMC  himc 
)

Definition at line 484 of file txthost.c.

485 {
487  ImmReleaseContext(This->hWnd, himc);
488 }
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:2275

◆ ITextHostImpl_TxInvalidateRect()

DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxInvalidateRect ( ITextHost *  iface,
LPCRECT  prc,
BOOL  fMode 
)

Definition at line 145 of file txthost.c.

146 {
148  InvalidateRect(This->hWnd, prc, fMode);
149 }
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ ITextHostImpl_TxKillTimer()

DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxKillTimer ( ITextHost *  iface,
UINT  idTimer 
)

Definition at line 185 of file txthost.c.

186 {
188  KillTimer(This->hWnd, idTimer);
189 }
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

◆ ITextHostImpl_TxNotify()

DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxNotify ( ITextHost *  iface,
DWORD  iNotify,
void pv 
)

Definition at line 420 of file txthost.c.

421 {
423  ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0);
424  HWND hwnd = This->hWnd;
425  UINT id;
426 
427  if (!editor || !editor->hwndParent) return S_OK;
428 
429  id = GetWindowLongW(hwnd, GWLP_ID);
430 
431  switch (iNotify)
432  {
433  case EN_DROPFILES:
434  case EN_LINK:
435  case EN_OLEOPFAILED:
436  case EN_PROTECTED:
437  case EN_REQUESTRESIZE:
438  case EN_SAVECLIPBOARD:
439  case EN_SELCHANGE:
440  case EN_STOPNOUNDO:
441  {
442  /* FIXME: Verify this assumption that pv starts with NMHDR. */
443  NMHDR *info = pv;
444  if (!info)
445  return E_FAIL;
446 
447  info->hwndFrom = hwnd;
448  info->idFrom = id;
449  info->code = iNotify;
450  SendMessageW(editor->hwndParent, WM_NOTIFY, id, (LPARAM)info);
451  break;
452  }
453 
454  case EN_UPDATE:
455  /* Only sent when the window is visible. */
456  if (!IsWindowVisible(hwnd))
457  break;
458  /* Fall through */
459  case EN_CHANGE:
460  case EN_ERRSPACE:
461  case EN_HSCROLL:
462  case EN_KILLFOCUS:
463  case EN_MAXTEXT:
464  case EN_SETFOCUS:
465  case EN_VSCROLL:
466  SendMessageW(editor->hwndParent, WM_COMMAND, MAKEWPARAM(id, iNotify), (LPARAM)hwnd);
467  break;
468 
469  case EN_MSGFILTER:
470  FIXME("EN_MSGFILTER is documented as not being sent to TxNotify\n");
471  /* fall through */
472  default:
473  return E_FAIL;
474  }
475  return S_OK;
476 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define EN_MAXTEXT
Definition: winuser.h:2008
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
#define EN_SELCHANGE
Definition: richedit.h:193
#define EN_PROTECTED
Definition: richedit.h:195
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define E_FAIL
Definition: ddrawi.h:102
#define EN_SAVECLIPBOARD
Definition: richedit.h:199
#define EN_KILLFOCUS
Definition: winuser.h:2007
#define EN_SETFOCUS
Definition: winuser.h:2009
#define FIXME(fmt,...)
Definition: debug.h:110
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define EN_ERRSPACE
Definition: winuser.h:2005
LONG_PTR LPARAM
Definition: windef.h:208
#define EN_MSGFILTER
Definition: richedit.h:191
#define EN_DROPFILES
Definition: richedit.h:194
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
#define EN_OLEOPFAILED
Definition: richedit.h:200
#define WM_COMMAND
Definition: winuser.h:1722
#define EN_HSCROLL
Definition: winuser.h:2006
#define EN_VSCROLL
Definition: winuser.h:2011
#define S_OK
Definition: intsafe.h:59
#define EN_LINK
Definition: richedit.h:202
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
GLenum GLuint id
Definition: glext.h:5579
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define EN_UPDATE
Definition: winuser.h:2010
#define EN_STOPNOUNDO
Definition: richedit.h:197
#define EN_REQUESTRESIZE
Definition: richedit.h:192
#define GWLP_ID
Definition: winuser.h:854
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:2004

◆ ITextHostImpl_TxReleaseDC()

DECLSPEC_HIDDEN INT WINAPI ITextHostImpl_TxReleaseDC ( ITextHost *  iface,
HDC  hdc 
)

Definition at line 114 of file txthost.c.

115 {
117  return ReleaseDC(This->hWnd, hdc);
118 }
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
HDC hdc
Definition: main.c:9

◆ ITextHostImpl_TxScreenToClient()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxScreenToClient ( ITextHost *  iface,
LPPOINT  lppt 
)

Definition at line 222 of file txthost.c.

223 {
225  return ScreenToClient(This->hWnd, lppt);
226 }
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

◆ ITextHostImpl_TxScrollWindowEx()

DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxScrollWindowEx ( ITextHost *  iface,
INT  dx,
INT  dy,
LPCRECT  lprcScroll,
LPCRECT  lprcClip,
HRGN  hRgnUpdate,
LPRECT  lprcUpdate,
UINT  fuScroll 
)

Definition at line 191 of file txthost.c.

194 {
196  ScrollWindowEx(This->hWnd, dx, dy, lprcScroll, lprcClip,
197  hRgnUpdate, lprcUpdate, fuScroll);
198 }
GLint dy
Definition: linetemp.h:97
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
GLint dx
Definition: linetemp.h:97

◆ ITextHostImpl_TxSetCapture()

DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetCapture ( ITextHost *  iface,
BOOL  fCapture 
)

Definition at line 200 of file txthost.c.

201 {
203  if (fCapture)
204  SetCapture(This->hWnd);
205  else
206  ReleaseCapture();
207 }
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
HWND WINAPI SetCapture(_In_ HWND hWnd)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888

◆ ITextHostImpl_TxSetCaretPos()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetCaretPos ( ITextHost *  iface,
INT  x,
INT  y 
)

Definition at line 173 of file txthost.c.

175 {
176  return SetCaretPos(x, y);
177 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL WINAPI SetCaretPos(_In_ int, _In_ int)

◆ ITextHostImpl_TxSetCursor()

DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetCursor ( ITextHost *  iface,
HCURSOR  hcur,
BOOL  fText 
)

Definition at line 215 of file txthost.c.

218 {
219  SetCursor(hcur);
220 }
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)

◆ ITextHostImpl_TxSetFocus()

DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxSetFocus ( ITextHost *  iface)

Definition at line 209 of file txthost.c.

210 {
212  SetFocus(This->hWnd);
213 }
HWND WINAPI SetFocus(_In_opt_ HWND)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69

◆ ITextHostImpl_TxSetScrollPos()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetScrollPos ( ITextHost *  iface,
INT  fnBar,
INT  nPos,
BOOL  fRedraw 
)

Definition at line 139 of file txthost.c.

140 {
142  return SetScrollPos(This->hWnd, fnBar, nPos, fRedraw) != 0;
143 }
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)

◆ ITextHostImpl_TxSetScrollRange()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetScrollRange ( ITextHost *  iface,
INT  fnBar,
LONG  nMinPos,
INT  nMaxPos,
BOOL  fRedraw 
)

Definition at line 132 of file txthost.c.

134 {
136  return SetScrollRange(This->hWnd, fnBar, nMinPos, nMaxPos, fRedraw);
137 }
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
BOOL WINAPI SetScrollRange(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ BOOL)

◆ ITextHostImpl_TxSetTimer()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxSetTimer ( ITextHost *  iface,
UINT  idTimer,
UINT  uTimeout 
)

Definition at line 179 of file txthost.c.

180 {
182  return SetTimer(This->hWnd, idTimer, uTimeout, NULL) != 0;
183 }
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69

◆ ITextHostImpl_TxShowCaret()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxShowCaret ( ITextHost *  iface,
BOOL  fShow 
)

Definition at line 164 of file txthost.c.

165 {
167  if (fShow)
168  return ShowCaret(This->hWnd);
169  else
170  return HideCaret(This->hWnd);
171 }
BOOL WINAPI HideCaret(_In_opt_ HWND)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69
BOOL WINAPI ShowCaret(_In_opt_ HWND)

◆ ITextHostImpl_TxShowScrollBar()

DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxShowScrollBar ( ITextHost *  iface,
INT  fnBar,
BOOL  fShow 
)

Definition at line 120 of file txthost.c.

121 {
123  return ShowScrollBar(This->hWnd, fnBar, fShow);
124 }
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69

◆ ITextHostImpl_TxViewChange()

DECLSPEC_HIDDEN void WINAPI ITextHostImpl_TxViewChange ( ITextHost *  iface,
BOOL  fUpdate 
)

Definition at line 151 of file txthost.c.

152 {
154  if (fUpdate)
155  UpdateWindow(This->hWnd);
156 }
BOOL WINAPI UpdateWindow(_In_ HWND)
static ITextHostImpl * impl_from_ITextHost(ITextHost *iface)
Definition: txthost.c:69

◆ ME_CreateTextHost()

ITextHost* ME_CreateTextHost ( HWND  hwnd,
CREATESTRUCTW cs,
BOOL  bEmulateVersion10 
)

Definition at line 46 of file txthost.c.

47 {
48  ITextHostImpl *texthost;
49 
50  texthost = CoTaskMemAlloc(sizeof(*texthost));
51  if (!texthost) return NULL;
52 
53  texthost->ITextHost_iface.lpVtbl = &textHostVtbl;
54  texthost->ref = 1;
55  texthost->hWnd = hwnd;
56  texthost->bEmulateVersion10 = bEmulateVersion10;
57  memset( &texthost->para_fmt, 0, sizeof(texthost->para_fmt) );
58  texthost->para_fmt.cbSize = sizeof(texthost->para_fmt);
59  texthost->para_fmt.dwMask = PFM_ALIGNMENT;
60  texthost->para_fmt.wAlignment = PFA_LEFT;
61  if (cs->style & ES_RIGHT)
62  texthost->para_fmt.wAlignment = PFA_RIGHT;
63  if (cs->style & ES_CENTER)
64  texthost->para_fmt.wAlignment = PFA_CENTER;
65 
66  return &texthost->ITextHost_iface;
67 }
#define PFA_RIGHT
Definition: richedit.h:922
#define ES_CENTER
Definition: pedump.c:665
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
WORD wAlignment
Definition: richedit.h:673
#define PFM_ALIGNMENT
Definition: richedit.h:841
uint32_t cs
Definition: isohybrid.c:75
#define ES_RIGHT
Definition: pedump.c:666
LONG ref
Definition: txthost.c:38
HWND hWnd
Definition: txthost.c:39
smooth NULL
Definition: ftsmooth.c:416
DWORD dwMask
Definition: richedit.h:667
#define PFA_CENTER
Definition: richedit.h:923
ITextHost ITextHost_iface
Definition: txthost.c:37
PARAFORMAT2 para_fmt
Definition: txthost.c:41
BOOL bEmulateVersion10
Definition: txthost.c:40
static const ITextHostVtbl textHostVtbl
Definition: txthost.c:44
#define PFA_LEFT
Definition: richedit.h:921
UINT cbSize
Definition: richedit.h:666
#define memset(x, y, z)
Definition: compat.h:39
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by create_windowed_editor().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( richedit  )

Variable Documentation

◆ textHostVtbl

static const ITextHostVtbl textHostVtbl
static

Definition at line 44 of file txthost.c.

Referenced by ME_CreateTextHost().