]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gauge.h | |
e54c96f1 | 3 | // Purpose: interface of wxGauge |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
e9321277 RD |
8 | |
9 | // ---------------------------------------------------------------------------- | |
10 | // wxGauge style flags | |
11 | // ---------------------------------------------------------------------------- | |
12 | ||
13 | #define wxGA_HORIZONTAL wxHORIZONTAL | |
14 | #define wxGA_VERTICAL wxVERTICAL | |
15 | ||
16 | // Win32 only, is default (and only) on some other platforms | |
17 | #define wxGA_SMOOTH 0x0020 | |
18 | ||
23324ae1 FM |
19 | /** |
20 | @class wxGauge | |
7c913512 | 21 | |
3d2cf884 BP |
22 | A gauge is a horizontal or vertical bar which shows a quantity (often |
23 | time). | |
7c913512 | 24 | |
23324ae1 | 25 | wxGauge supports two working modes: determinate and indeterminate progress. |
7c913512 | 26 | |
3d2cf884 BP |
27 | The first is the usual working mode (see SetValue() and SetRange()) while |
28 | the second can be used when the program is doing some processing but you | |
29 | don't know how much progress is being done. In this case, you can | |
30 | periodically call the Pulse() function to make the progress bar switch to | |
31 | indeterminate mode (graphically it's usually a set of blocks which move or | |
32 | bounce in the bar control). | |
7c913512 | 33 | |
23324ae1 | 34 | wxGauge supports dynamic switch between these two work modes. |
7c913512 | 35 | |
23324ae1 | 36 | There are no user commands for the gauge. |
7c913512 | 37 | |
23324ae1 | 38 | @beginStyleTable |
8c6791e4 | 39 | @style{wxGA_HORIZONTAL} |
23324ae1 | 40 | Creates a horizontal gauge. |
8c6791e4 | 41 | @style{wxGA_VERTICAL} |
23324ae1 | 42 | Creates a vertical gauge. |
8c6791e4 | 43 | @style{wxGA_SMOOTH} |
23324ae1 FM |
44 | Creates smooth progress bar with one pixel wide update step (not |
45 | supported by all platforms). | |
46 | @endStyleTable | |
7c913512 | 47 | |
23324ae1 FM |
48 | @library{wxcore} |
49 | @category{ctrl} | |
ce154616 | 50 | @appearance{gauge} |
7c913512 | 51 | |
e54c96f1 | 52 | @see wxSlider, wxScrollBar |
23324ae1 FM |
53 | */ |
54 | class wxGauge : public wxControl | |
55 | { | |
56 | public: | |
3d2cf884 BP |
57 | /** |
58 | Default constructor. | |
59 | */ | |
60 | wxGauge(); | |
94d17b78 | 61 | |
23324ae1 FM |
62 | /** |
63 | Constructor, creating and showing a gauge. | |
3c4f71cc | 64 | |
7c913512 | 65 | @param parent |
4cc4bfaf | 66 | Window parent. |
7c913512 | 67 | @param id |
4cc4bfaf | 68 | Window identifier. |
7c913512 | 69 | @param range |
94d17b78 FM |
70 | Integer range (maximum value) of the gauge. |
71 | See SetRange() for more details about the meaning of this value | |
72 | when using the gauge in indeterminate mode. | |
7c913512 | 73 | @param pos |
4cc4bfaf | 74 | Window position. |
7c913512 | 75 | @param size |
4cc4bfaf | 76 | Window size. |
7c913512 | 77 | @param style |
3d2cf884 | 78 | Gauge style. |
12fd0e1d VZ |
79 | @param validator |
80 | Window validator. | |
7c913512 | 81 | @param name |
4cc4bfaf | 82 | Window name. |
3c4f71cc | 83 | |
4cc4bfaf | 84 | @see Create() |
23324ae1 | 85 | */ |
7c913512 FM |
86 | wxGauge(wxWindow* parent, wxWindowID id, int range, |
87 | const wxPoint& pos = wxDefaultPosition, | |
88 | const wxSize& size = wxDefaultSize, | |
89 | long style = wxGA_HORIZONTAL, | |
90 | const wxValidator& validator = wxDefaultValidator, | |
a44f3b5a | 91 | const wxString& name = wxGaugeNameStr); |
23324ae1 FM |
92 | |
93 | /** | |
94 | Destructor, destroying the gauge. | |
95 | */ | |
adaaa686 | 96 | virtual ~wxGauge(); |
23324ae1 FM |
97 | |
98 | /** | |
3d2cf884 BP |
99 | Creates the gauge for two-step construction. See wxGauge() for further |
100 | details. | |
23324ae1 FM |
101 | */ |
102 | bool Create(wxWindow* parent, wxWindowID id, int range, | |
103 | const wxPoint& pos = wxDefaultPosition, | |
43c48e1e | 104 | const wxSize& size = wxDefaultSize, long style = wxGA_HORIZONTAL, |
23324ae1 | 105 | const wxValidator& validator = wxDefaultValidator, |
43c48e1e | 106 | const wxString& name = wxGaugeNameStr); |
23324ae1 FM |
107 | |
108 | /** | |
109 | Returns the width of the 3D bezel face. | |
3c4f71cc | 110 | |
23324ae1 | 111 | @remarks This method is not implemented (returns 0) for most platforms. |
3c4f71cc | 112 | |
4cc4bfaf | 113 | @see SetBezelFace() |
23324ae1 | 114 | */ |
328f5751 | 115 | int GetBezelFace() const; |
23324ae1 FM |
116 | |
117 | /** | |
118 | Returns the maximum position of the gauge. | |
3c4f71cc | 119 | |
4cc4bfaf | 120 | @see SetRange() |
23324ae1 | 121 | */ |
328f5751 | 122 | int GetRange() const; |
23324ae1 FM |
123 | |
124 | /** | |
125 | Returns the 3D shadow margin width. | |
3c4f71cc | 126 | |
23324ae1 | 127 | @remarks This method is not implemented (returns 0) for most platforms. |
3c4f71cc | 128 | |
4cc4bfaf | 129 | @see SetShadowWidth() |
23324ae1 | 130 | */ |
328f5751 | 131 | int GetShadowWidth() const; |
23324ae1 FM |
132 | |
133 | /** | |
134 | Returns the current position of the gauge. | |
3c4f71cc | 135 | |
4cc4bfaf | 136 | @see SetValue() |
23324ae1 | 137 | */ |
328f5751 | 138 | int GetValue() const; |
23324ae1 FM |
139 | |
140 | /** | |
7c913512 | 141 | Returns @true if the gauge is vertical (has @c wxGA_VERTICAL style) and |
23324ae1 FM |
142 | @false otherwise. |
143 | */ | |
328f5751 | 144 | bool IsVertical() const; |
23324ae1 FM |
145 | |
146 | /** | |
3d2cf884 BP |
147 | Switch the gauge to indeterminate mode (if required) and makes the |
148 | gauge move a bit to indicate the user that some progress has been made. | |
149 | ||
150 | @note After calling this function the value returned by GetValue() is | |
4c51a665 | 151 | undefined and thus you need to explicitly call SetValue() if you |
3d2cf884 | 152 | want to restore the determinate mode. |
23324ae1 | 153 | */ |
adaaa686 | 154 | virtual void Pulse(); |
23324ae1 FM |
155 | |
156 | /** | |
157 | Sets the 3D bezel face width. | |
3c4f71cc | 158 | |
23324ae1 | 159 | @remarks This method is not implemented (doesn't do anything) for most |
4cc4bfaf | 160 | platforms. |
3c4f71cc | 161 | |
4cc4bfaf | 162 | @see GetBezelFace() |
23324ae1 FM |
163 | */ |
164 | void SetBezelFace(int width); | |
165 | ||
166 | /** | |
3d2cf884 BP |
167 | Sets the range (maximum value) of the gauge. This function makes the |
168 | gauge switch to determinate mode, if it's not already. | |
3c4f71cc | 169 | |
94d17b78 FM |
170 | When the gauge is in indeterminate mode, under wxMSW the gauge |
171 | repeatedly goes from zero to @a range and back; under other ports | |
172 | when in indeterminate mode, the @a range setting is ignored. | |
173 | ||
4cc4bfaf | 174 | @see GetRange() |
23324ae1 FM |
175 | */ |
176 | void SetRange(int range); | |
177 | ||
178 | /** | |
179 | Sets the 3D shadow width. | |
3c4f71cc | 180 | |
23324ae1 | 181 | @remarks This method is not implemented (doesn't do anything) for most |
4cc4bfaf | 182 | platforms. |
23324ae1 FM |
183 | */ |
184 | void SetShadowWidth(int width); | |
185 | ||
186 | /** | |
3d2cf884 BP |
187 | Sets the position of the gauge. The @a pos must be between 0 and the |
188 | gauge range as returned by GetRange(), inclusive. | |
189 | ||
23324ae1 FM |
190 | This function makes the gauge switch to determinate mode, if it was in |
191 | indeterminate mode before. | |
3c4f71cc | 192 | |
7c913512 | 193 | @param pos |
4cc4bfaf | 194 | Position for the gauge level. |
3c4f71cc | 195 | |
4cc4bfaf | 196 | @see GetValue() |
23324ae1 FM |
197 | */ |
198 | void SetValue(int pos); | |
199 | }; | |
e54c96f1 | 200 |