]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: scrolbar.h | |
e54c96f1 | 3 | // Purpose: interface of wxScrollBar |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxScrollBar | |
7c913512 | 11 | |
23324ae1 FM |
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. | |
7c913512 | 16 | |
23324ae1 | 17 | @beginStyleTable |
8c6791e4 | 18 | @style{wxSB_HORIZONTAL} |
23324ae1 | 19 | Specifies a horizontal scrollbar. |
8c6791e4 | 20 | @style{wxSB_VERTICAL} |
23324ae1 FM |
21 | Specifies a vertical scrollbar. |
22 | @endStyleTable | |
7c913512 | 23 | |
23324ae1 FM |
24 | @library{wxcore} |
25 | @category{ctrl} | |
f09b5681 | 26 | <!-- @appearance{scrollbar.png} --> |
7c913512 | 27 | |
f09b5681 | 28 | @see @ref overview_scrolling, @ref overview_eventhandling, wxScrolled |
23324ae1 FM |
29 | */ |
30 | class wxScrollBar : public wxControl | |
31 | { | |
32 | public: | |
671600d8 RR |
33 | /** |
34 | Default constructor | |
35 | */ | |
36 | wxScrollBar(); | |
37 | ||
23324ae1 FM |
38 | /** |
39 | Constructor, creating and showing a scrollbar. | |
3c4f71cc | 40 | |
7c913512 | 41 | @param parent |
4cc4bfaf | 42 | Parent window. Must be non-@NULL. |
7c913512 | 43 | @param id |
4cc4bfaf | 44 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 45 | @param pos |
4cc4bfaf FM |
46 | Window position. If wxDefaultPosition is specified then a default |
47 | position is chosen. | |
7c913512 | 48 | @param size |
4cc4bfaf FM |
49 | Window size. If wxDefaultSize is specified then a default size |
50 | is chosen. | |
7c913512 | 51 | @param style |
4cc4bfaf | 52 | Window style. See wxScrollBar. |
7c913512 | 53 | @param validator |
4cc4bfaf | 54 | Window validator. |
7c913512 | 55 | @param name |
4cc4bfaf | 56 | Window name. |
3c4f71cc | 57 | |
4cc4bfaf | 58 | @see Create(), wxValidator |
23324ae1 | 59 | */ |
7c913512 FM |
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"); | |
23324ae1 FM |
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. | |
3c4f71cc | 87 | |
4cc4bfaf | 88 | @see SetScrollbar() |
23324ae1 | 89 | */ |
328f5751 | 90 | int GetPageSize() const; |
23324ae1 FM |
91 | |
92 | /** | |
93 | Returns the length of the scrollbar. | |
3c4f71cc | 94 | |
4cc4bfaf | 95 | @see SetScrollbar() |
23324ae1 | 96 | */ |
328f5751 | 97 | int GetRange() const; |
23324ae1 FM |
98 | |
99 | /** | |
100 | Returns the current position of the scrollbar thumb. | |
3c4f71cc | 101 | |
4cc4bfaf | 102 | @see SetThumbPosition() |
23324ae1 | 103 | */ |
328f5751 | 104 | int GetThumbPosition() const; |
23324ae1 FM |
105 | |
106 | /** | |
107 | Returns the thumb or 'view' size. | |
3c4f71cc | 108 | |
4cc4bfaf | 109 | @see SetScrollbar() |
23324ae1 | 110 | */ |
328f5751 | 111 | int GetThumbSize() const; |
23324ae1 FM |
112 | |
113 | /** | |
114 | Sets the scrollbar properties. | |
3c4f71cc | 115 | |
7c913512 | 116 | @param position |
4cc4bfaf | 117 | The position of the scrollbar in scroll units. |
7c913512 | 118 | @param thumbSize |
4cc4bfaf | 119 | The size of the thumb, or visible portion of the scrollbar, in scroll units. |
7c913512 | 120 | @param range |
4cc4bfaf | 121 | The maximum position of the scrollbar. |
7c913512 | 122 | @param pageSize |
4cc4bfaf FM |
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. | |
7c913512 | 127 | @param refresh |
4cc4bfaf | 128 | @true to redraw the scrollbar, @false otherwise. |
3c4f71cc | 129 | |
23324ae1 | 130 | @remarks Let's say you wish to display 50 lines of text, using the same |
4cc4bfaf FM |
131 | font. The window is sized so that you can only see 16 |
132 | lines at a time. | |
23324ae1 FM |
133 | */ |
134 | virtual void SetScrollbar(int position, int thumbSize, int range, | |
135 | int pageSize, | |
4cc4bfaf | 136 | bool refresh = true); |
23324ae1 FM |
137 | |
138 | /** | |
139 | Sets the position of the scrollbar. | |
3c4f71cc | 140 | |
7c913512 | 141 | @param viewStart |
4cc4bfaf | 142 | The position of the scrollbar thumb. |
3c4f71cc | 143 | |
4cc4bfaf | 144 | @see GetThumbPosition() |
23324ae1 FM |
145 | */ |
146 | void SetThumbPosition(int viewStart); | |
147 | }; | |
e54c96f1 | 148 |