comctl32/datetime: Change DATETIME_ReturnFieldWidth() to return width.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0eb68ad8b6
commit
cc893cdcab
@ -598,8 +598,7 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int DATETIME_GetFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int count)
|
||||||
DATETIME_ReturnFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int count, SHORT *width)
|
|
||||||
{
|
{
|
||||||
/* fields are a fixed width, determined by the largest possible string */
|
/* fields are a fixed width, determined by the largest possible string */
|
||||||
/* presumably, these widths should be language dependent */
|
/* presumably, these widths should be language dependent */
|
||||||
@ -613,13 +612,7 @@ DATETIME_ReturnFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int count, SHO
|
|||||||
LPCWSTR bufptr;
|
LPCWSTR bufptr;
|
||||||
SIZE size;
|
SIZE size;
|
||||||
|
|
||||||
TRACE ("%d,%d\n", infoPtr->nrFields, count);
|
if (!infoPtr->fieldspec) return 0;
|
||||||
if (count>infoPtr->nrFields || count < 0) {
|
|
||||||
WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!infoPtr->fieldspec) return;
|
|
||||||
|
|
||||||
spec = infoPtr->fieldspec[count];
|
spec = infoPtr->fieldspec[count];
|
||||||
if (spec & DT_STRING) {
|
if (spec & DT_STRING) {
|
||||||
@ -709,8 +702,7 @@ DATETIME_ReturnFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int count, SHO
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*width = cx;
|
return cx;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
case ONELETTERAMPM:
|
case ONELETTERAMPM:
|
||||||
bufptr = fld_am1;
|
bufptr = fld_am1;
|
||||||
@ -724,7 +716,7 @@ DATETIME_ReturnFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int count, SHO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetTextExtentPoint32W (hdc, bufptr, strlenW(bufptr), &size);
|
GetTextExtentPoint32W (hdc, bufptr, strlenW(bufptr), &size);
|
||||||
*width = size.cx;
|
return size.cx;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -738,7 +730,6 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
|
|||||||
RECT *rcDraw = &infoPtr->rcDraw;
|
RECT *rcDraw = &infoPtr->rcDraw;
|
||||||
SIZE size;
|
SIZE size;
|
||||||
COLORREF oldTextColor;
|
COLORREF oldTextColor;
|
||||||
SHORT fieldWidth = 0;
|
|
||||||
HFONT oldFont = SelectObject (hdc, infoPtr->hFont);
|
HFONT oldFont = SelectObject (hdc, infoPtr->hFont);
|
||||||
INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
|
INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
|
||||||
WCHAR txt[80];
|
WCHAR txt[80];
|
||||||
@ -752,10 +743,9 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
|
|||||||
for (i = 0; i < infoPtr->nrFields; i++) {
|
for (i = 0; i < infoPtr->nrFields; i++) {
|
||||||
DATETIME_ReturnTxt (infoPtr, i, txt, ARRAY_SIZE(txt));
|
DATETIME_ReturnTxt (infoPtr, i, txt, ARRAY_SIZE(txt));
|
||||||
GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
|
GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
|
||||||
DATETIME_ReturnFieldWidth (infoPtr, hdc, i, &fieldWidth);
|
|
||||||
field = &infoPtr->fieldRect[i];
|
field = &infoPtr->fieldRect[i];
|
||||||
field->left = prevright;
|
field->left = prevright;
|
||||||
field->right = prevright + fieldWidth;
|
field->right = prevright + DATETIME_GetFieldWidth (infoPtr, hdc, i);
|
||||||
field->top = rcDraw->top;
|
field->top = rcDraw->top;
|
||||||
field->bottom = rcDraw->bottom;
|
field->bottom = rcDraw->bottom;
|
||||||
prevright = field->right;
|
prevright = field->right;
|
||||||
@ -1458,7 +1448,6 @@ static BOOL DATETIME_GetIdealSize(DATETIME_INFO *infoPtr, SIZE *size)
|
|||||||
{
|
{
|
||||||
SIZE field_size;
|
SIZE field_size;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
SHORT width;
|
|
||||||
WCHAR txt[80];
|
WCHAR txt[80];
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
HFONT oldFont;
|
HFONT oldFont;
|
||||||
@ -1477,8 +1466,7 @@ static BOOL DATETIME_GetIdealSize(DATETIME_INFO *infoPtr, SIZE *size)
|
|||||||
/* Get text font width */
|
/* Get text font width */
|
||||||
for (i = 0; i < infoPtr->nrFields; i++)
|
for (i = 0; i < infoPtr->nrFields; i++)
|
||||||
{
|
{
|
||||||
DATETIME_ReturnFieldWidth(infoPtr, hdc, i, &width);
|
size->cx += DATETIME_GetFieldWidth(infoPtr, hdc, i);
|
||||||
size->cx += width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectObject(hdc, oldFont);
|
SelectObject(hdc, oldFont);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user