- wxString label = wxGetWindowText(GetHWND());
- int wBtn;
- GetTextExtent(GetLabelText(label), &wBtn, NULL);
-
- int wChar, hChar;
- wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont());
-
- // add a margin - the button is wider than just its label
- wBtn += 3*wChar;
-
- // the button height is proportional to the height of the font used
- int hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hChar);
-
-#if wxUSE_BUTTON
- // make all buttons of at least standard size unless wxBU_EXACTFIT is given
- if ( !HasFlag(wxBU_EXACTFIT) )
- {
- const wxSize szMin = wxButton::GetDefaultSize();
- if ( wBtn < szMin.x )
- wBtn = szMin.x;
- if ( hBtn < szMin.y )
- hBtn = szMin.y;
- }
-#endif // wxUSE_BUTTON
-
- wxSize sz(wBtn, hBtn);
-
- CacheBestSize(sz);
- return sz;
+ return wxMSWButton::ComputeBestSize(wx_const_cast(wxToggleButton *, this));
+}
+
+void wxToggleButton::SetLabel(const wxString& label)
+{
+ wxMSWButton::UpdateMultilineStyle(GetHwnd(), label);
+
+ wxToggleButtonBase::SetLabel(label);