| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: slider.h |
| 3 | // Purpose: wxSlider class |
| 4 | // Author: Stefan Csomor |
| 5 | // Modified by: |
| 6 | // Created: 1998-01-01 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Stefan Csomor |
| 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 | #include "wx/slider.h" |
| 21 | #include "wx/stattext.h" |
| 22 | |
| 23 | WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr; |
| 24 | |
| 25 | // Slider |
| 26 | class WXDLLEXPORT wxSlider: public wxControl |
| 27 | { |
| 28 | DECLARE_DYNAMIC_CLASS(wxSlider) |
| 29 | |
| 30 | public: |
| 31 | wxSlider(); |
| 32 | |
| 33 | inline wxSlider(wxWindow *parent, wxWindowID id, |
| 34 | int value, int minValue, int maxValue, |
| 35 | const wxPoint& pos = wxDefaultPosition, |
| 36 | const wxSize& size = wxDefaultSize, |
| 37 | long style = wxSL_HORIZONTAL, |
| 38 | const wxValidator& validator = wxDefaultValidator, |
| 39 | const wxString& name = wxSliderNameStr) |
| 40 | { |
| 41 | Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); |
| 42 | } |
| 43 | |
| 44 | ~wxSlider(); |
| 45 | |
| 46 | bool Create(wxWindow *parent, wxWindowID id, |
| 47 | int value, int minValue, int maxValue, |
| 48 | const wxPoint& pos = wxDefaultPosition, |
| 49 | const wxSize& size = wxDefaultSize, |
| 50 | long style = wxSL_HORIZONTAL, |
| 51 | const wxValidator& validator = wxDefaultValidator, |
| 52 | const wxString& name = wxSliderNameStr); |
| 53 | |
| 54 | virtual int GetValue() const ; |
| 55 | virtual void SetValue(int); |
| 56 | |
| 57 | void SetRange(int minValue, int maxValue); |
| 58 | |
| 59 | inline int GetMin() const { return m_rangeMin; } |
| 60 | inline int GetMax() const { return m_rangeMax; } |
| 61 | |
| 62 | // For trackbars only |
| 63 | void SetTickFreq(int n, int pos); |
| 64 | inline int GetTickFreq() const { return m_tickFreq; } |
| 65 | void SetPageSize(int pageSize); |
| 66 | int GetPageSize() const ; |
| 67 | void ClearSel() ; |
| 68 | void ClearTicks() ; |
| 69 | void SetLineSize(int lineSize); |
| 70 | int GetLineSize() const ; |
| 71 | int GetSelEnd() const ; |
| 72 | int GetSelStart() const ; |
| 73 | void SetSelection(int minPos, int maxPos); |
| 74 | void SetThumbLength(int len) ; |
| 75 | int GetThumbLength() const ; |
| 76 | void SetTick(int tickPos) ; |
| 77 | |
| 78 | |
| 79 | // set min/max size of the slider |
| 80 | virtual void SetSizeHints( int minW, int minH, |
| 81 | int maxW = -1, int maxH = -1, |
| 82 | int incW = -1, int incH = -1 ); |
| 83 | |
| 84 | protected: |
| 85 | virtual wxSize DoGetBestSize() const; |
| 86 | virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags); |
| 87 | virtual void DoMoveWindow(int x, int y, int w, int h); |
| 88 | |
| 89 | void Command(wxCommandEvent& event); |
| 90 | void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; |
| 91 | virtual void MacUpdateDimensions() ; |
| 92 | |
| 93 | wxStaticText* m_macMinimumStatic ; |
| 94 | wxStaticText* m_macMaximumStatic ; |
| 95 | wxStaticText* m_macValueStatic ; |
| 96 | |
| 97 | int m_rangeMin; |
| 98 | int m_rangeMax; |
| 99 | int m_pageSize; |
| 100 | int m_lineSize; |
| 101 | int m_tickFreq; |
| 102 | private : |
| 103 | DECLARE_EVENT_TABLE() |
| 104 | }; |
| 105 | |
| 106 | #endif |
| 107 | // _WX_SLIDER_H_ |