]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/tglbtn.cpp
Always use XPMs in this sample
[wxWidgets.git] / src / gtk / tglbtn.cpp
index 2a913203a71f5806eb8264ec5cf18cfd71f406e1..d6f4d5881f7c6d62c47c16231e0b73e1f7168b7c 100644 (file)
@@ -10,6 +10,9 @@
 // License:     Rocketeer license
 /////////////////////////////////////////////////////////////////////////////
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #include "wx/tglbtn.h"
 #include "wx/button.h"
 
@@ -72,8 +75,7 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
    m_parent->DoAddChild(this);
 
    PostCreation();
-
-   SetFont(parent->GetFont());
+   InheritAttributes();
 
    wxSize size_best(DoGetBestSize());
    wxSize new_size(size);
@@ -84,9 +86,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
    if ((new_size.x != size.x) || (new_size.y != size.y))
       SetSize(new_size.x, new_size.y);
 
-   SetBackgroundColour(parent->GetBackgroundColour());
-   SetForegroundColour(parent->GetForegroundColour());
-
    Show(TRUE);
 
    return TRUE;
@@ -166,7 +165,8 @@ void wxToggleButton::OnInternalIdle()
         gdk_window_set_cursor(win, cursor.GetCursor());
     }
 
-    UpdateWindowUI();
+    if (wxUpdateUIEvent::CanUpdate(this))
+        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 }
 
 // wxSize DoGetBestSize() const