Use wxAnyButton's DoGetBestSize for toggle buttons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -47,7 +47,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||||
virtual wxSize DoGetBestSize() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
|
||||||
@@ -79,9 +78,6 @@ public:
|
|||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxCheckBoxNameStr);
|
const wxString& name = wxCheckBoxNameStr);
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual wxSize DoGetBestSize() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton)
|
||||||
};
|
};
|
||||||
|
@@ -76,18 +76,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxToggleButton::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
int wBtn = 70 ;
|
|
||||||
int hBtn = 20 ;
|
|
||||||
|
|
||||||
int lBtn = m_label.Length() * 8 + 12 ;
|
|
||||||
if (lBtn > wBtn)
|
|
||||||
wBtn = lBtn;
|
|
||||||
|
|
||||||
return wxSize ( wBtn , hBtn ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxToggleButton::SetValue(bool val)
|
void wxToggleButton::SetValue(bool val)
|
||||||
{
|
{
|
||||||
GetPeer()->SetValue( val ) ;
|
GetPeer()->SetValue( val ) ;
|
||||||
@@ -143,17 +131,5 @@ bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxBitmapToggleButton::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
if (!GetBitmap().IsOk())
|
|
||||||
return wxSize(20,20);
|
|
||||||
|
|
||||||
wxSize best;
|
|
||||||
best.x = GetBitmap().GetWidth() + 2 * m_marginX;
|
|
||||||
best.y = GetBitmap().GetHeight() + 2 * m_marginY;
|
|
||||||
|
|
||||||
return best;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_TOGGLEBTN
|
#endif // wxUSE_TOGGLEBTN
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user