slider.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/slider.h
  3. // Purpose: wxSlider class
  4. // Author: Stefan Csomor
  5. // Modified by:
  6. // Created: 1998-01-01
  7. // Copyright: (c) Stefan Csomor
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_SLIDER_H_
  11. #define _WX_SLIDER_H_
  12. #include "wx/control.h"
  13. #include "wx/slider.h"
  14. #include "wx/stattext.h"
  15. // Slider
  16. class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase
  17. {
  18. DECLARE_DYNAMIC_CLASS(wxSlider)
  19. public:
  20. wxSlider();
  21. inline wxSlider(wxWindow *parent, wxWindowID id,
  22. int value, int minValue, int maxValue,
  23. const wxPoint& pos = wxDefaultPosition,
  24. const wxSize& size = wxDefaultSize,
  25. long style = wxSL_HORIZONTAL,
  26. const wxValidator& validator = wxDefaultValidator,
  27. const wxString& name = wxSliderNameStr)
  28. {
  29. Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name);
  30. }
  31. virtual ~wxSlider();
  32. bool Create(wxWindow *parent, wxWindowID id,
  33. int value, int minValue, int maxValue,
  34. const wxPoint& pos = wxDefaultPosition,
  35. const wxSize& size = wxDefaultSize,
  36. long style = wxSL_HORIZONTAL,
  37. const wxValidator& validator = wxDefaultValidator,
  38. const wxString& name = wxSliderNameStr);
  39. virtual int GetValue() const ;
  40. virtual void SetValue(int);
  41. void SetRange(int minValue, int maxValue);
  42. inline int GetMin() const { return m_rangeMin; }
  43. inline int GetMax() const { return m_rangeMax; }
  44. void SetMin(int minValue) { SetRange(minValue, m_rangeMax); }
  45. void SetMax(int maxValue) { SetRange(m_rangeMin, maxValue); }
  46. // For trackbars only
  47. inline int GetTickFreq() const { return m_tickFreq; }
  48. void SetPageSize(int pageSize);
  49. int GetPageSize() const ;
  50. void ClearSel() ;
  51. void ClearTicks() ;
  52. void SetLineSize(int lineSize);
  53. int GetLineSize() const ;
  54. int GetSelEnd() const ;
  55. int GetSelStart() const ;
  56. void SetSelection(int minPos, int maxPos);
  57. void SetThumbLength(int len) ;
  58. int GetThumbLength() const ;
  59. void SetTick(int tickPos) ;
  60. void Command(wxCommandEvent& event);
  61. // osx specific event handling common for all osx-ports
  62. virtual bool OSXHandleClicked( double timestampsec );
  63. virtual void TriggerScrollEvent( wxEventType scrollEvent ) ;
  64. protected:
  65. // Platform-specific implementation of SetTickFreq
  66. virtual void DoSetTickFreq(int freq);
  67. virtual wxSize DoGetBestSize() const;
  68. virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags);
  69. virtual void DoMoveWindow(int x, int y, int w, int h);
  70. // set min/max size of the slider
  71. virtual void DoSetSizeHints( int minW, int minH,
  72. int maxW, int maxH,
  73. int incW, int incH);
  74. // Common processing to invert slider values based on wxSL_INVERSE
  75. virtual int ValueInvertOrNot(int value) const;
  76. wxStaticText* m_macMinimumStatic ;
  77. wxStaticText* m_macMaximumStatic ;
  78. wxStaticText* m_macValueStatic ;
  79. int m_rangeMin;
  80. int m_rangeMax;
  81. int m_pageSize;
  82. int m_lineSize;
  83. int m_tickFreq;
  84. private :
  85. DECLARE_EVENT_TABLE()
  86. };
  87. #endif
  88. // _WX_SLIDER_H_