]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/slider.cpp
delay setting the window shape until it is realized (slightly modified patch 1935497)
[wxWidgets.git] / src / gtk1 / slider.cpp
index 6f37e772225bb8e75b9367fb4c3fb8f80a8fd057..f704d408170fd600286c4482404cc88b02d16a44 100644 (file)
@@ -16,9 +16,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
+    #include "wx/math.h"
 #endif
 
-#include "wx/math.h"
 #include "wx/gtk1/private.h"
 
 //-----------------------------------------------------------------------------
@@ -44,13 +44,6 @@ static inline bool AreSameAdjustValues(double x, double y)
     return fabs(x - y) < 0.02;
 }
 
-static inline int AdjustValueToInt(double x)
-{
-    // we want to round to the nearest integer, i.e. 0.9 is rounded to 1 and
-    // -0.9 is rounded to -1
-    return (int)(x < 0 ? x - 0.5 : x + 0.5);
-}
-
 // process a scroll event
 static void
 ProcessScrollEvent(wxSlider *win, wxEventType evtType, double dvalue)
@@ -61,19 +54,19 @@ ProcessScrollEvent(wxSlider *win, wxEventType evtType, double dvalue)
     int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5);
     wxScrollEvent event( evtType, win->GetId(), value, orient );
     event.SetEventObject( win );
-    win->GetEventHandler()->ProcessEvent( event );
+    win->HandleWindowEvent( event );
 
     if ( evtType != wxEVT_SCROLL_THUMBTRACK )
     {
         wxScrollEvent event2(wxEVT_SCROLL_CHANGED, win->GetId(), value, orient);
         event2.SetEventObject( win );
-        win->GetEventHandler()->ProcessEvent( event2 );
+        win->HandleWindowEvent( event2 );
     }
 
     wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
     cevent.SetEventObject( win );
     cevent.SetInt( value );
-    win->GetEventHandler()->ProcessEvent( cevent );
+    win->HandleWindowEvent( cevent );
 }
 
 //-----------------------------------------------------------------------------
@@ -209,7 +202,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
 
 int wxSlider::GetValue() const
 {
-    return AdjustValueToInt(m_adjust->value);
+    return wxRound(m_adjust->value);
 }
 
 void wxSlider::SetValue( int value )