Add optional wxWindow parameter to wxButtonBase::GetDefaultSize()
When per-monitor DPI is used, the default button size depends on the DPI of the display. Use the window to determine this DPI.
This commit is contained in:
@@ -39,8 +39,9 @@ public:
|
|||||||
// returns the old default item (possibly NULL)
|
// returns the old default item (possibly NULL)
|
||||||
virtual wxWindow *SetDefault();
|
virtual wxWindow *SetDefault();
|
||||||
|
|
||||||
// returns the default button size for this platform
|
// returns the default button size for this platform, and optionally for a
|
||||||
static wxSize GetDefaultSize();
|
// specific window when the platform supports per-monitor DPI
|
||||||
|
static wxSize GetDefaultSize(wxWindow* win = NULL);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxDECLARE_NO_COPY_CLASS(wxButtonBase);
|
wxDECLARE_NO_COPY_CLASS(wxButtonBase);
|
||||||
|
@@ -179,11 +179,14 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the default size for the buttons. It is advised to make all the dialog
|
Returns the default size for the buttons. It is advised to make all the
|
||||||
buttons of the same size and this function allows retrieving the (platform and
|
dialog buttons of the same size and this function allows retrieving the
|
||||||
current font dependent size) which should be the best suited for this.
|
(platform, and current font dependent) size which should be the best
|
||||||
|
suited for this.
|
||||||
|
The optional wxWindow parameter allows to get a per-monitor DPI
|
||||||
|
specific size.
|
||||||
*/
|
*/
|
||||||
static wxSize GetDefaultSize();
|
static wxSize GetDefaultSize(wxWindow* win = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the string label for the button.
|
Returns the string label for the button.
|
||||||
|
@@ -165,7 +165,7 @@ wxWindow *wxButton::SetDefault()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
wxSize wxButtonBase::GetDefaultSize()
|
wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win))
|
||||||
{
|
{
|
||||||
static wxSize size = wxDefaultSize;
|
static wxSize size = wxDefaultSize;
|
||||||
if (size == wxDefaultSize)
|
if (size == wxDefaultSize)
|
||||||
|
@@ -166,7 +166,7 @@ wxWindow *wxButton::SetDefault()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
wxSize wxButtonBase::GetDefaultSize()
|
wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win))
|
||||||
{
|
{
|
||||||
return wxSize(80,26);
|
return wxSize(80,26);
|
||||||
}
|
}
|
||||||
|
@@ -160,10 +160,8 @@ WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
wxSize wxButtonBase::GetDefaultSize()
|
wxSize wxButtonBase::GetDefaultSize(wxWindow* win)
|
||||||
{
|
{
|
||||||
wxWindow* win = wxTheApp ? wxTheApp->GetTopWindow() : NULL;
|
|
||||||
|
|
||||||
static wxPrivate::DpiDependentValue<wxSize> s_sizeBtn;
|
static wxPrivate::DpiDependentValue<wxSize> s_sizeBtn;
|
||||||
|
|
||||||
if ( s_sizeBtn.HasChanged(win) )
|
if ( s_sizeBtn.HasChanged(win) )
|
||||||
|
@@ -137,7 +137,7 @@ bool wxButton::OSXHandleClicked( double WXUNUSED(timestampsec) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
wxSize wxButtonBase::GetDefaultSize()
|
wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win))
|
||||||
{
|
{
|
||||||
return wxAnyButton::GetDefaultSize();
|
return wxAnyButton::GetDefaultSize();
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ wxWindow *wxButton::SetDefault()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
wxSize wxButtonBase::GetDefaultSize()
|
wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win))
|
||||||
{
|
{
|
||||||
static wxSize size = wxDefaultSize;
|
static wxSize size = wxDefaultSize;
|
||||||
if (size == wxDefaultSize)
|
if (size == wxDefaultSize)
|
||||||
|
@@ -110,7 +110,7 @@ wxButton::~wxButton()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
wxSize wxButtonBase::GetDefaultSize()
|
wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win))
|
||||||
{
|
{
|
||||||
static wxSize s_sizeBtn;
|
static wxSize s_sizeBtn;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user