slider.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/slider.h
  3. // Purpose: wxSlider class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/15/99
  7. // Copyright: (c) David Webster
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_SLIDER_H_
  11. #define _WX_SLIDER_H_
  12. #include "wx/control.h"
  13. // Slider
  14. class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase
  15. {
  16. public:
  17. wxSlider();
  18. inline wxSlider( wxWindow* pParent
  19. ,wxWindowID vId
  20. ,int nValue
  21. ,int nMinValue
  22. ,int nMaxValue
  23. ,const wxPoint& rPos = wxDefaultPosition
  24. ,const wxSize& rSize = wxDefaultSize
  25. ,long lStyle = wxSL_HORIZONTAL
  26. ,const wxValidator& rValidator = wxDefaultValidator
  27. ,const wxString& rsName = wxSliderNameStr
  28. )
  29. {
  30. Create( pParent
  31. ,vId
  32. ,nValue
  33. ,nMinValue
  34. ,nMaxValue
  35. ,rPos
  36. ,rSize
  37. ,lStyle
  38. ,rValidator
  39. ,rsName
  40. );
  41. }
  42. virtual ~wxSlider();
  43. bool Create( wxWindow* pParent
  44. ,wxWindowID vId
  45. ,int nValue
  46. ,int nMinValue
  47. ,int nMaxValue
  48. ,const wxPoint& rPos = wxDefaultPosition
  49. ,const wxSize& rSize = wxDefaultSize
  50. ,long lStyle = wxSL_HORIZONTAL
  51. ,const wxValidator& rValidator = wxDefaultValidator
  52. ,const wxString& rsName = wxSliderNameStr
  53. );
  54. virtual int GetValue(void) const ;
  55. virtual void SetValue(int);
  56. void GetSize( int* pnX
  57. ,int* pnY
  58. ) const;
  59. void GetPosition( int* pnX
  60. ,int* pnY
  61. ) const ;
  62. bool Show(bool bShow = TRUE);
  63. void SetRange( int nMinValue
  64. ,int nMaxValue
  65. );
  66. inline int GetMin(void) const { return m_nRangeMin; }
  67. inline int GetMax(void) const { return m_nRangeMax; }
  68. //
  69. // For trackbars only
  70. //
  71. void ClearSel(void);
  72. void ClearTicks(void);
  73. int GetLineSize(void) const;
  74. int GetPageSize(void) const ;
  75. int GetSelEnd(void) const;
  76. int GetSelStart(void) const;
  77. inline int GetTickFreq(void) const { return m_nTickFreq; }
  78. int GetThumbLength(void) const ;
  79. void SetLineSize(int nLineSize);
  80. void SetPageSize(int nPageSize);
  81. void SetSelection( int nMinPos
  82. ,int nMaxPos
  83. );
  84. void SetThumbLength(int nLen) ;
  85. void SetTick(int ntickPos) ;
  86. //
  87. // IMPLEMENTATION
  88. //
  89. inline WXHWND GetStaticMin(void) const { return m_hStaticMin; }
  90. inline WXHWND GetStaticMax(void) const { return m_hStaticMax; }
  91. inline WXHWND GetEditValue(void) const { return m_hStaticValue; }
  92. virtual bool ContainsHWND(WXHWND hWnd) const;
  93. void AdjustSubControls( int nX
  94. ,int nY
  95. ,int nWidth
  96. ,int nHeight
  97. ,int nSizeFlags
  98. );
  99. inline int GetSizeFlags(void) { return m_nSizeFlags; }
  100. void Command(wxCommandEvent& rEvent);
  101. virtual WXHBRUSH OnCtlColor( WXHDC hDC
  102. ,WXHWND hWnd
  103. ,WXUINT uCtlColor
  104. ,WXUINT uMessage
  105. ,WXWPARAM wParam
  106. ,WXLPARAM lParam
  107. );
  108. virtual bool OS2OnScroll( int nOrientation
  109. ,WXWORD wParam
  110. ,WXWORD wPos
  111. ,WXHWND hControl
  112. );
  113. protected:
  114. WXHWND m_hStaticMin;
  115. WXHWND m_hStaticMax;
  116. WXHWND m_hStaticValue;
  117. int m_nRangeMin;
  118. int m_nRangeMax;
  119. int m_nPageSize;
  120. int m_nLineSize;
  121. int m_nTickFreq;
  122. double m_dPixelToRange;
  123. int m_nThumbLength;
  124. int m_nSizeFlags;
  125. virtual void DoGetSize( int* pnWidth
  126. ,int* pnHeight
  127. ) const;
  128. virtual void DoSetSize( int nX
  129. ,int nY
  130. ,int nWidth
  131. ,int nHeight
  132. ,int nSizeFlags = wxSIZE_AUTO
  133. );
  134. // Platform-specific implementation of SetTickFreq
  135. virtual void DoSetTickFreq(int freq);
  136. private:
  137. DECLARE_DYNAMIC_CLASS(wxSlider)
  138. }; // end of CLASS wxSlider
  139. #endif
  140. // _WX_SLIDER_H_