riched20: Remove the host structure's typedef.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-03-03 11:29:38 +00:00 committed by Alexandre Julliard
parent 732aec2af2
commit d188686b16
1 changed files with 130 additions and 139 deletions

View File

@ -32,30 +32,31 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit); WINE_DEFAULT_DEBUG_CHANNEL(richedit);
typedef struct ITextHostImpl { struct host
{
ITextHost ITextHost_iface; ITextHost ITextHost_iface;
LONG ref; LONG ref;
HWND hWnd; HWND window;
BOOL bEmulateVersion10; BOOL emulate_10;
PARAFORMAT2 para_fmt; PARAFORMAT2 para_fmt;
} ITextHostImpl; };
static const ITextHostVtbl textHostVtbl; static const ITextHostVtbl textHostVtbl;
static BOOL listbox_registered; static BOOL listbox_registered;
static BOOL combobox_registered; static BOOL combobox_registered;
static ITextHost *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10 ) static ITextHost *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 )
{ {
ITextHostImpl *texthost; struct host *texthost;
texthost = CoTaskMemAlloc(sizeof(*texthost)); texthost = CoTaskMemAlloc(sizeof(*texthost));
if (!texthost) return NULL; if (!texthost) return NULL;
texthost->ITextHost_iface.lpVtbl = &textHostVtbl; texthost->ITextHost_iface.lpVtbl = &textHostVtbl;
texthost->ref = 1; texthost->ref = 1;
texthost->hWnd = hwnd; texthost->window = hwnd;
texthost->bEmulateVersion10 = bEmulateVersion10; texthost->emulate_10 = emulate_10;
memset( &texthost->para_fmt, 0, sizeof(texthost->para_fmt) ); memset( &texthost->para_fmt, 0, sizeof(texthost->para_fmt) );
texthost->para_fmt.cbSize = sizeof(texthost->para_fmt); texthost->para_fmt.cbSize = sizeof(texthost->para_fmt);
texthost->para_fmt.dwMask = PFM_ALIGNMENT; texthost->para_fmt.dwMask = PFM_ALIGNMENT;
@ -68,18 +69,19 @@ static ITextHost *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersio
return &texthost->ITextHost_iface; return &texthost->ITextHost_iface;
} }
static inline ITextHostImpl *impl_from_ITextHost(ITextHost *iface) static inline struct host *impl_from_ITextHost( ITextHost *iface )
{ {
return CONTAINING_RECORD(iface, ITextHostImpl, ITextHost_iface); return CONTAINING_RECORD( iface, struct host, ITextHost_iface );
} }
static HRESULT WINAPI ITextHostImpl_QueryInterface(ITextHost *iface, REFIID riid, void **ppvObject) static HRESULT WINAPI ITextHostImpl_QueryInterface( ITextHost *iface, REFIID riid, void **obj )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextHost)) { if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextHost))
*ppvObject = &This->ITextHost_iface; {
ITextHost_AddRef((ITextHost *)*ppvObject); *obj = &host->ITextHost_iface;
ITextHost_AddRef( (ITextHost *)*obj );
return S_OK; return S_OK;
} }
@ -89,20 +91,20 @@ static HRESULT WINAPI ITextHostImpl_QueryInterface(ITextHost *iface, REFIID riid
static ULONG WINAPI ITextHostImpl_AddRef(ITextHost *iface) static ULONG WINAPI ITextHostImpl_AddRef(ITextHost *iface)
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement( &host->ref );
return ref; return ref;
} }
static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface) static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement( &host->ref );
if (!ref) if (!ref)
{ {
SetWindowLongPtrW(This->hWnd, 0, 0); SetWindowLongPtrW( host->window, 0, 0 );
CoTaskMemFree(This); CoTaskMemFree( host );
} }
return ref; return ref;
} }
@ -110,176 +112,165 @@ static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetDC,4) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetDC,4)
DECLSPEC_HIDDEN HDC __thiscall ITextHostImpl_TxGetDC(ITextHost *iface) DECLSPEC_HIDDEN HDC __thiscall ITextHostImpl_TxGetDC(ITextHost *iface)
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return GetDC(This->hWnd); return GetDC( host->window );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxReleaseDC,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxReleaseDC,8)
DECLSPEC_HIDDEN INT __thiscall ITextHostImpl_TxReleaseDC(ITextHost *iface, HDC hdc) DECLSPEC_HIDDEN INT __thiscall ITextHostImpl_TxReleaseDC(ITextHost *iface, HDC hdc)
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return ReleaseDC(This->hWnd, hdc); return ReleaseDC( host->window, hdc );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowScrollBar,12) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowScrollBar,12)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowScrollBar(ITextHost *iface, INT fnBar, BOOL fShow) DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowScrollBar( ITextHost *iface, INT bar, BOOL show )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return ShowScrollBar(This->hWnd, fnBar, fShow); return ShowScrollBar( host->window, bar, show );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxEnableScrollBar,12) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxEnableScrollBar,12)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxEnableScrollBar(ITextHost *iface, INT fuSBFlags, INT fuArrowflags) DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxEnableScrollBar( ITextHost *iface, INT bar, INT arrows )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return EnableScrollBar(This->hWnd, fuSBFlags, fuArrowflags); return EnableScrollBar( host->window, bar, arrows );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollRange,20) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollRange,20)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollRange(ITextHost *iface, INT fnBar, LONG nMinPos, INT nMaxPos, DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollRange( ITextHost *iface, INT bar, LONG min_pos, INT max_pos, BOOL redraw )
BOOL fRedraw)
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return SetScrollRange(This->hWnd, fnBar, nMinPos, nMaxPos, fRedraw); return SetScrollRange( host->window, bar, min_pos, max_pos, redraw );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollPos,16) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollPos,16)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollPos(ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw) DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollPos( ITextHost *iface, INT bar, INT pos, BOOL redraw )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return SetScrollPos(This->hWnd, fnBar, nPos, fRedraw) != 0; return SetScrollPos( host->window, bar, pos, redraw ) != 0;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxInvalidateRect,12) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxInvalidateRect,12)
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxInvalidateRect(ITextHost *iface, LPCRECT prc, BOOL fMode) DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxInvalidateRect( ITextHost *iface, const RECT *rect, BOOL mode )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
InvalidateRect(This->hWnd, prc, fMode); InvalidateRect( host->window, rect, mode );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxViewChange,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxViewChange,8)
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate) DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxViewChange( ITextHost *iface, BOOL update )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
if (fUpdate) if (update) UpdateWindow( host->window );
UpdateWindow(This->hWnd);
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxCreateCaret,16) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxCreateCaret,16)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxCreateCaret(ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight) DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxCreateCaret( ITextHost *iface, HBITMAP bitmap, INT width, INT height )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return CreateCaret(This->hWnd, hbmp, xWidth, yHeight); return CreateCaret( host->window, bitmap, width, height );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowCaret,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowCaret,8)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow) DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowCaret( ITextHost *iface, BOOL show )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
if (fShow) if (show) return ShowCaret( host->window );
return ShowCaret(This->hWnd); else return HideCaret( host->window );
else
return HideCaret(This->hWnd);
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCaretPos,12) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCaretPos,12)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetCaretPos(ITextHost *iface, DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetCaretPos( ITextHost *iface, INT x, INT y )
INT x, INT y)
{ {
return SetCaretPos(x, y); return SetCaretPos(x, y);
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetTimer,12) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetTimer,12)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetTimer(ITextHost *iface, UINT idTimer, UINT uTimeout) DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetTimer( ITextHost *iface, UINT id, UINT timeout )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return SetTimer(This->hWnd, idTimer, uTimeout, NULL) != 0; return SetTimer( host->window, id, timeout, NULL ) != 0;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxKillTimer,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxKillTimer,8)
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxKillTimer(ITextHost *iface, UINT idTimer) DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxKillTimer( ITextHost *iface, UINT id )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
KillTimer(This->hWnd, idTimer); KillTimer( host->window, id );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScrollWindowEx,32) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScrollWindowEx,32)
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxScrollWindowEx(ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll, DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxScrollWindowEx( ITextHost *iface, INT dx, INT dy, const RECT *scroll,
LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate, const RECT *clip, HRGN update_rgn, RECT *update_rect,
UINT fuScroll) UINT flags )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
ScrollWindowEx(This->hWnd, dx, dy, lprcScroll, lprcClip, ScrollWindowEx( host->window, dx, dy, scroll, clip, update_rgn, update_rect, flags );
hRgnUpdate, lprcUpdate, fuScroll);
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCapture,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCapture,8)
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCapture(ITextHost *iface, BOOL fCapture) DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCapture( ITextHost *iface, BOOL capture )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
if (fCapture) if (capture) SetCapture( host->window );
SetCapture(This->hWnd); else ReleaseCapture();
else
ReleaseCapture();
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetFocus,4) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetFocus,4)
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetFocus(ITextHost *iface) DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetFocus(ITextHost *iface)
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
SetFocus(This->hWnd); SetFocus( host->window );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCursor,12) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCursor,12)
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCursor(ITextHost *iface, HCURSOR hcur, BOOL fText) DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCursor( ITextHost *iface, HCURSOR cursor, BOOL text )
{ {
SetCursor(hcur); SetCursor( cursor );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScreenToClient,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScreenToClient,8)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxScreenToClient(ITextHost *iface, LPPOINT lppt) DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxScreenToClient( ITextHost *iface, POINT *pt )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return ScreenToClient(This->hWnd, lppt); return ScreenToClient( host->window, pt );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxClientToScreen,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxClientToScreen,8)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxClientToScreen(ITextHost *iface, LPPOINT lppt) DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxClientToScreen( ITextHost *iface, POINT *pt )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return ClientToScreen(This->hWnd, lppt); return ClientToScreen( host->window, pt );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxActivate,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxActivate,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxActivate(ITextHost *iface, LONG *plOldState) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxActivate( ITextHost *iface, LONG *old_state )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
*plOldState = HandleToLong(SetActiveWindow(This->hWnd)); *old_state = HandleToLong( SetActiveWindow( host->window ) );
return (*plOldState ? S_OK : E_FAIL); return *old_state ? S_OK : E_FAIL;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxDeactivate,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxDeactivate,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxDeactivate(ITextHost *iface, LONG lNewState) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxDeactivate( ITextHost *iface, LONG new_state )
{ {
HWND ret = SetActiveWindow(LongToHandle(lNewState)); HWND ret = SetActiveWindow( LongToHandle( new_state ) );
return (ret ? S_OK : E_FAIL); return ret ? S_OK : E_FAIL;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetClientRect,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetClientRect,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetClientRect(ITextHost *iface, LPRECT prc) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetClientRect( ITextHost *iface, RECT *rect )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
int ret = GetClientRect(This->hWnd, prc); int ret = GetClientRect( host->window, rect );
return (ret ? S_OK : E_FAIL); return ret ? S_OK : E_FAIL;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetViewInset,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetViewInset,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetViewInset(ITextHost *iface, LPRECT prc) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetViewInset( ITextHost *iface, RECT *rect )
{ {
prc->top = 0; SetRectEmpty( rect );
prc->left = 0;
prc->bottom = 0;
prc->right = 0;
return S_OK; return S_OK;
} }
@ -290,38 +281,38 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetCharFormat(ITextHost *ifac
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetParaFormat,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetParaFormat,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetParaFormat(ITextHost *iface, const PARAFORMAT **fmt) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetParaFormat( ITextHost *iface, const PARAFORMAT **fmt )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
*fmt = (const PARAFORMAT *)&This->para_fmt; *fmt = (const PARAFORMAT *)&host->para_fmt;
return S_OK; return S_OK;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSysColor,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSysColor,8)
DECLSPEC_HIDDEN COLORREF __thiscall ITextHostImpl_TxGetSysColor(ITextHost *iface, int nIndex) DECLSPEC_HIDDEN COLORREF __thiscall ITextHostImpl_TxGetSysColor( ITextHost *iface, int index )
{ {
return GetSysColor(nIndex); return GetSysColor( index );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetBackStyle,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetBackStyle,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetBackStyle(ITextHost *iface, TXTBACKSTYLE *pStyle) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetBackStyle( ITextHost *iface, TXTBACKSTYLE *style )
{ {
*pStyle = TXTBACK_OPAQUE; *style = TXTBACK_OPAQUE;
return S_OK; return S_OK;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetMaxLength,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetMaxLength,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetMaxLength(ITextHost *iface, DWORD *pLength) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetMaxLength( ITextHost *iface, DWORD *length )
{ {
*pLength = INFINITE; *length = INFINITE;
return S_OK; return S_OK;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetScrollBars,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetScrollBars,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetScrollBars(ITextHost *iface, DWORD *pdwScrollBar) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetScrollBars( ITextHost *iface, DWORD *scrollbar )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0); ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW( host->window, 0 );
const DWORD mask = WS_VSCROLL| const DWORD mask = WS_VSCROLL|
WS_HSCROLL| WS_HSCROLL|
ES_AUTOVSCROLL| ES_AUTOVSCROLL|
@ -329,34 +320,34 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetScrollBars(ITextHost *ifac
ES_DISABLENOSCROLL; ES_DISABLENOSCROLL;
if (editor) if (editor)
{ {
*pdwScrollBar = editor->styleFlags & mask; *scrollbar = editor->styleFlags & mask;
} else { } else {
DWORD style = GetWindowLongW(This->hWnd, GWL_STYLE); DWORD style = GetWindowLongW( host->window, GWL_STYLE );
if (style & WS_VSCROLL) if (style & WS_VSCROLL)
style |= ES_AUTOVSCROLL; style |= ES_AUTOVSCROLL;
if (!This->bEmulateVersion10 && (style & WS_HSCROLL)) if (!host->emulate_10 && (style & WS_HSCROLL))
style |= ES_AUTOHSCROLL; style |= ES_AUTOHSCROLL;
*pdwScrollBar = style & mask; *scrollbar = style & mask;
} }
return S_OK; return S_OK;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPasswordChar,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPasswordChar,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPasswordChar(ITextHost *iface, WCHAR *pch) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPasswordChar( ITextHost *iface, WCHAR *c )
{ {
*pch = '*'; *c = '*';
return S_OK; return S_OK;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetAcceleratorPos,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetAcceleratorPos,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface, LONG *pch) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos( ITextHost *iface, LONG *pos )
{ {
*pch = -1; *pos = -1;
return S_OK; return S_OK;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetExtent,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetExtent,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetExtent(ITextHost *iface, LPSIZEL lpExtent) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetExtent( ITextHost *iface, SIZEL *extent )
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -374,10 +365,10 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange(ITextHost
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPropertyBits,12) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPropertyBits,12)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *iface, DWORD dwMask, DWORD *pdwBits) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits( ITextHost *iface, DWORD mask, DWORD *bits )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(This->hWnd, 0); ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW( host->window, 0 );
DWORD style; DWORD style;
DWORD dwBits = 0; DWORD dwBits = 0;
@ -393,7 +384,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *if
} else { } else {
DWORD dwScrollBar; DWORD dwScrollBar;
style = GetWindowLongW(This->hWnd, GWL_STYLE); style = GetWindowLongW( host->window, GWL_STYLE );
ITextHostImpl_TxGetScrollBars(iface, &dwScrollBar); ITextHostImpl_TxGetScrollBars(iface, &dwScrollBar);
dwBits |= TXTBIT_RICHTEXT|TXTBIT_AUTOWORDSEL; dwBits |= TXTBIT_RICHTEXT|TXTBIT_AUTOWORDSEL;
@ -436,16 +427,16 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *if
* TXTBIT_USECURRENTBKG * TXTBIT_USECURRENTBKG
*/ */
*pdwBits = dwBits & dwMask; *bits = dwBits & mask;
return S_OK; return S_OK;
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxNotify,12) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxNotify,12)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxNotify(ITextHost *iface, DWORD iNotify, void *pv) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxNotify(ITextHost *iface, DWORD iNotify, void *pv)
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0); ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW( host->window, 0 );
HWND hwnd = This->hWnd; HWND hwnd = host->window;
UINT id; UINT id;
if (!editor || !editor->hwndParent) return S_OK; if (!editor || !editor->hwndParent) return S_OK;
@ -502,26 +493,26 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxNotify(ITextHost *iface, DWOR
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmGetContext,4) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmGetContext,4)
DECLSPEC_HIDDEN HIMC __thiscall ITextHostImpl_TxImmGetContext(ITextHost *iface) DECLSPEC_HIDDEN HIMC __thiscall ITextHostImpl_TxImmGetContext(ITextHost *iface)
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
return ImmGetContext(This->hWnd); return ImmGetContext( host->window );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmReleaseContext,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmReleaseContext,8)
DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxImmReleaseContext(ITextHost *iface, HIMC himc) DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxImmReleaseContext( ITextHost *iface, HIMC context )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
ImmReleaseContext(This->hWnd, himc); ImmReleaseContext( host->window, context );
} }
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface, LONG *lSelBarWidth) DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth( ITextHost *iface, LONG *width )
{ {
ITextHostImpl *This = impl_from_ITextHost(iface); struct host *host = impl_from_ITextHost( iface );
ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(This->hWnd, 0); ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW( host->window, 0 );
DWORD style = editor ? editor->styleFlags DWORD style = editor ? editor->styleFlags
: GetWindowLongW(This->hWnd, GWL_STYLE); : GetWindowLongW( host->window, GWL_STYLE );
*lSelBarWidth = (style & ES_SELECTIONBAR) ? 225 : 0; /* in HIMETRIC */ *width = (style & ES_SELECTIONBAR) ? 225 : 0; /* in HIMETRIC */
return S_OK; return S_OK;
} }