X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e1b93ccbdce1d7b757f6d6180b710214e6277a00..9c112555198f51fcec71106530cddba95a17f3dc:/src/gtk1/slider.cpp diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index 07bc86620d..c5d5be31fe 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -7,18 +7,19 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "slider.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/slider.h" #if wxUSE_SLIDER #include "wx/utils.h" - -#include - +#include "wx/math.h" #include "wx/gtk/private.h" //----------------------------------------------------------------------------- @@ -40,6 +41,7 @@ static const float sensitivity = 0.02; // "value_changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_slider_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxSlider *win ) @@ -71,6 +73,7 @@ static void gtk_slider_callback( GtkAdjustment *adjust, cevent.SetInt( value ); win->GetEventHandler()->ProcessEvent( cevent ); } +} //----------------------------------------------------------------------------- // wxSlider @@ -131,18 +134,19 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) ); - SetRange( minValue, maxValue ); - SetValue( value ); +#ifdef __WXGTK20__ + if (style & wxSL_INVERSE) + gtk_range_set_inverted( GTK_RANGE(m_widget), TRUE ); +#endif GtkEnableEvents(); - m_parent->DoAddChild( this ); - - PostCreation(); + SetRange( minValue, maxValue ); + SetValue( value ); - SetBackgroundColour( parent->GetBackgroundColour() ); + m_parent->DoAddChild( this ); - Show( TRUE ); + PostCreation(size); return TRUE; } @@ -255,20 +259,15 @@ int wxSlider::GetLineSize() const bool wxSlider::IsOwnGtkWindow( GdkWindow *window ) { GtkRange *range = GTK_RANGE(m_widget); +#ifdef __WXGTK20__ + return (range->event_window == window); +#else return ( (window == GTK_WIDGET(range)->window) -#ifndef __WXGTK20__ || (window == range->trough) || (window == range->slider) || (window == range->step_forw) - || (window == range->step_back) -#endif // GTK+ 1.x - ); -} - -void wxSlider::ApplyWidgetStyle() -{ - SetWidgetStyle(); - gtk_widget_set_style( m_widget, m_widgetStyle ); + || (window == range->step_back) ); +#endif } void wxSlider::GtkDisableEvents() @@ -286,4 +285,11 @@ void wxSlider::GtkEnableEvents() (gpointer) this ); } +// static +wxVisualAttributes +wxSlider::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ + return GetDefaultAttributesFromGTKWidget(gtk_vscale_new); +} + #endif