scrolbar.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/scrolbar.h
  3. // Purpose: wxScrollBar 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_SCROLBAR_H_
  11. #define _WX_SCROLBAR_H_
  12. // Scrollbar item
  13. class WXDLLIMPEXP_CORE wxScrollBar : public wxScrollBarBase
  14. {
  15. public:
  16. wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; }
  17. virtual ~wxScrollBar();
  18. wxScrollBar(wxWindow *parent,
  19. wxWindowID id,
  20. const wxPoint& pos = wxDefaultPosition,
  21. const wxSize& size = wxDefaultSize,
  22. long style = wxSB_HORIZONTAL,
  23. const wxValidator& validator = wxDefaultValidator,
  24. const wxString& name = wxScrollBarNameStr)
  25. {
  26. Create(parent, id, pos, size, style, validator, name);
  27. }
  28. bool Create(wxWindow *parent,
  29. wxWindowID id,
  30. const wxPoint& pos = wxDefaultPosition,
  31. const wxSize& size = wxDefaultSize,
  32. long style = wxSB_HORIZONTAL,
  33. const wxValidator& validator = wxDefaultValidator,
  34. const wxString& name = wxScrollBarNameStr);
  35. virtual int GetThumbPosition() const ;
  36. virtual int GetThumbSize() const { return m_viewSize; }
  37. virtual int GetPageSize() const { return m_pageSize; }
  38. virtual int GetRange() const { return m_objectSize; }
  39. virtual void SetThumbPosition(int viewStart);
  40. virtual void SetScrollbar(int position, int thumbSize, int range,
  41. int pageSize, bool refresh = true);
  42. // needed for RTTI
  43. void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; }
  44. void SetPageSize( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , GetRange() , s , true ) ; }
  45. void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; }
  46. // implementation only from now on
  47. void Command(wxCommandEvent& event);
  48. virtual void TriggerScrollEvent( wxEventType scrollEvent ) ;
  49. virtual bool OSXHandleClicked( double timestampsec );
  50. protected:
  51. virtual wxSize DoGetBestSize() const;
  52. int m_pageSize;
  53. int m_viewSize;
  54. int m_objectSize;
  55. DECLARE_DYNAMIC_CLASS(wxScrollBar)
  56. DECLARE_EVENT_TABLE()
  57. };
  58. #endif // _WX_SCROLBAR_H_