]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/scrolbar.h
CP-xxx and MS-yyy iconv identifiers actually don't have dashes in them (this fixes...
[wxWidgets.git] / interface / wx / scrolbar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: scrolbar.h
3 // Purpose: interface of wxScrollBar
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxScrollBar
11
12 A wxScrollBar is a control that represents a horizontal or
13 vertical scrollbar. It is distinct from the two scrollbars that some windows
14 provide automatically, but the two types of scrollbar share the way
15 events are received.
16
17 @beginStyleTable
18 @style{wxSB_HORIZONTAL}
19 Specifies a horizontal scrollbar.
20 @style{wxSB_VERTICAL}
21 Specifies a vertical scrollbar.
22 @endStyleTable
23
24 @library{wxcore}
25 @category{ctrl}
26 <!-- @appearance{scrollbar.png} -->
27
28 @see @ref overview_scrolling, @ref overview_eventhandling, wxScrolled
29 */
30 class wxScrollBar : public wxControl
31 {
32 public:
33 /**
34 Default constructor
35 */
36 wxScrollBar();
37
38 /**
39 Constructor, creating and showing a scrollbar.
40
41 @param parent
42 Parent window. Must be non-@NULL.
43 @param id
44 Window identifier. The value wxID_ANY indicates a default value.
45 @param pos
46 Window position. If wxDefaultPosition is specified then a default
47 position is chosen.
48 @param size
49 Window size. If wxDefaultSize is specified then a default size
50 is chosen.
51 @param style
52 Window style. See wxScrollBar.
53 @param validator
54 Window validator.
55 @param name
56 Window name.
57
58 @see Create(), wxValidator
59 */
60 wxScrollBar(wxWindow* parent, wxWindowID id,
61 const wxPoint& pos = wxDefaultPosition,
62 const wxSize& size = wxDefaultSize,
63 long style = wxSB_HORIZONTAL,
64 const wxValidator& validator = wxDefaultValidator,
65 const wxString& name = "scrollBar");
66
67 /**
68 Destructor, destroying the scrollbar.
69 */
70 ~wxScrollBar();
71
72 /**
73 Scrollbar creation function called by the scrollbar constructor.
74 See wxScrollBar() for details.
75 */
76 bool Create(wxWindow* parent, wxWindowID id,
77 const wxPoint& pos = wxDefaultPosition,
78 const wxSize& size = wxDefaultSize,
79 long style = wxSB_HORIZONTAL,
80 const wxValidator& validator = wxDefaultValidator,
81 const wxString& name = "scrollBar");
82
83 /**
84 Returns the page size of the scrollbar. This is the number of scroll units
85 that will be scrolled when the user pages up or down. Often it is the
86 same as the thumb size.
87
88 @see SetScrollbar()
89 */
90 int GetPageSize() const;
91
92 /**
93 Returns the length of the scrollbar.
94
95 @see SetScrollbar()
96 */
97 int GetRange() const;
98
99 /**
100 Returns the current position of the scrollbar thumb.
101
102 @see SetThumbPosition()
103 */
104 int GetThumbPosition() const;
105
106 /**
107 Returns the thumb or 'view' size.
108
109 @see SetScrollbar()
110 */
111 int GetThumbSize() const;
112
113 /**
114 Sets the scrollbar properties.
115
116 @param position
117 The position of the scrollbar in scroll units.
118 @param thumbSize
119 The size of the thumb, or visible portion of the scrollbar, in scroll units.
120 @param range
121 The maximum position of the scrollbar.
122 @param pageSize
123 The size of the page size in scroll units. This is the number of units
124 the scrollbar will scroll when it is paged up or down. Often it is the same
125 as
126 the thumb size.
127 @param refresh
128 @true to redraw the scrollbar, @false otherwise.
129
130 @remarks Let's say you wish to display 50 lines of text, using the same
131 font. The window is sized so that you can only see 16
132 lines at a time.
133 */
134 virtual void SetScrollbar(int position, int thumbSize, int range,
135 int pageSize,
136 bool refresh = true);
137
138 /**
139 Sets the position of the scrollbar.
140
141 @param viewStart
142 The position of the scrollbar thumb.
143
144 @see GetThumbPosition()
145 */
146 void SetThumbPosition(int viewStart);
147 };
148