| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: slidrmsw.h |
| 3 | // Purpose: wxSliderMSW class |
| 4 | // Author: Julian Smart |
| 5 | // Modified by: |
| 6 | // Created: 01/02/97 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _SLIDRMSW_H_ |
| 13 | #define _SLIDRMSW_H_ |
| 14 | |
| 15 | #ifdef __GNUG__ |
| 16 | #pragma interface "slidrmsw.h" |
| 17 | #endif |
| 18 | |
| 19 | #include "wx/control.h" |
| 20 | |
| 21 | WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr; |
| 22 | |
| 23 | // Slider |
| 24 | class WXDLLEXPORT wxSliderMSW : public wxControl |
| 25 | { |
| 26 | DECLARE_DYNAMIC_CLASS(wxSliderMSW) |
| 27 | |
| 28 | public: |
| 29 | wxSliderMSW(); |
| 30 | |
| 31 | wxSliderMSW(wxWindow *parent, wxWindowID id, |
| 32 | int value, int minValue, int maxValue, |
| 33 | const wxPoint& pos = wxDefaultPosition, |
| 34 | const wxSize& size = wxDefaultSize, |
| 35 | long style = wxSL_HORIZONTAL, |
| 36 | const wxValidator& validator = wxDefaultValidator, |
| 37 | const wxString& name = wxSliderNameStr) |
| 38 | { |
| 39 | Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); |
| 40 | } |
| 41 | |
| 42 | ~wxSliderMSW(); |
| 43 | |
| 44 | bool Create(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 | virtual int GetValue() const ; |
| 53 | virtual void SetValue(int); |
| 54 | |
| 55 | void GetSize(int *x, int *y) const ; |
| 56 | void GetPosition(int *x, int *y) const ; |
| 57 | |
| 58 | bool Show(bool show); |
| 59 | |
| 60 | void SetRange(int minValue, int maxValue); |
| 61 | |
| 62 | int GetMin() const { return m_rangeMin; } |
| 63 | int GetMax() const { return m_rangeMax; } |
| 64 | |
| 65 | // For trackbars only |
| 66 | void SetTickFreq(int n, int pos); |
| 67 | int GetTickFreq() const { return m_tickFreq; } |
| 68 | void SetPageSize(int pageSize); |
| 69 | int GetPageSize() const ; |
| 70 | void ClearSel() ; |
| 71 | void ClearTicks() ; |
| 72 | void SetLineSize(int lineSize); |
| 73 | int GetLineSize() const ; |
| 74 | int GetSelEnd() const ; |
| 75 | int GetSelStart() const ; |
| 76 | void SetSelection(int minPos, int maxPos); |
| 77 | void SetThumbLength(int len) ; |
| 78 | int GetThumbLength() const ; |
| 79 | void SetTick(int tickPos) ; |
| 80 | |
| 81 | // IMPLEMENTATION |
| 82 | WXHWND GetStaticMin() const { return m_staticMin; } |
| 83 | WXHWND GetStaticMax() const { return m_staticMax; } |
| 84 | WXHWND GetEditValue() const { return m_staticValue; } |
| 85 | virtual bool ContainsHWND(WXHWND hWnd) const; |
| 86 | |
| 87 | void Command(wxCommandEvent& event); |
| 88 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
| 89 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
| 90 | virtual bool MSWOnScroll(int orientation, WXWORD wParam, |
| 91 | WXWORD pos, WXHWND control); |
| 92 | |
| 93 | protected: |
| 94 | WXHWND m_staticMin; |
| 95 | WXHWND m_staticMax; |
| 96 | WXHWND m_staticValue; |
| 97 | int m_rangeMin; |
| 98 | int m_rangeMax; |
| 99 | int m_pageSize; |
| 100 | int m_lineSize; |
| 101 | int m_tickFreq; |
| 102 | |
| 103 | virtual void DoSetSize(int x, int y, |
| 104 | int width, int height, |
| 105 | int sizeFlags = wxSIZE_AUTO); |
| 106 | }; |
| 107 | |
| 108 | #endif |
| 109 | // _SLIDRMSW_H_ |