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