| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: slider.h |
| 3 | // Purpose: |
| 4 | // Author: Robert Roebling |
| 5 | // Id: $Id$ |
| 6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | #ifndef __GTKSLIDERH__ |
| 11 | #define __GTKSLIDERH__ |
| 12 | |
| 13 | #ifdef __GNUG__ |
| 14 | #pragma interface |
| 15 | #endif |
| 16 | |
| 17 | #include "wx/defs.h" |
| 18 | |
| 19 | #if wxUSE_SLIDER |
| 20 | |
| 21 | #include "wx/object.h" |
| 22 | #include "wx/list.h" |
| 23 | #include "wx/control.h" |
| 24 | |
| 25 | //----------------------------------------------------------------------------- |
| 26 | // classes |
| 27 | //----------------------------------------------------------------------------- |
| 28 | |
| 29 | class wxSlider; |
| 30 | |
| 31 | //----------------------------------------------------------------------------- |
| 32 | // global data |
| 33 | //----------------------------------------------------------------------------- |
| 34 | |
| 35 | extern const char *wxSliderNameStr; |
| 36 | |
| 37 | //----------------------------------------------------------------------------- |
| 38 | // wxSlider |
| 39 | //----------------------------------------------------------------------------- |
| 40 | |
| 41 | class wxSlider: public wxControl |
| 42 | { |
| 43 | public: |
| 44 | wxSlider() {} |
| 45 | inline wxSlider( wxWindow *parent, wxWindowID id, |
| 46 | int value, int minValue, int maxValue, |
| 47 | const wxPoint& pos = wxDefaultPosition, |
| 48 | const wxSize& size = wxDefaultSize, |
| 49 | long style = wxSL_HORIZONTAL, |
| 50 | const wxValidator& validator = wxDefaultValidator, |
| 51 | const wxString& name = wxSliderNameStr ) |
| 52 | { |
| 53 | Create( parent, id, value, minValue, maxValue, pos, size, style, validator, name ); |
| 54 | } |
| 55 | bool Create(wxWindow *parent, wxWindowID id, |
| 56 | int value, int minValue, int maxValue, |
| 57 | const wxPoint& pos = wxDefaultPosition, |
| 58 | const wxSize& size = wxDefaultSize, |
| 59 | long style = wxSL_HORIZONTAL, |
| 60 | const wxValidator& validator = wxDefaultValidator, |
| 61 | const wxString& name = wxSliderNameStr ); |
| 62 | virtual int GetValue() const; |
| 63 | virtual void SetValue( int ); |
| 64 | void SetRange( int minValue, int maxValue ); |
| 65 | int GetMin() const; |
| 66 | int GetMax() const; |
| 67 | void SetTickFreq( int n, int pos ); |
| 68 | int GetTickFreq() const; |
| 69 | void SetPageSize( int pageSize ); |
| 70 | int GetPageSize() const; |
| 71 | void ClearSel(); |
| 72 | void ClearTicks(); |
| 73 | void SetLineSize( int lineSize ); |
| 74 | int GetLineSize() const; |
| 75 | int GetSelEnd() const; |
| 76 | int GetSelStart() const; |
| 77 | void SetSelection( int minPos, int maxPos ); |
| 78 | void SetThumbLength( int len ); |
| 79 | int GetThumbLength() const; |
| 80 | void SetTick( int tickPos ); |
| 81 | |
| 82 | // implementation |
| 83 | // -------------- |
| 84 | |
| 85 | bool IsOwnGtkWindow( GdkWindow *window ); |
| 86 | void ApplyWidgetStyle(); |
| 87 | |
| 88 | GtkAdjustment *m_adjust; |
| 89 | float m_oldPos; |
| 90 | |
| 91 | private: |
| 92 | DECLARE_DYNAMIC_CLASS(wxSlider) |
| 93 | }; |
| 94 | |
| 95 | #endif |
| 96 | |
| 97 | #endif // __GTKSLIDERH__ |