| 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 | #include "wx/object.h" |
| 19 | #include "wx/list.h" |
| 20 | #include "wx/control.h" |
| 21 | |
| 22 | //----------------------------------------------------------------------------- |
| 23 | // classes |
| 24 | //----------------------------------------------------------------------------- |
| 25 | |
| 26 | class wxSlider; |
| 27 | |
| 28 | //----------------------------------------------------------------------------- |
| 29 | // global data |
| 30 | //----------------------------------------------------------------------------- |
| 31 | |
| 32 | extern const char *wxSliderNameStr; |
| 33 | |
| 34 | //----------------------------------------------------------------------------- |
| 35 | // wxSlider |
| 36 | //----------------------------------------------------------------------------- |
| 37 | |
| 38 | class wxSlider: public wxControl |
| 39 | { |
| 40 | DECLARE_DYNAMIC_CLASS(wxSlider) |
| 41 | |
| 42 | public: |
| 43 | wxSlider(void); |
| 44 | inline wxSlider( wxWindow *parent, wxWindowID id, |
| 45 | int value, int minValue, int maxValue, |
| 46 | const wxPoint& pos = wxDefaultPosition, |
| 47 | const wxSize& size = wxDefaultSize, |
| 48 | long style = wxSL_HORIZONTAL, |
| 49 | const wxValidator& validator = wxDefaultValidator, |
| 50 | const wxString& name = wxSliderNameStr ) |
| 51 | { |
| 52 | Create( parent, id, value, minValue, maxValue, pos, size, style, validator, name ); |
| 53 | } |
| 54 | ~wxSlider(void); |
| 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(void) const; |
| 63 | virtual void SetValue( int ); |
| 64 | void SetRange( int minValue, int maxValue ); |
| 65 | int GetMin(void) const; |
| 66 | int GetMax(void) const; |
| 67 | void SetTickFreq( int n, int pos ); |
| 68 | int GetTickFreq(void) const; |
| 69 | void SetPageSize( int pageSize ); |
| 70 | int GetPageSize(void) const; |
| 71 | void ClearSel(void); |
| 72 | void ClearTicks(void); |
| 73 | void SetLineSize( int lineSize ); |
| 74 | int GetLineSize(void) const; |
| 75 | int GetSelEnd(void) const; |
| 76 | int GetSelStart(void) const; |
| 77 | void SetSelection( int minPos, int maxPos ); |
| 78 | void SetThumbLength( int len ); |
| 79 | int GetThumbLength(void) const; |
| 80 | void SetTick( int tickPos ); |
| 81 | |
| 82 | // implementation |
| 83 | |
| 84 | bool IsOwnGtkWindow( GdkWindow *window ); |
| 85 | void ApplyWidgetStyle(); |
| 86 | |
| 87 | GtkAdjustment *m_adjust; |
| 88 | float m_oldPos; |
| 89 | |
| 90 | }; |
| 91 | |
| 92 | #endif // __GTKSLIDERH__ |