X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0e6c0513862fc9a33e5800526058193b7492d8b..caa2490c0fb8053b1d416117a9619695d75af9e4:/src/gtk1/tglbtn.cpp diff --git a/src/gtk1/tglbtn.cpp b/src/gtk1/tglbtn.cpp index 8ac7ec5a3c..1bf01efef7 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". @@ -26,6 +26,7 @@ extern bool g_blockEventsOnDrag; extern wxCursor g_globalCursor; extern wxWindowGTK *g_delayedFocus; +extern "C" { static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb) { if (g_isIdle) @@ -42,6 +43,7 @@ static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxTog event.SetEventObject(cb); cb->GetEventHandler()->ProcessEvent(event); } +} DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) @@ -123,6 +125,7 @@ void wxToggleBitmapButton::SetLabel(const wxBitmap& label) wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button")); m_bitmap = label; + InvalidateBestSize(); OnSetBitmap(); } @@ -192,7 +195,7 @@ void wxToggleBitmapButton::OnInternalIdle() UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } -// wxSize DoGetBestSize() const + // Get the "best" size for this control. wxSize wxToggleBitmapButton::DoGetBestSize() const { @@ -204,6 +207,7 @@ wxSize wxToggleBitmapButton::DoGetBestSize() const best.x = m_bitmap.GetWidth()+border; best.y = m_bitmap.GetHeight()+border; } + CacheBestSize(best); return best; } @@ -332,7 +336,7 @@ void wxToggleButton::OnInternalIdle() UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } -// wxSize DoGetBestSize() const + // Get the "best" size for this control. wxSize wxToggleButton::DoGetBestSize() const { @@ -343,8 +347,8 @@ wxSize wxToggleButton::DoGetBestSize() const if (ret.x < 80) ret.x = 80; } - - return ret; + CacheBestSize(ret); + return ret; } // static