]> git.saurik.com Git - wxWidgets.git/blob - include/wx/scrolbar.h
decouple item index from string value (patch 1905702)
[wxWidgets.git] / include / wx / scrolbar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: scrolbar.h
3 // Purpose: wxScrollBar base header
4 // Author: Julian Smart
5 // Modified by:
6 // Created:
7 // Copyright: (c) Julian Smart
8 // RCS-ID: $Id$
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_SCROLBAR_H_BASE_
13 #define _WX_SCROLBAR_H_BASE_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_SCROLLBAR
18
19 #include "wx/control.h"
20
21 extern WXDLLEXPORT_DATA(const char) wxScrollBarNameStr[];
22
23 // ----------------------------------------------------------------------------
24 // wxScrollBar: a scroll bar control
25 // ----------------------------------------------------------------------------
26
27 class WXDLLEXPORT wxScrollBarBase : public wxControl
28 {
29 public:
30 wxScrollBarBase() { }
31
32 // scrollbar construction
33 bool Create(wxWindow *parent,
34 wxWindowID id,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 long style = wxSB_HORIZONTAL,
38 const wxValidator& validator = wxDefaultValidator,
39 const wxString& name = wxScrollBarNameStr);
40
41 // accessors
42 virtual int GetThumbPosition() const = 0;
43 virtual int GetThumbSize() const = 0;
44 virtual int GetPageSize() const = 0;
45 virtual int GetRange() const = 0;
46
47 bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; }
48
49 // operations
50 virtual void SetThumbPosition(int viewStart) = 0;
51 virtual void SetScrollbar(int position, int thumbSize,
52 int range, int pageSize,
53 bool refresh = true) = 0;
54
55 // implementation-only
56 bool IsNeeded() const { return GetRange() > GetThumbSize(); }
57
58 private:
59 DECLARE_NO_COPY_CLASS(wxScrollBarBase)
60 };
61
62 #if defined(__WXUNIVERSAL__)
63 #include "wx/univ/scrolbar.h"
64 #elif defined(__WXMSW__)
65 #include "wx/msw/scrolbar.h"
66 #elif defined(__WXMOTIF__)
67 #include "wx/motif/scrolbar.h"
68 #elif defined(__WXGTK20__)
69 #include "wx/gtk/scrolbar.h"
70 #elif defined(__WXGTK__)
71 #include "wx/gtk1/scrolbar.h"
72 #elif defined(__WXMAC__)
73 #include "wx/mac/scrolbar.h"
74 #elif defined(__WXCOCOA__)
75 #include "wx/cocoa/scrolbar.h"
76 #elif defined(__WXPM__)
77 #include "wx/os2/scrolbar.h"
78 #endif
79
80 #endif // wxUSE_SCROLLBAR
81
82 #endif
83 // _WX_SCROLBAR_H_BASE_