/////////////////////////////////////////////////////////////////////////////
-// Name: slider.h
+// Name: wx/gtk/slider.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
-// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifndef __GTKSLIDERH__
-#define __GTKSLIDERH__
+#ifndef _WX_GTK_SLIDER_H_
+#define _WX_GTK_SLIDER_H_
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include "wx/defs.h"
-
-#if wxUSE_SLIDER
-
-#include "wx/object.h"
-#include "wx/list.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxSlider;
-
-//-----------------------------------------------------------------------------
-// global data
-//-----------------------------------------------------------------------------
-
-extern const char *wxSliderNameStr;
-
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// wxSlider
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-class wxSlider: public wxControl
+class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase
{
public:
wxSlider();
- inline wxSlider( wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxSL_HORIZONTAL,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxSliderNameStr )
+ wxSlider(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr)
{
- Create( parent, id, value, minValue, maxValue, pos, size, style, validator, name );
+ Create( parent, id, value, minValue, maxValue,
+ pos, size, style, validator, name );
}
~wxSlider();
- bool Create(wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxSL_HORIZONTAL,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxSliderNameStr );
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ int value, int minValue, int maxValue,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSL_HORIZONTAL,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxSliderNameStr);
+
+ // implement the base class pure virtuals
virtual int GetValue() const;
- virtual void SetValue( int );
- void SetRange( int minValue, int maxValue );
- int GetMin() const;
- int GetMax() const;
- void SetTickFreq( int n, int pos );
- int GetTickFreq() const;
- void SetPageSize( int pageSize );
- int GetPageSize() const;
- void ClearSel();
- void ClearTicks();
- void SetLineSize( int lineSize );
- int GetLineSize() const;
- int GetSelEnd() const;
- int GetSelStart() const;
- void SetSelection( int minPos, int maxPos );
- void SetThumbLength( int len );
- int GetThumbLength() const;
- void SetTick( int tickPos );
+ virtual void SetValue(int value);
+
+ virtual void SetRange(int minValue, int maxValue);
+ virtual int GetMin() const;
+ virtual int GetMax() const;
+
+ virtual void SetLineSize(int lineSize);
+ virtual void SetPageSize(int pageSize);
+ virtual int GetLineSize() const;
+ virtual int GetPageSize() const;
+
+ virtual void SetThumbLength(int lenPixels);
+ virtual int GetThumbLength() const;
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// implementation
- // --------------
+ void GTKDisableEvents();
+ void GTKEnableEvents();
+ bool GTKEventsDisabled() const;
+
+ double m_pos;
+ int m_scrollEventType;
+ bool m_needThumbRelease;
+ GtkWidget *m_scale;
- bool IsOwnGtkWindow( GdkWindow *window );
- void ApplyWidgetStyle();
+protected:
+ GtkWidget *m_minLabel,*m_maxLabel;
+ bool m_blockScrollEvent;
- GtkAdjustment *m_adjust;
- float m_oldPos;
+ virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+ // set the slider value unconditionally
+ void GTKSetValue(int value);
-private:
DECLARE_DYNAMIC_CLASS(wxSlider)
};
-#endif
-
-#endif // __GTKSLIDERH__
+#endif // _WX_GTK_SLIDER_H_