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