]> git.saurik.com Git - wxWidgets.git/commitdiff
simplify Enable()
authorPaul Cornett <paulcor@bullseye.com>
Sat, 5 Dec 2009 19:25:04 +0000 (19:25 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Sat, 5 Dec 2009 19:25:04 +0000 (19:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/button.h
include/wx/gtk/checkbox.h
include/wx/gtk/radiobut.h
include/wx/gtk/spinbutt.h
include/wx/gtk/tglbtn.h
src/gtk/button.cpp
src/gtk/checkbox.cpp
src/gtk/radiobox.cpp
src/gtk/radiobut.cpp
src/gtk/spinbutt.cpp
src/gtk/tglbtn.cpp

index 2b7f9a0278751e20713250fc0553a6a6d9b2be68..7d1e5847a1afc79be2435897c37246243272a77d 100644 (file)
@@ -68,6 +68,8 @@ protected:
     virtual void DoSetBitmapPosition(wxDirection dir);
 
 private:
+    typedef wxButtonBase base_type;
+
     // common part of all ctors
     void Init()
     {
@@ -89,7 +91,6 @@ private:
     // show the given bitmap (must be valid)
     void GTKDoShowBitmap(const wxBitmap& bitmap);
 
-
     // the bitmaps for the different state of the buttons, all of them may be
     // invalid and the button only shows a bitmap at all if State_Normal bitmap
     // is valid
@@ -101,7 +102,6 @@ private:
     // true iff the button is in pressed state
     bool m_isPressed;
 
-
     DECLARE_DYNAMIC_CLASS(wxButton)
 };
 
index 5ae9c7fb473e16e3b200ae0e8dc11d3a11c3a0bc..a3631debaf62d8127a70e8a6734f1ca21345772c 100644 (file)
@@ -44,6 +44,10 @@ public:
     static wxVisualAttributes
     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
+    // implementation
+    void GTKDisableEvents();
+    void GTKEnableEvents();
+
 protected:
     virtual wxSize DoGetBestSize() const;
     virtual void DoApplyWidgetStyle(GtkRcStyle *style);
@@ -52,15 +56,12 @@ protected:
     void DoSet3StateValue(wxCheckBoxState state);
     wxCheckBoxState DoGet3StateValue() const;
 
-public:
-    // implementation
-    void GTKDisableEvents();
-    void GTKEnableEvents();
+private:
+    typedef wxCheckBoxBase base_type;
 
     GtkWidget *m_widgetCheckbox;
     GtkWidget *m_widgetLabel;
 
-private:
     DECLARE_DYNAMIC_CLASS(wxCheckBox)
 };
 
index 2ee6a490853f8e6caed499d103c3d9fec5d4e627..e1a1d6275e1703f87407dcace800494c19120110 100644 (file)
@@ -53,6 +53,9 @@ protected:
     virtual void DoApplyWidgetStyle(GtkRcStyle *style);
     virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
 
+private:
+    typedef wxControl base_type;
+
     DECLARE_DYNAMIC_CLASS(wxRadioButton)
 };
 
index c9d3bc31ed1afc2b901af97b1bfae43deec0d486..7f2f323d23362e4c16f39b5ba6d7473300cbf81e 100644 (file)
@@ -60,6 +60,8 @@ protected:
     virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
 
 private:
+    typedef wxSpinButtonBase base_type;
+
     DECLARE_EVENT_TABLE()
     DECLARE_DYNAMIC_CLASS(wxSpinButton)
 };
index 583ba88619b73c64801fd4034fb974636cd86ac7..aa75f3898c65f7677205784d4ed698065450d0df 100644 (file)
@@ -84,6 +84,8 @@ protected:
     virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
 
 private:
+    typedef wxToggleButtonBase base_type;
+
     DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
 };
 
@@ -137,6 +139,8 @@ protected:
     virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
 
 private:
+    typedef wxToggleButtonBase base_type;
+
     DECLARE_DYNAMIC_CLASS(wxToggleButton)
 };
 
