Commit 9c62f7e4 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

comctl32/button: Implement BCM_GETIDEALSIZE for split buttons.

parent 09bdf5d0
......@@ -197,6 +197,7 @@ typedef BOOL (*pfGetIdealSize)(BUTTON_INFO *infoPtr, SIZE *size);
static BOOL PB_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size);
static BOOL CB_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size);
static BOOL GB_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size);
static BOOL SB_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size);
static const pfGetIdealSize btnGetIdealSizeFunc[MAX_BTN_TYPE] = {
PB_GetIdealSize, /* BS_PUSHBUTTON */
......@@ -211,9 +212,9 @@ static const pfGetIdealSize btnGetIdealSizeFunc[MAX_BTN_TYPE] = {
CB_GetIdealSize, /* BS_AUTORADIOBUTTON */
GB_GetIdealSize, /* BS_PUSHBOX */
GB_GetIdealSize, /* BS_OWNERDRAW */
SB_GetIdealSize, /* BS_SPLITBUTTON */
SB_GetIdealSize, /* BS_DEFSPLITBUTTON */
/* GetIdealSize() for following types are unimplemented, use BS_PUSHBUTTON's for now */
PB_GetIdealSize, /* BS_SPLITBUTTON */
PB_GetIdealSize, /* BS_DEFSPLITBUTTON */
PB_GetIdealSize, /* BS_COMMANDLINK */
PB_GetIdealSize /* BS_DEFCOMMANDLINK */
};
......@@ -1347,6 +1348,25 @@ static BOOL PB_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size)
return TRUE;
}
static BOOL SB_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size)
{
LONG extra_width = infoPtr->glyph_size.cx * 2 + GetSystemMetrics(SM_CXEDGE);
SIZE label_size;
if (SendMessageW(infoPtr->hwnd, WM_GETTEXTLENGTH, 0, 0) == 0)
{
BUTTON_GetClientRectSize(infoPtr, size);
size->cx = max(size->cx, extra_width);
}
else
{
BUTTON_GetLabelIdealSize(infoPtr, size->cx, &label_size);
size->cx = label_size.cx + ((size->cx == 0) ? extra_width : 0);
size->cy = label_size.cy;
}
return TRUE;
}
/**********************************************************************
* BUTTON_CalcLayoutRects
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment