X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3cbab64109b007fa1d939fe588f5e79f9105b915..1c0338c5615c351371f704b326634f58d0bf7da9:/src/gtk1/slider.cpp diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index 594d0ae265..e0070f21ed 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: gtk/slider.cpp +// Name: src/gtk1/slider.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -10,12 +10,15 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#if wxUSE_SLIDER + #include "wx/slider.h" -#if wxUSE_SLIDER +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/math.h" +#endif -#include "wx/utils.h" -#include "wx/math.h" #include "wx/gtk1/private.h" //----------------------------------------------------------------------------- @@ -41,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) @@ -136,14 +132,14 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) { - m_acceptsFocus = TRUE; - m_needParent = TRUE; + m_acceptsFocus = true; + m_needParent = true; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxSlider creation failed") ); - return FALSE; + return false; } m_oldPos = 0.0; @@ -201,12 +197,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, PostCreation(size); - return TRUE; + return true; } int wxSlider::GetValue() const { - return AdjustValueToInt(m_adjust->value); + return wxRound(m_adjust->value); } void wxSlider::SetValue( int value ) @@ -339,4 +335,4 @@ wxSlider::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) return GetDefaultAttributesFromGTKWidget(gtk_vscale_new); } -#endif +#endif // wxUSE_SLIDER