Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / progressbar.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_PROGRESSBAR_H
4 #define _GTKMM_PROGRESSBAR_H
5
6 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* progressbar.h
11  * 
12  * Copyright (C) 1998-2002 The gtkmm Development Team
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Library General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with this library; if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28
29 #include <gtkmm/widget.h>
30
31
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 typedef struct _GtkProgressBar GtkProgressBar;
34 typedef struct _GtkProgressBarClass GtkProgressBarClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
36
37
38 namespace Gtk
39 { class ProgressBar_Class; } // namespace Gtk
40 namespace Gtk
41 {
42
43
44 /** @addtogroup gtkmmEnums Enums and Flags */
45
46 /**
47  * @ingroup gtkmmEnums
48  */
49 enum ProgressBarStyle
50 {
51   PROGRESS_CONTINUOUS,
52   PROGRESS_DISCRETE
53 };
54
55 } // namespace Gtk
56
57
58 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59 namespace Glib
60 {
61
62 template <>
63 class Value<Gtk::ProgressBarStyle> : public Glib::Value_Enum<Gtk::ProgressBarStyle>
64 {
65 public:
66   static GType value_type() G_GNUC_CONST;
67 };
68
69 } // namespace Glib
70 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
71
72
73 namespace Gtk
74 {
75
76 /**
77  * @ingroup gtkmmEnums
78  */
79 enum ProgressBarOrientation
80 {
81   PROGRESS_LEFT_TO_RIGHT,
82   PROGRESS_RIGHT_TO_LEFT,
83   PROGRESS_BOTTOM_TO_TOP,
84   PROGRESS_TOP_TO_BOTTOM
85 };
86
87 } // namespace Gtk
88
89
90 #ifndef DOXYGEN_SHOULD_SKIP_THIS
91 namespace Glib
92 {
93
94 template <>
95 class Value<Gtk::ProgressBarOrientation> : public Glib::Value_Enum<Gtk::ProgressBarOrientation>
96 {
97 public:
98   static GType value_type() G_GNUC_CONST;
99 };
100
101 } // namespace Glib
102 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
103
104
105 namespace Gtk
106 {
107
108
109 /** A widget which indicates progress visually.
110  *
111  * The Gtk::ProgressBar is typically used to display the progress of a long
112  * running operation. It provides a visual clue that processing is underway.
113  * The Gtk::ProgressBar can be used in two different modes: percentage mode
114  * and activity mode.
115  *
116  * When an application can determine how much work needs to take place (e.g.
117  * read a fixed number of bytes from a file) and can monitor its progress,
118  * it can use the Gtk::ProgressBar in percentage mode and the user sees a
119  * growing bar indicating the percentage of the work that has been
120  * completed. In this mode, the application is required to call
121  * set_fraction() periodically to update the progress bar.
122  *
123  * When an application has no accurate way of knowing the amount of work to
124  * do, it can use the Gtk::ProgressBar in activity mode, which shows
125  * activity by a block moving back and forth within the progress area. In
126  * this mode, the application is required to call pulse() perodically to
127  * update the progress bar.
128  *
129  * There is quite a bit of flexibility provided to control the appearance of
130  * the Gtk::ProgressBar. Functions are provided to control the orientation of
131  * the bar, optional text can be displayed along with the bar, and the step
132  * size used in activity mode can be set. 
133  *
134  * @ingroup Widgets
135  */
136
137 class ProgressBar : public Widget
138 {
139   public:
140 #ifndef DOXYGEN_SHOULD_SKIP_THIS
141   typedef ProgressBar CppObjectType;
142   typedef ProgressBar_Class CppClassType;
143   typedef GtkProgressBar BaseObjectType;
144   typedef GtkProgressBarClass BaseClassType;
145 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
146
147   virtual ~ProgressBar();
148
149 #ifndef DOXYGEN_SHOULD_SKIP_THIS
150
151 private:
152   friend class ProgressBar_Class;
153   static CppClassType progressbar_class_;
154
155   // noncopyable
156   ProgressBar(const ProgressBar&);
157   ProgressBar& operator=(const ProgressBar&);
158
159 protected:
160   explicit ProgressBar(const Glib::ConstructParams& construct_params);
161   explicit ProgressBar(GtkProgressBar* castitem);
162
163 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
164
165 public:
166 #ifndef DOXYGEN_SHOULD_SKIP_THIS
167   static GType get_type()      G_GNUC_CONST;
168   static GType get_base_type() G_GNUC_CONST;
169 #endif
170
171   ///Provides access to the underlying C GtkObject.
172   GtkProgressBar*       gobj()       { return reinterpret_cast<GtkProgressBar*>(gobject_); }
173
174   ///Provides access to the underlying C GtkObject.
175   const GtkProgressBar* gobj() const { return reinterpret_cast<GtkProgressBar*>(gobject_); }
176
177
178 public:
179   //C++ methods used to invoke GTK+ virtual functions:
180
181 protected:
182   //GTK+ Virtual Functions (override these to change behaviour):
183
184   //Default Signal Handlers::
185
186
187 private:
188
189   
190 public:
191   ProgressBar();
192
193   
194   /** Indicates that some progress is made, but you don't know how much.
195    * Causes the progress bar to enter "activity mode," where a block
196    * bounces back and forth. Each call to pulse()
197    * causes the block to move by a little bit (the amount of movement
198    * per pulse is determined by set_pulse_step()).
199    */
200   void pulse();
201
202   
203   /** Retrieves the text displayed superimposed on the progress bar,
204    * if any, otherwise <tt>0</tt>. The return value is a reference
205    * to the text, not a copy of it, so will become invalid
206    * if you change the text in the progress bar.
207    * @return Text, or <tt>0</tt>; this string is owned by the widget
208    * and should not be modified or freed.
209    */
210   Glib::ustring get_text() const;
211   
212   /** Causes the given @a text  to appear superimposed on the progress bar.
213    * @param text A UTF-8 string.
214    */
215   void set_text(const Glib::ustring& text);
216
217   
218   /** Returns the current fraction of the task that's been completed.
219    * @return A fraction from 0.0 to 1.0.
220    */
221   double get_fraction() const;
222   
223   /** Causes the progress bar to "fill in" the given fraction
224    * of the bar. The fraction should be between 0.0 and 1.0,
225    * inclusive.
226    * @param fraction Fraction of the task that's been completed.
227    */
228   void set_fraction(double fraction);
229
230   
231   /** Retrieves the pulse step set with set_pulse_step()
232    * @return A fraction from 0.0 to 1.0.
233    */
234   double get_pulse_step() const;
235   
236   /** Sets the fraction of total progress bar length to move the
237    * bouncing block for each call to pulse().
238    * @param fraction Fraction between 0.0 and 1.0.
239    */
240   void set_pulse_step(double fraction);
241
242   
243   /** Causes the progress bar to switch to a different orientation
244    * (left-to-right, right-to-left, top-to-bottom, or bottom-to-top).
245    * @param orientation Orientation of the progress bar.
246    */
247   void set_orientation(ProgressBarOrientation orientation = PROGRESS_LEFT_TO_RIGHT);
248   
249   /** Retrieves the current progress bar orientation.
250    * @return Orientation of the progress bar.
251    */
252   ProgressBarOrientation get_orientation() const;
253
254   
255   /** Sets the mode used to ellipsize (add an ellipsis: "...") the text 
256    * if there is not enough space to render the entire string.
257    * 
258    * Since: 2.6
259    * @param mode A Pango::EllipsizeMode.
260    */
261   void set_ellipsize(Pango::EllipsizeMode mode);
262   
263   Pango::EllipsizeMode get_ellipsize() const;
264
265   /** The fraction of total work that has been completed.
266    *
267    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
268    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
269    * the value of the property changes.
270    */
271   Glib::PropertyProxy<double> property_fraction() ;
272
273 /** The fraction of total work that has been completed.
274    *
275    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
276    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
277    * the value of the property changes.
278    */
279   Glib::PropertyProxy_ReadOnly<double> property_fraction() const;
280
281   /** The fraction of total progress to move the bouncing block when pulsed.
282    *
283    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
284    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
285    * the value of the property changes.
286    */
287   Glib::PropertyProxy<double> property_pulse_step() ;
288
289 /** The fraction of total progress to move the bouncing block when pulsed.
290    *
291    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
292    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
293    * the value of the property changes.
294    */
295   Glib::PropertyProxy_ReadOnly<double> property_pulse_step() const;
296
297   /** Orientation and growth direction of the progress bar.
298    *
299    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
300    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
301    * the value of the property changes.
302    */
303   Glib::PropertyProxy<ProgressBarOrientation> property_orientation() ;
304
305 /** Orientation and growth direction of the progress bar.
306    *
307    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
308    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
309    * the value of the property changes.
310    */
311   Glib::PropertyProxy_ReadOnly<ProgressBarOrientation> property_orientation() const;
312
313   /** Text to be displayed in the progress bar.
314    *
315    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
316    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
317    * the value of the property changes.
318    */
319   Glib::PropertyProxy<Glib::ustring> property_text() ;
320
321 /** Text to be displayed in the progress bar.
322    *
323    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
324    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
325    * the value of the property changes.
326    */
327   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_text() const;
328
329   /** The preferred place to ellipsize the string
330    *
331    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
332    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
333    * the value of the property changes.
334    */
335   Glib::PropertyProxy<bool> property_ellipsize() ;
336
337 /** The preferred place to ellipsize the string
338    *
339    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
340    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
341    * the value of the property changes.
342    */
343   Glib::PropertyProxy_ReadOnly<bool> property_ellipsize() const;
344
345
346 };
347
348 } // namespace Gtk
349
350
351 namespace Glib
352 {
353   /** @relates Gtk::ProgressBar
354    * @param object The C instance
355    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
356    * @result A C++ instance that wraps this C instance.
357    */
358   Gtk::ProgressBar* wrap(GtkProgressBar* object, bool take_copy = false);
359 }
360 #endif /* _GTKMM_PROGRESSBAR_H */
361