Check for non-null window in wxRendererNative::GetCheckBoxSize()
Instead of running normally under some platforms and crashing under MSW (when using themes) when passing NULL to GetCheckBoxSize(), now consistently assert and return zero size everywhere. Closes #18241.
This commit is contained in:
@@ -552,7 +552,9 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the size of a check box.
|
Returns the size of a check box.
|
||||||
The @a win parameter is not used currently and can be @NULL.
|
|
||||||
|
@param win A valid, i.e. non-null, window pointer which is used to get
|
||||||
|
the theme defining the checkbox size under some platforms.
|
||||||
*/
|
*/
|
||||||
virtual wxSize GetCheckBoxSize(wxWindow* win) = 0;
|
virtual wxSize GetCheckBoxSize(wxWindow* win) = 0;
|
||||||
|
|
||||||
|
@@ -714,6 +714,8 @@ wxRendererGeneric::DrawCheckBox(wxWindow *WXUNUSED(win),
|
|||||||
|
|
||||||
wxSize wxRendererGeneric::GetCheckBoxSize(wxWindow *win)
|
wxSize wxRendererGeneric::GetCheckBoxSize(wxWindow *win)
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" );
|
||||||
|
|
||||||
return win->FromDIP(wxSize(16, 16));
|
return win->FromDIP(wxSize(16, 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -551,8 +551,13 @@ wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxSize
|
wxSize
|
||||||
wxRendererGTK::GetCheckBoxSize(wxWindow *WXUNUSED(win))
|
wxRendererGTK::GetCheckBoxSize(wxWindow* win)
|
||||||
{
|
{
|
||||||
|
// Even though we don't use the window in this implementation, still check
|
||||||
|
// that it's valid to avoid surprises when running the same code under the
|
||||||
|
// other platforms.
|
||||||
|
wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" );
|
||||||
|
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
int min_width, min_height;
|
int min_width, min_height;
|
||||||
wxGtkStyleContext sc;
|
wxGtkStyleContext sc;
|
||||||
|
@@ -521,8 +521,12 @@ wxRendererMSW::DrawTitleBarBitmap(wxWindow *win,
|
|||||||
DoDrawFrameControl(DFC_CAPTION, kind, win, dc, rect, flags);
|
DoDrawFrameControl(DFC_CAPTION, kind, win, dc, rect, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxRendererMSW::GetCheckBoxSize(wxWindow * WXUNUSED(win))
|
wxSize wxRendererMSW::GetCheckBoxSize(wxWindow* win)
|
||||||
{
|
{
|
||||||
|
// Even though we don't use the window in this implementation, still check
|
||||||
|
// that it's valid to avoid surprises when using themes.
|
||||||
|
wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" );
|
||||||
|
|
||||||
return wxSize(::GetSystemMetrics(SM_CXMENUCHECK),
|
return wxSize(::GetSystemMetrics(SM_CXMENUCHECK),
|
||||||
::GetSystemMetrics(SM_CYMENUCHECK));
|
::GetSystemMetrics(SM_CYMENUCHECK));
|
||||||
}
|
}
|
||||||
@@ -830,6 +834,8 @@ wxRendererXP::DrawTitleBarBitmap(wxWindow *win,
|
|||||||
|
|
||||||
wxSize wxRendererXP::GetCheckBoxSize(wxWindow* win)
|
wxSize wxRendererXP::GetCheckBoxSize(wxWindow* win)
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" );
|
||||||
|
|
||||||
wxUxThemeHandle hTheme(win, L"BUTTON");
|
wxUxThemeHandle hTheme(win, L"BUTTON");
|
||||||
if (hTheme)
|
if (hTheme)
|
||||||
{
|
{
|
||||||
|
@@ -484,8 +484,13 @@ wxRendererMac::DrawCheckBox(wxWindow *win,
|
|||||||
kind, kThemeAdornmentNone);
|
kind, kThemeAdornmentNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxRendererMac::GetCheckBoxSize(wxWindow* WXUNUSED(win))
|
wxSize wxRendererMac::GetCheckBoxSize(wxWindow* win)
|
||||||
{
|
{
|
||||||
|
// Even though we don't use the window in this implementation, still check
|
||||||
|
// that it's valid to avoid surprises when running the same code under the
|
||||||
|
// other platforms.
|
||||||
|
wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" );
|
||||||
|
|
||||||
wxSize size;
|
wxSize size;
|
||||||
SInt32 width, height;
|
SInt32 width, height;
|
||||||
OSStatus errStatus;
|
OSStatus errStatus;
|
||||||
|
Reference in New Issue
Block a user