index 2ce3e1d0a1460bec6ead071c4d8cc4223ce4e520..8fe4d861bb69e1997da6f0e2032890311d4aa734 100644 (file)
@@ -266,17 +266,13 @@ void wxButton::SetLabel( const wxString &lbl )
 
 bool wxButton::Enable( bool enable )
 {
-    bool isEnabled = IsEnabled();
-
-    if ( !wxControl::Enable( enable ) )
+    if (!base_type::Enable(enable))
         return false;
 
     gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
 
-    if (!isEnabled && enable)
-    {
+    if (enable)
         GTKFixSensitivity();
-    }
 
     GTKUpdateBitmap();
 
index 82606be7ffda18fb9c6874a8b30b37fc9caf0a27..f4d79dde3e091de399a0d14e55a0c0fee291320d 100644 (file)
@@ -217,17 +217,13 @@ void wxCheckBox::SetLabel( const wxString& label )
 
 bool wxCheckBox::Enable( bool enable )
 {
-    bool isEnabled = IsEnabled();
-
-    if ( !wxControl::Enable( enable ) )
+    if (!base_type::Enable(enable))
         return false;
 
     gtk_widget_set_sensitive( m_widgetLabel, enable );
 
-    if (!isEnabled && enable)
-    {
+    if (enable)
         GTKFixSensitivity();
-    }
 
     return true;
 }
index a0e73a219d71ed668a47f6ed9b7b20435782d753..08368f2459367ed419a7a2e6d40b1fd9243c4444 100644 (file)
@@ -428,8 +428,6 @@ void wxRadioBox::SetString(unsigned int item, const wxString& label)
 
 bool wxRadioBox::Enable( bool enable )
 {
-    bool isEnabled = IsEnabled();
-
     if ( !wxControl::Enable( enable ) )
         return false;
 
@@ -444,10 +442,8 @@ bool wxRadioBox::Enable( bool enable )
         node = node->GetNext();
     }
 
-    if (!isEnabled && enable)
-    {
+    if (enable)
         GTKFixSensitivity();
-    }
 
     return true;
 }
index 779c22e58de928d1672e01911e58b95e466f2357..d2c5f73cfee57f8bb905d8d363285db4b9521aa7 100644 (file)
@@ -138,17 +138,13 @@ bool wxRadioButton::GetValue() const
 
 bool wxRadioButton::Enable( bool enable )
 {
-    bool isEnabled = IsEnabled();
-
-    if ( !wxControl::Enable( enable ) )
+    if (!base_type::Enable(enable))
         return false;
 
     gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
 
-    if (!isEnabled && enable)
-    {
+    if (enable)
         GTKFixSensitivity();
-    }
 
     return true;
 }
index 4ed8250624845a2774a879dd78c111ffc691d9c1..9155e23d3f1e6c8ad48fcaac207e8e0d74682ceb 100644 (file)
@@ -177,13 +177,11 @@ void wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) )
 
 bool wxSpinButton::Enable( bool enable )
 {
-    bool isEnabled = IsEnabled();
-
-    if ( !wxControl::Enable( enable ) )
+    if (!base_type::Enable(enable))
         return false;
 
     // Work around lack of visual update when enabling
-    if (!isEnabled && enable)
+    if (enable)
         GTKFixSensitivity(false /* fix even if not under mouse */);
 
     return true;
index 503382712c93c4b9e1328268a42c6b1d9e1470f2..8e33e7f6d90f743edbe36f8b12d7e772ad3a1b7e 100644 (file)
@@ -285,17 +285,13 @@ void wxToggleButton::SetLabel(const wxString& label)
 
 bool wxToggleButton::Enable(bool enable /*=true*/)
 {
-    bool isEnabled = IsEnabled();
-
-    if (!wxControl::Enable(enable))
+    if (!base_type::Enable(enable))
         return false;
 
     gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
 
-    if (!isEnabled && enable)
-    {
+    if (enable)
         GTKFixSensitivity();
-    }
 
     return true;
 }