Determine correct checkbox size when using theme.

This commit is contained in:
Maarten Bent 2015-12-16 20:59:27 +01:00
parent dd29ecf840
commit 64c4e0674c
3 changed files with 20 additions and 5 deletions

View File

@ -1152,9 +1152,7 @@ bool wxDataViewToggleRenderer::WXActivateCell(const wxRect& WXUNUSED(cellRect),
wxSize wxDataViewToggleRenderer::GetSize() const
{
// the window parameter is not used by GetCheckBoxSize() so it's
// safe to pass NULL
return wxRendererNative::Get().GetCheckBoxSize(NULL);
return wxRendererNative::Get().GetCheckBoxSize(GetView());
}
// ---------------------------------------------------------

View File

@ -712,9 +712,9 @@ wxRendererGeneric::DrawCheckBox(wxWindow *WXUNUSED(win),
}
}
wxSize wxRendererGeneric::GetCheckBoxSize(wxWindow *WXUNUSED(win))
wxSize wxRendererGeneric::GetCheckBoxSize(wxWindow *win)
{
return wxSize(16, 16);
return win->FromDIP(wxSize(16, 16));
}
void

View File

@ -327,6 +327,8 @@ public:
wxTitleBarButton button,
int flags = 0);
virtual wxSize GetCheckBoxSize(wxWindow *win);
virtual void DrawGauge(wxWindow* win,
wxDC& dc,
const wxRect& rect,
@ -902,6 +904,21 @@ wxRendererXP::DrawTitleBarBitmap(wxWindow *win,
DoDrawButtonLike(hTheme, part, dc, rect, flags);
}
wxSize wxRendererXP::GetCheckBoxSize(wxWindow* win)
{
wxUxThemeHandle hTheme(win, L"BUTTON");
wxUxThemeEngine* const te = wxUxThemeEngine::Get();
if (te->IsThemePartDefined(hTheme, BP_CHECKBOX, 0))
{
SIZE checkSize;
te->GetThemePartSize(hTheme, NULL, BP_CHECKBOX, CBS_UNCHECKEDNORMAL, NULL, TS_DRAW, &checkSize);
return wxSize(checkSize.cx, checkSize.cy);
}
else
return m_rendererNative.GetCheckBoxSize(win);
}
void
wxRendererXP::DrawCollapseButton(wxWindow *win,
wxDC& dc,