| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: slider.h |
| 3 | // Purpose: wxSlider class |
| 4 | // Author: Julian Smart |
| 5 | // Modified by: |
| 6 | // Created: 17/09/98 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_SLIDER_H_ |
| 13 | #define _WX_SLIDER_H_ |
| 14 | |
| 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
| 16 | #pragma interface "slider.h" |
| 17 | #endif |
| 18 | |
| 19 | #include "wx/control.h" |
| 20 | |
| 21 | // Slider |
| 22 | class WXDLLEXPORT wxSlider: public wxSliderBase |
| 23 | { |
| 24 | DECLARE_DYNAMIC_CLASS(wxSlider) |
| 25 | |
| 26 | public: |
| 27 | wxSlider(); |
| 28 | |
| 29 | wxSlider(wxWindow *parent, wxWindowID id, |
| 30 | int value, int minValue, int maxValue, |
| 31 | const wxPoint& pos = wxDefaultPosition, |
| 32 | const wxSize& size = wxDefaultSize, |
| 33 | long style = wxSL_HORIZONTAL, |
| 34 | const wxValidator& validator = wxDefaultValidator, |
| 35 | const wxString& name = wxSliderNameStr) |
| 36 | { |
| 37 | Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); |
| 38 | } |
| 39 | |
| 40 | ~wxSlider(); |
| 41 | |
| 42 | bool Create(wxWindow *parent, wxWindowID id, |
| 43 | int value, int minValue, int maxValue, |
| 44 | const wxPoint& pos = wxDefaultPosition, |
| 45 | const wxSize& size = wxDefaultSize, |
| 46 | long style = wxSL_HORIZONTAL, |
| 47 | const wxValidator& validator = wxDefaultValidator, |
| 48 | const wxString& name = wxSliderNameStr); |
| 49 | |
| 50 | virtual int GetValue() const ; |
| 51 | virtual void SetValue(int); |
| 52 | |
| 53 | void SetRange(int minValue, int maxValue); |
| 54 | |
| 55 | inline int GetMin() const { return m_rangeMin; } |
| 56 | inline int GetMax() const { return m_rangeMax; } |
| 57 | |
| 58 | // For trackbars only |
| 59 | void SetPageSize(int pageSize); |
| 60 | int GetPageSize() const ; |
| 61 | void SetLineSize(int lineSize); |
| 62 | int GetLineSize() const ; |
| 63 | void SetThumbLength(int len) ; |
| 64 | int GetThumbLength() const ; |
| 65 | |
| 66 | void Command(wxCommandEvent& event); |
| 67 | |
| 68 | protected: |
| 69 | int m_rangeMin; |
| 70 | int m_rangeMax; |
| 71 | int m_pageSize; |
| 72 | int m_lineSize; |
| 73 | |
| 74 | virtual void DoSetSize(int x, int y, |
| 75 | int width, int height, |
| 76 | int sizeFlags = wxSIZE_AUTO); |
| 77 | |
| 78 | private: |
| 79 | DECLARE_EVENT_TABLE() |
| 80 | }; |
| 81 | |
| 82 | #endif |
| 83 | // _WX_SLIDER_H_ |