X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9d522606d0a1dfd22bcdc1a386b3dca01fa985e3..76840ed0db0051fc64de37911250bd5ce4d4a350:/src/gtk1/tglbtn.cpp diff --git a/src/gtk1/tglbtn.cpp b/src/gtk1/tglbtn.cpp index d8aac966f6..973299339a 100644 --- a/src/gtk1/tglbtn.cpp +++ b/src/gtk1/tglbtn.cpp @@ -7,7 +7,7 @@ // Created: 08.02.01 // RCS-ID: $Id$ // Copyright: (c) 2000 Johnny C. Norris II -// License: Rocketeer license +// License: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". @@ -123,6 +123,7 @@ void wxToggleBitmapButton::SetLabel(const wxBitmap& label) wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button")); m_bitmap = label; + InvalidateBestSize(); OnSetBitmap(); } @@ -159,11 +160,10 @@ bool wxToggleBitmapButton::Enable(bool enable /*=TRUE*/) return TRUE; } -void wxToggleBitmapButton::ApplyWidgetStyle() +void wxToggleBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style) { - SetWidgetStyle(); - gtk_widget_set_style(m_widget, m_widgetStyle); - gtk_widget_set_style(BUTTON_CHILD(m_widget), m_widgetStyle); + gtk_widget_modify_style(m_widget, style); + gtk_widget_modify_style(BUTTON_CHILD(m_widget), style); } bool wxToggleBitmapButton::IsOwnGtkWindow(GdkWindow *window) @@ -193,7 +193,7 @@ void wxToggleBitmapButton::OnInternalIdle() UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } -// wxSize DoGetBestSize() const + // Get the "best" size for this control. wxSize wxToggleBitmapButton::DoGetBestSize() const { @@ -205,6 +205,7 @@ wxSize wxToggleBitmapButton::DoGetBestSize() const best.x = m_bitmap.GetWidth()+border; best.y = m_bitmap.GetHeight()+border; } + CacheBestSize(best); return best; } @@ -300,11 +301,10 @@ bool wxToggleButton::Enable(bool enable /*=TRUE*/) return TRUE; } -void wxToggleButton::ApplyWidgetStyle() +void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style) { - SetWidgetStyle(); - gtk_widget_set_style(m_widget, m_widgetStyle); - gtk_widget_set_style(BUTTON_CHILD(m_widget), m_widgetStyle); + gtk_widget_modify_style(m_widget, style); + gtk_widget_modify_style(BUTTON_CHILD(m_widget), style); } bool wxToggleButton::IsOwnGtkWindow(GdkWindow *window) @@ -334,7 +334,7 @@ void wxToggleButton::OnInternalIdle() UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } -// wxSize DoGetBestSize() const + // Get the "best" size for this control. wxSize wxToggleButton::DoGetBestSize() const { @@ -345,8 +345,8 @@ wxSize wxToggleButton::DoGetBestSize() const if (ret.x < 80) ret.x = 80; } - - return ret; + CacheBestSize(ret); + return ret; } // static