riched20: Implement TxGetNaturalSize().
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aae4fa9b1c
commit
e7b42deaf2
|
@ -705,7 +705,7 @@ static void _check_txgetnaturalsize(HRESULT res, LONG width, LONG height, HDC hd
|
||||||
expected_width = expected_rect.right - expected_rect.left;
|
expected_width = expected_rect.right - expected_rect.left;
|
||||||
expected_height = expected_rect.bottom - expected_rect.top;
|
expected_height = expected_rect.bottom - expected_rect.top;
|
||||||
ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08x.\n", res);
|
ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08x.\n", res);
|
||||||
ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1,
|
todo_wine ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1,
|
||||||
"got wrong width: %d, expected: %d {+1}.\n", width, expected_width);
|
"got wrong width: %d, expected: %d {+1}.\n", width, expected_width);
|
||||||
ok_(__FILE__,line)(height == expected_height, "got wrong height: %d, expected: %d.\n",
|
ok_(__FILE__,line)(height == expected_height, "got wrong height: %d, expected: %d.\n",
|
||||||
height, expected_height);
|
height, expected_height);
|
||||||
|
@ -717,7 +717,7 @@ static void test_TxGetNaturalSize(void)
|
||||||
ITextHost *host;
|
ITextHost *host;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
SIZEL extent;
|
SIZEL extent;
|
||||||
static const WCHAR test_text[] = {'T','e','s','t','S','o','m','e','T','e','x','t',0};
|
static const WCHAR test_text[] = L"TestSomeText";
|
||||||
LONG width, height;
|
LONG width, height;
|
||||||
HDC hdcDraw;
|
HDC hdcDraw;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
@ -752,7 +752,7 @@ static void test_TxGetNaturalSize(void)
|
||||||
height = 0;
|
height = 0;
|
||||||
result = ITextServices_TxGetNaturalSize(txtserv, DVASPECT_CONTENT, hdcDraw, NULL, NULL,
|
result = ITextServices_TxGetNaturalSize(txtserv, DVASPECT_CONTENT, hdcDraw, NULL, NULL,
|
||||||
TXTNS_FITTOCONTENT, &extent, &width, &height);
|
TXTNS_FITTOCONTENT, &extent, &width, &height);
|
||||||
todo_wine CHECK_TXGETNATURALSIZE(result, width, height, hdcDraw, rect, test_text);
|
CHECK_TXGETNATURALSIZE(result, width, height, hdcDraw, rect, test_text);
|
||||||
|
|
||||||
ReleaseDC(hwnd, hdcDraw);
|
ReleaseDC(hwnd, hdcDraw);
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
|
|
|
@ -366,14 +366,43 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetBaseLinePos(ITextServices *ifa
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36)
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36)
|
||||||
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize(ITextServices *iface, DWORD dwAspect, HDC hdcDraw,
|
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *iface, DWORD aspect, HDC draw,
|
||||||
HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode,
|
HDC target, DVTARGETDEVICE *td, DWORD mode,
|
||||||
const SIZEL *psizelExtent, LONG *pwidth, LONG *pheight)
|
const SIZEL *extent, LONG *width, LONG *height )
|
||||||
{
|
{
|
||||||
struct text_services *services = impl_from_ITextServices( iface );
|
struct text_services *services = impl_from_ITextServices( iface );
|
||||||
|
RECT rect;
|
||||||
|
HDC dc = draw;
|
||||||
|
BOOL rewrap = FALSE;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
FIXME( "%p: STUB\n", services );
|
TRACE( "%p: aspect %d, draw %p, target %p, td %p, mode %08x, extent %s, *width %d, *height %d\n", services,
|
||||||
return E_NOTIMPL;
|
aspect, draw, target, td, mode, wine_dbgstr_point( (POINT *)extent ), *width, *height );
|
||||||
|
|
||||||
|
if (aspect != DVASPECT_CONTENT || target || td || mode != TXTNS_FITTOCONTENT )
|
||||||
|
FIXME( "Many arguments are ignored\n" );
|
||||||
|
|
||||||
|
SetRect( &rect, 0, 0, *width, *height );
|
||||||
|
|
||||||
|
hr = update_client_rect( services, &rect );
|
||||||
|
if (FAILED( hr )) return hr;
|
||||||
|
if (hr == S_OK) rewrap = TRUE;
|
||||||
|
|
||||||
|
if (!dc && services->editor->in_place_active)
|
||||||
|
dc = ITextHost_TxGetDC( services->host );
|
||||||
|
if (!dc) return E_FAIL;
|
||||||
|
|
||||||
|
if (rewrap)
|
||||||
|
{
|
||||||
|
editor_mark_rewrap_all( services->editor );
|
||||||
|
wrap_marked_paras_dc( services->editor, dc, FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
*width = services->editor->nTotalWidth;
|
||||||
|
*height = services->editor->nTotalLength;
|
||||||
|
|
||||||
|
if (!draw) ITextHost_TxReleaseDC( services->host, dc );
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
|
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
|
||||||
|
|
Loading…
Reference in New Issue