comctl32/listview: Use actual edit box contents to calculate initial control size.
This commit is contained in:
parent
f9736bcc6e
commit
03bd3c8040
|
@ -6,7 +6,7 @@
|
||||||
* Copyright 2000 Jason Mawdsley
|
* Copyright 2000 Jason Mawdsley
|
||||||
* Copyright 2001 CodeWeavers Inc.
|
* Copyright 2001 CodeWeavers Inc.
|
||||||
* Copyright 2002 Dimitrie O. Paun
|
* Copyright 2002 Dimitrie O. Paun
|
||||||
* Copyright 2009 Nikolay Sivov
|
* Copyright 2009, 2010 Nikolay Sivov
|
||||||
* Copyright 2009 Owen Rudge for CodeWeavers
|
* Copyright 2009 Owen Rudge for CodeWeavers
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
|
@ -5840,7 +5840,7 @@ static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, BOOL isW)
|
||||||
|
|
||||||
TRACE("(%p, text=%s, isW=%d)\n", infoPtr, debugtext_t(text, isW), isW);
|
TRACE("(%p, text=%s, isW=%d)\n", infoPtr, debugtext_t(text, isW), isW);
|
||||||
|
|
||||||
/* Window will be resized and positioned after LVN_BEGINLABELEDIT */
|
/* window will be resized and positioned after LVN_BEGINLABELEDIT */
|
||||||
if (isW)
|
if (isW)
|
||||||
hedit = CreateWindowW(WC_EDITW, text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0);
|
hedit = CreateWindowW(WC_EDITW, text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0);
|
||||||
else
|
else
|
||||||
|
@ -5872,7 +5872,7 @@ static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, BOOL isW)
|
||||||
*/
|
*/
|
||||||
static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
|
static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
|
||||||
{
|
{
|
||||||
WCHAR szDispText[DISP_TEXT_SIZE] = { 0 };
|
WCHAR disptextW[DISP_TEXT_SIZE] = { 0 };
|
||||||
HWND hwndSelf = infoPtr->hwndSelf;
|
HWND hwndSelf = infoPtr->hwndSelf;
|
||||||
NMLVDISPINFOW dispInfo;
|
NMLVDISPINFOW dispInfo;
|
||||||
HFONT hOldFont = NULL;
|
HFONT hOldFont = NULL;
|
||||||
|
@ -5908,7 +5908,7 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
|
||||||
dispInfo.item.iItem = nItem;
|
dispInfo.item.iItem = nItem;
|
||||||
dispInfo.item.iSubItem = 0;
|
dispInfo.item.iSubItem = 0;
|
||||||
dispInfo.item.stateMask = ~0;
|
dispInfo.item.stateMask = ~0;
|
||||||
dispInfo.item.pszText = szDispText;
|
dispInfo.item.pszText = disptextW;
|
||||||
dispInfo.item.cchTextMax = DISP_TEXT_SIZE;
|
dispInfo.item.cchTextMax = DISP_TEXT_SIZE;
|
||||||
if (!LISTVIEW_GetItemT(infoPtr, &dispInfo.item, isW)) return 0;
|
if (!LISTVIEW_GetItemT(infoPtr, &dispInfo.item, isW)) return 0;
|
||||||
|
|
||||||
|
@ -5924,6 +5924,8 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACE("disp text=%s\n", debugtext_t(dispInfo.item.pszText, isW));
|
||||||
|
|
||||||
/* position and display edit box */
|
/* position and display edit box */
|
||||||
hdc = GetDC(infoPtr->hwndSelf);
|
hdc = GetDC(infoPtr->hwndSelf);
|
||||||
|
|
||||||
|
@ -5931,16 +5933,12 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
|
||||||
if (infoPtr->hFont)
|
if (infoPtr->hFont)
|
||||||
hOldFont = SelectObject(hdc, infoPtr->hFont);
|
hOldFont = SelectObject(hdc, infoPtr->hFont);
|
||||||
|
|
||||||
/* get string length in pixels */
|
/* use real edit box content, it could be altered during LVN_BEGINLABELEDIT notification */
|
||||||
TRACE("text=%s\n", debugtext_t(dispInfo.item.pszText, isW));
|
GetWindowTextW(infoPtr->hwndEdit, disptextW, DISP_TEXT_SIZE);
|
||||||
|
TRACE("edit box text=%s\n", debugstr_w(disptextW));
|
||||||
|
|
||||||
if (isW)
|
/* get string length in pixels */
|
||||||
GetTextExtentPoint32W(hdc, dispInfo.item.pszText, lstrlenW(dispInfo.item.pszText), &sz);
|
GetTextExtentPoint32W(hdc, disptextW, lstrlenW(disptextW), &sz);
|
||||||
else
|
|
||||||
{
|
|
||||||
const CHAR *textA = (CHAR*)dispInfo.item.pszText;
|
|
||||||
GetTextExtentPoint32A(hdc, textA, lstrlenA(textA), &sz);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add extra spacing for the next character */
|
/* add extra spacing for the next character */
|
||||||
GetTextMetricsW(hdc, &tm);
|
GetTextMetricsW(hdc, &tm);
|
||||||
|
|
Loading…
Reference in New Issue