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