| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/univ/spinbutt.h |
| 3 | // Purpose: wxSpinButton 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 _WX_SPINBUTT_H_ |
| 13 | #define _WX_SPINBUTT_H_ |
| 14 | |
| 15 | #include "wx/control.h" |
| 16 | #include "wx/event.h" |
| 17 | |
| 18 | #if wxUSE_SPINBTN |
| 19 | |
| 20 | class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase |
| 21 | { |
| 22 | public: |
| 23 | // construction |
| 24 | wxSpinButton() { } |
| 25 | |
| 26 | wxSpinButton(wxWindow *parent, |
| 27 | wxWindowID id = wxID_ANY, |
| 28 | const wxPoint& pos = wxDefaultPosition, |
| 29 | const wxSize& size = wxDefaultSize, |
| 30 | long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, |
| 31 | const wxString& name = wxSPIN_BUTTON_NAME) |
| 32 | { |
| 33 | Create(parent, id, pos, size, style, name); |
| 34 | } |
| 35 | |
| 36 | virtual ~wxSpinButton(); |
| 37 | |
| 38 | bool Create(wxWindow *parent, |
| 39 | wxWindowID id = wxID_ANY, |
| 40 | const wxPoint& pos = wxDefaultPosition, |
| 41 | const wxSize& size = wxDefaultSize, |
| 42 | long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, |
| 43 | const wxString& name = wxSPIN_BUTTON_NAME); |
| 44 | |
| 45 | |
| 46 | // accessors |
| 47 | virtual int GetValue() const; |
| 48 | virtual void SetValue(int val); |
| 49 | virtual void SetRange(int minVal, int maxVal); |
| 50 | |
| 51 | // implementation |
| 52 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
| 53 | virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); |
| 54 | virtual bool MSWOnScroll(int orientation, WXWORD wParam, |
| 55 | WXWORD pos, WXHWND control); |
| 56 | |
| 57 | // a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can |
| 58 | virtual bool AcceptsFocus() const { return false; } |
| 59 | |
| 60 | // returns true if the platform should explicitly apply a theme border |
| 61 | virtual bool CanApplyThemeBorder() const { return false; } |
| 62 | |
| 63 | protected: |
| 64 | virtual wxSize DoGetBestSize() const; |
| 65 | |
| 66 | // ensure that the control displays a value in the current range |
| 67 | virtual void NormalizeValue(); |
| 68 | |
| 69 | private: |
| 70 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton) |
| 71 | }; |
| 72 | |
| 73 | #endif // wxUSE_SPINBTN |
| 74 | |
| 75 | #endif // _WX_SPINBUTT_H_ |