]>
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 | |
11 | @wxheader{scrolbar.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | A wxScrollBar is a control that represents a horizontal or |
14 | vertical scrollbar. It is distinct from the two scrollbars that some windows | |
15 | provide automatically, but the two types of scrollbar share the way | |
16 | events are received. | |
7c913512 | 17 | |
23324ae1 FM |
18 | @beginStyleTable |
19 | @style{wxSB_HORIZONTAL}: | |
20 | Specifies a horizontal scrollbar. | |
21 | @style{wxSB_VERTICAL}: | |
22 | Specifies a vertical scrollbar. | |
23 | @endStyleTable | |
7c913512 | 24 | |
23324ae1 FM |
25 | @library{wxcore} |
26 | @category{ctrl} | |
27 | @appearance{scrollbar.png} | |
7c913512 | 28 | |
e54c96f1 | 29 | @see @ref overview_scrollingoverview "Scrolling overview", @ref |
4cc4bfaf | 30 | overview_eventhandlingoverview, wxScrolledWindow |
23324ae1 FM |
31 | */ |
32 | class wxScrollBar : public wxControl | |
33 | { | |
34 | public: | |
35 | //@{ | |
36 | /** | |
37 | Constructor, creating and showing a scrollbar. | |
3c4f71cc | 38 | |
7c913512 | 39 | @param parent |
4cc4bfaf | 40 | Parent window. Must be non-@NULL. |
7c913512 | 41 | @param id |
4cc4bfaf | 42 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 43 | @param pos |
4cc4bfaf FM |
44 | Window position. If wxDefaultPosition is specified then a default |
45 | position is chosen. | |
7c913512 | 46 | @param size |
4cc4bfaf FM |
47 | Window size. If wxDefaultSize is specified then a default size |
48 | is chosen. | |
7c913512 | 49 | @param style |
4cc4bfaf | 50 | Window style. See wxScrollBar. |
7c913512 | 51 | @param validator |
4cc4bfaf | 52 | Window validator. |
7c913512 | 53 | @param name |
4cc4bfaf | 54 | Window name. |
3c4f71cc | 55 | |
4cc4bfaf | 56 | @see Create(), wxValidator |
23324ae1 FM |
57 | */ |
58 | wxScrollBar(); | |
7c913512 FM |
59 | wxScrollBar(wxWindow* parent, wxWindowID id, |
60 | const wxPoint& pos = wxDefaultPosition, | |
61 | const wxSize& size = wxDefaultSize, | |
62 | long style = wxSB_HORIZONTAL, | |
63 | const wxValidator& validator = wxDefaultValidator, | |
64 | const wxString& name = "scrollBar"); | |
23324ae1 FM |
65 | //@} |
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 |