spinbutt.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/motif/spinbutt.h
  3. // Purpose: wxSpinButton class
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 17/09/98
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_SPINBUTT_H_
  11. #define _WX_SPINBUTT_H_
  12. class WXDLLIMPEXP_FWD_CORE wxArrowButton; // internal
  13. class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase
  14. {
  15. DECLARE_DYNAMIC_CLASS(wxSpinButton)
  16. public:
  17. wxSpinButton() : m_up( 0 ), m_down( 0 ), m_pos( 0 ) { }
  18. wxSpinButton(wxWindow *parent,
  19. wxWindowID id = wxID_ANY,
  20. const wxPoint& pos = wxDefaultPosition,
  21. const wxSize& size = wxDefaultSize,
  22. long style = wxSP_VERTICAL,
  23. const wxString& name = "wxSpinButton")
  24. : m_up( 0 ),
  25. m_down( 0 ),
  26. m_pos( 0 )
  27. {
  28. Create(parent, id, pos, size, style, name);
  29. }
  30. virtual ~wxSpinButton();
  31. bool Create(wxWindow *parent,
  32. wxWindowID id = wxID_ANY,
  33. const wxPoint& pos = wxDefaultPosition,
  34. const wxSize& size = wxDefaultSize,
  35. long style = wxSP_VERTICAL,
  36. const wxString& name = "wxSpinButton");
  37. // accessors
  38. int GetValue() const;
  39. int GetMin() const { return m_min; }
  40. int GetMax() const { return m_max; }
  41. // operations
  42. void SetValue(int val);
  43. void SetRange(int minVal, int maxVal);
  44. // Implementation
  45. virtual void Command(wxCommandEvent& event)
  46. { (void)ProcessCommand(event); }
  47. virtual void ChangeFont(bool keepOriginalSize = true);
  48. virtual void ChangeBackgroundColour();
  49. virtual void ChangeForegroundColour();
  50. public:
  51. // implementation detail
  52. void Increment( int delta );
  53. private:
  54. virtual void DoSetSize(int x, int y, int width, int height,
  55. int sizeFlags = wxSIZE_AUTO);
  56. virtual void DoMoveWindow(int x, int y, int width, int height);
  57. virtual wxSize DoGetBestSize() const;
  58. wxArrowButton* m_up;
  59. wxArrowButton* m_down;
  60. int m_pos;
  61. };
  62. #endif
  63. // _WX_SPINBUTT_H_