| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: spinbutt.h |
| 3 | // Purpose: wxSpinButton 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_SPINBUTT_H_ |
| 13 | #define _WX_SPINBUTT_H_ |
| 14 | |
| 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
| 16 | #pragma interface "spinbutt.h" |
| 17 | #endif |
| 18 | |
| 19 | class WXDLLEXPORT wxArrowButton; // internal |
| 20 | |
| 21 | class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase |
| 22 | { |
| 23 | DECLARE_DYNAMIC_CLASS(wxSpinButton) |
| 24 | |
| 25 | public: |
| 26 | wxSpinButton() : m_up( 0 ), m_down( 0 ), m_pos( 0 ) { } |
| 27 | |
| 28 | wxSpinButton(wxWindow *parent, |
| 29 | wxWindowID id = -1, |
| 30 | const wxPoint& pos = wxDefaultPosition, |
| 31 | const wxSize& size = wxDefaultSize, |
| 32 | long style = wxSP_VERTICAL, |
| 33 | const wxString& name = "wxSpinButton") |
| 34 | : m_up( 0 ), |
| 35 | m_down( 0 ), |
| 36 | m_pos( 0 ) |
| 37 | { |
| 38 | Create(parent, id, pos, size, style, name); |
| 39 | } |
| 40 | ~wxSpinButton(); |
| 41 | |
| 42 | bool Create(wxWindow *parent, |
| 43 | wxWindowID id = -1, |
| 44 | const wxPoint& pos = wxDefaultPosition, |
| 45 | const wxSize& size = wxDefaultSize, |
| 46 | long style = wxSP_VERTICAL, |
| 47 | const wxString& name = "wxSpinButton"); |
| 48 | |
| 49 | // accessors |
| 50 | int GetValue() const; |
| 51 | int GetMin() const { return m_min; } |
| 52 | int GetMax() const { return m_max; } |
| 53 | |
| 54 | // operations |
| 55 | void SetValue(int val); |
| 56 | void SetRange(int minVal, int maxVal); |
| 57 | |
| 58 | // Implementation |
| 59 | virtual void Command(wxCommandEvent& event) |
| 60 | { (void)ProcessCommand(event); }; |
| 61 | virtual void ChangeFont(bool keepOriginalSize = true); |
| 62 | virtual void ChangeBackgroundColour(); |
| 63 | virtual void ChangeForegroundColour(); |
| 64 | public: |
| 65 | // implementation detail |
| 66 | void Increment( int delta ); |
| 67 | |
| 68 | private: |
| 69 | virtual void DoSetSize(int x, int y, int width, int height, |
| 70 | int sizeFlags = wxSIZE_AUTO); |
| 71 | virtual void DoMoveWindow(int x, int y, int width, int height); |
| 72 | virtual wxSize DoGetBestSize() const; |
| 73 | |
| 74 | wxArrowButton* m_up; |
| 75 | wxArrowButton* m_down; |
| 76 | int m_pos; |
| 77 | }; |
| 78 | |
| 79 | #endif |
| 80 | // _WX_SPINBUTT_H_ |