]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/slider.cpp
cleanup - reformatting; simplified OnPaint
[wxWidgets.git] / src / gtk / slider.cpp
index ba70dee2571c45dbd2615b077e67d7ed2d5ff5b6..42de0259367c19ac8779e41bd4ba7303884ed6a5 100644 (file)
@@ -79,7 +79,6 @@ ProcessScrollEvent(wxSlider *win, wxEventType evtType, double dvalue)
 
 extern "C" {
 static void gtk_slider_callback( GtkAdjustment *adjust,
 
 extern "C" {
 static void gtk_slider_callback( GtkAdjustment *adjust,
-                                 SCROLLBAR_CBACK_ARG
                                  wxSlider *win )
 {
     if (g_isIdle) wxapp_install_idle_handler();
                                  wxSlider *win )
 {
     if (g_isIdle) wxapp_install_idle_handler();
@@ -93,7 +92,6 @@ static void gtk_slider_callback( GtkAdjustment *adjust,
         return;
 
     wxEventType evtType;
         return;
 
     wxEventType evtType;
-#ifdef __WXGTK20__
     if ( win->m_isScrolling )
         evtType = wxEVT_SCROLL_THUMBTRACK;
     // it could seem that UP/DOWN are inversed but this is what wxMSW does
     if ( win->m_isScrolling )
         evtType = wxEVT_SCROLL_THUMBTRACK;
     // it could seem that UP/DOWN are inversed but this is what wxMSW does
@@ -109,9 +107,6 @@ static void gtk_slider_callback( GtkAdjustment *adjust,
         evtType = wxEVT_SCROLL_TOP;
     else if ( AreSameAdjustValues(adjust->value, adjust->upper) )
         evtType = wxEVT_SCROLL_BOTTOM;
         evtType = wxEVT_SCROLL_TOP;
     else if ( AreSameAdjustValues(adjust->value, adjust->upper) )
         evtType = wxEVT_SCROLL_BOTTOM;
-#else
-    evtType = GtkScrollTypeToWx(GET_SCROLL_TYPE(win->m_widget));
-#endif
 
     ProcessScrollEvent(win, evtType, dvalue);
 
 
     ProcessScrollEvent(win, evtType, dvalue);
 
@@ -202,20 +197,16 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
 
     m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
 
 
     m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
 
-#ifdef __WXGTK20__
     if (style & wxSL_INVERSE)
         gtk_range_set_inverted( GTK_RANGE(m_widget), TRUE );
     if (style & wxSL_INVERSE)
         gtk_range_set_inverted( GTK_RANGE(m_widget), TRUE );
-#endif
 
     GtkEnableEvents();
 
     GtkEnableEvents();
-    gtk_signal_connect( GTK_OBJECT(m_widget),
-                        "button_press_event",
-                        (GtkSignalFunc)gtk_slider_button_press_callback,
-                        (gpointer) this );
-    gtk_signal_connect( GTK_OBJECT(m_widget),
-                        "button_release_event",
-                        (GtkSignalFunc)gtk_slider_button_release_callback,
-                        (gpointer) this );
+    g_signal_connect (m_widget, "button_press_event",
+                      G_CALLBACK (gtk_slider_button_press_callback),
+                      this);
+    g_signal_connect (m_widget, "button_release_event",
+                      G_CALLBACK (gtk_slider_button_release_callback),
+                      this);
 
     SetRange( minValue, maxValue );
     SetValue( value );
 
     SetRange( minValue, maxValue );
     SetValue( value );
@@ -243,7 +234,7 @@ void wxSlider::SetValue( int value )
 
     GtkDisableEvents();
 
 
     GtkDisableEvents();
 
-    gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
+    g_signal_emit_by_name (m_adjust, "value_changed");
 
     GtkEnableEvents();
 }
 
     GtkEnableEvents();
 }
@@ -266,7 +257,7 @@ void wxSlider::SetRange( int minValue, int maxValue )
 
     GtkDisableEvents();
 
 
     GtkDisableEvents();
 
-    gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+    g_signal_emit_by_name (m_adjust, "changed");
 
     GtkEnableEvents();
 }
 
     GtkEnableEvents();
 }
@@ -291,7 +282,7 @@ void wxSlider::SetPageSize( int pageSize )
 
     GtkDisableEvents();
 
 
     GtkDisableEvents();
 
-    gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+    g_signal_emit_by_name (m_adjust, "changed");
 
     GtkEnableEvents();
 }
 
     GtkEnableEvents();
 }
@@ -311,7 +302,7 @@ void wxSlider::SetThumbLength( int len )
 
     GtkDisableEvents();
 
 
     GtkDisableEvents();
 
-    gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+    g_signal_emit_by_name (m_adjust, "changed");
 
     GtkEnableEvents();
 }
 
     GtkEnableEvents();
 }
@@ -333,30 +324,20 @@ int wxSlider::GetLineSize() const
 bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
 {
     GtkRange *range = GTK_RANGE(m_widget);
 bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
 {
     GtkRange *range = GTK_RANGE(m_widget);
-#ifdef __WXGTK20__
     return (range->event_window == window);
     return (range->event_window == window);
-#else
-    return ( (window == GTK_WIDGET(range)->window)
-                || (window == range->trough)
-                || (window == range->slider)
-                || (window == range->step_forw)
-                || (window == range->step_back) );
-#endif
 }
 
 void wxSlider::GtkDisableEvents()
 {
 }
 
 void wxSlider::GtkDisableEvents()
 {
-    gtk_signal_disconnect_by_func( GTK_OBJECT(m_adjust),
-                        GTK_SIGNAL_FUNC(gtk_slider_callback),
-                        (gpointer) this );
+    g_signal_handlers_disconnect_by_func (m_adjust,
+                                          (gpointer) gtk_slider_callback,
+                                          this);
 }
 
 void wxSlider::GtkEnableEvents()
 {
 }
 
 void wxSlider::GtkEnableEvents()
 {
-    gtk_signal_connect( GTK_OBJECT (m_adjust),
-                        "value_changed",
-                        GTK_SIGNAL_FUNC(gtk_slider_callback),
-                        (gpointer) this );
+    g_signal_connect (m_adjust, "value_changed",
+                      G_CALLBACK (gtk_slider_callback), this);
 }
 
 // static
 }
 
 // static