scrolbar.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/scrolbar.h
  3. // Purpose: wxScrollBar class
  4. // Author: David Elliott
  5. // Modified by:
  6. // Created: 2004/04/25
  7. // Copyright: (c) 2004 David Elliott
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_COCOA_SCROLBAR_H__
  11. #define _WX_COCOA_SCROLBAR_H__
  12. #include "wx/cocoa/NSScroller.h"
  13. // ========================================================================
  14. // wxScrollBar
  15. // ========================================================================
  16. class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase, protected wxCocoaNSScroller
  17. {
  18. DECLARE_DYNAMIC_CLASS(wxScrollBar)
  19. DECLARE_EVENT_TABLE()
  20. WX_DECLARE_COCOA_OWNER(NSScroller,NSControl,NSView)
  21. // ------------------------------------------------------------------------
  22. // initialization
  23. // ------------------------------------------------------------------------
  24. public:
  25. wxScrollBar() { }
  26. wxScrollBar(wxWindow *parent, wxWindowID winid,
  27. const wxPoint& pos = wxDefaultPosition,
  28. const wxSize& size = wxDefaultSize,
  29. long style = wxSB_HORIZONTAL,
  30. const wxValidator& validator = wxDefaultValidator,
  31. const wxString& name = wxScrollBarNameStr)
  32. {
  33. Create(parent, winid, pos, size, style, validator, name);
  34. }
  35. bool Create(wxWindow *parent, wxWindowID winid,
  36. const wxPoint& pos = wxDefaultPosition,
  37. const wxSize& size = wxDefaultSize,
  38. long style = wxSB_HORIZONTAL,
  39. const wxValidator& validator = wxDefaultValidator,
  40. const wxString& name = wxScrollBarNameStr);
  41. virtual ~wxScrollBar();
  42. // ------------------------------------------------------------------------
  43. // Cocoa callbacks
  44. // ------------------------------------------------------------------------
  45. protected:
  46. virtual void Cocoa_wxNSScrollerAction(void);
  47. // ------------------------------------------------------------------------
  48. // Implementation
  49. // ------------------------------------------------------------------------
  50. public:
  51. // accessors
  52. virtual int GetThumbPosition() const;
  53. virtual int GetThumbSize() const { return m_thumbSize; }
  54. virtual int GetPageSize() const { return m_pageSize; }
  55. virtual int GetRange() const { return m_range; }
  56. // operations
  57. virtual void SetThumbPosition(int viewStart);
  58. virtual void SetScrollbar(int position, int thumbSize,
  59. int range, int pageSize,
  60. bool refresh = TRUE);
  61. protected:
  62. int m_range;
  63. int m_thumbSize;
  64. int m_pageSize;
  65. };
  66. #endif
  67. // _WX_COCOA_SCROLBAR_H__