if ( IsOwnerDrawn() )
{
- // width of menu icon in ownerdrawn menu
+ // width of menu icon with margins in ownerdrawn menu
// if any bitmap is not set, the width of space reserved for icon
// image is equal to the width of std check mark,
// if bitmap is set, then the width is set to the width of the widest
RECT rect;
wxCopyRectToRECT(rc, rect);
- int imgWidth = wxMax(GetMarginWidth(), data->CheckSize.cx)
- + data->CheckMargin.left + data->CheckMargin.right;
+ int imgWidth = wxMax(GetMarginWidth(), data->CheckSize.cx);
if ( IsOwnerDrawn() )
{
CopyRect(&rcGutter, &rcSelection);
rcGutter.right = data->ItemMargin.left
+ data->CheckBgMargin.left
+ + data->CheckMargin.left
+ imgWidth
+ + data->CheckMargin.right
+ data->CheckBgMargin.right;
CopyRect(&rcText, &rcSelection);
rcText.left = rcGutter.right + data->TextBorder;
+ // we draw the text label vertically centered, but this results in it
+ // being 1px too low compared to native menus for some reason, fix it
+ if ( data->MenuLayout() != MenuDrawData::FullTheme )
+ rcText.top--;
+
#if wxUSE_UXTHEME
wxUxThemeEngine* theme = MenuDrawData::GetUxThemeEngine();
if ( theme )
RECT rcImg;
SetRect(&rcImg,
- rect.left + data->ItemMargin.left + data->CheckBgMargin.left,
- rect.top + data->ItemMargin.top + data->CheckBgMargin.top,
- rect.left + data->ItemMargin.left + data->CheckBgMargin.left
- + imgWidth,
- rect.bottom - data->ItemMargin.bottom - data->CheckBgMargin.bottom);
+ rect.left + data->ItemMargin.left
+ + data->CheckBgMargin.left
+ + data->CheckMargin.left,
+ rect.top + data->ItemMargin.top
+ + data->CheckBgMargin.top
+ + data->CheckMargin.top,
+ rect.left + data->ItemMargin.left
+ + data->CheckBgMargin.left
+ + data->CheckMargin.left
+ + imgWidth,
+ rect.bottom - data->ItemMargin.bottom
+ - data->CheckBgMargin.bottom
+ - data->CheckMargin.bottom);
if ( IsCheckable() && !m_bmpChecked.Ok() )
{
{
wxUxThemeHandle hTheme(GetMenu()->GetWindow(), L"MENU");
+ const MenuDrawData* data = MenuDrawData::Get();
+
+ // rect for background must be without check margins
+ RECT rcBg;
+ SetRect(&rcBg,
+ rc->left - data->CheckMargin.left,
+ rc->top - data->CheckMargin.top,
+ rc->right + data->CheckMargin.right,
+ rc->bottom + data->CheckMargin.bottom);
+
POPUPCHECKBACKGROUNDSTATES stateCheckBg = (stat & wxODDisabled)
? MCB_DISABLED
: MCB_NORMAL;
theme->DrawThemeBackground(hTheme, hdc, MENU_POPUPCHECKBACKGROUND,
- stateCheckBg, rc, NULL);
-
- // check mark will be drawn centered on the background
+ stateCheckBg, &rcBg, NULL);
POPUPCHECKSTATES stateCheck;
if ( GetKind() == wxITEM_CHECK )