wxButton::GetDefaultSize() added for MSW and documented
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
704a4b7524
commit
e1f36ff823
@ -99,6 +99,14 @@ The button's label.
|
||||
|
||||
\helpref{wxButton::SetLabel}{wxbuttonsetlabel}
|
||||
|
||||
\membersection{wxButton::GetDefaultSize}\label{wxbuttongetdefaultsize}
|
||||
|
||||
\func{wxSize}{GetDefaultSize}{\void}
|
||||
|
||||
Returns the default size for the buttons. It is advised to make all the dialog
|
||||
buttons of the same size and this function allows to retrieve the (platform and
|
||||
current font dependent size) which should be the best suited for this.
|
||||
|
||||
\membersection{wxButton::SetDefault}\label{wxbuttonsetdefault}
|
||||
|
||||
\func{void}{SetDefault}{\void}
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
|
||||
virtual void SetDefault();
|
||||
|
||||
static wxSize GetDefaultSize();
|
||||
|
||||
// implementation from now on
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
|
@ -131,6 +131,20 @@ wxSize wxButton::DoGetBestSize()
|
||||
return wxSize(wBtn, hBtn);
|
||||
}
|
||||
|
||||
/* static */
|
||||
wxSize wxButton::GetDefaultSize()
|
||||
{
|
||||
// the base unit is the height of the system GUI font
|
||||
int wChar, hChar;
|
||||
wxGetCharSize(0, &wChar, &hChar, NULL);
|
||||
|
||||
// the button height is proportional to the height of the font used
|
||||
int hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hChar);
|
||||
|
||||
// and the width/height ration is 75/23
|
||||
return wxSize((75 * hBtn) / 23, hBtn);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// set this button as the default one in its panel
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user