| 1 |
/* Copyright (C) 1998-2002 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtkmm/widget.h> |
| 18 |
#include <gtkmm/orientable.h> |
| 19 |
|
| 20 |
_DEFS(gtkmm,gtk) |
| 21 |
_PINCLUDE(gtkmm/private/widget_p.h) |
| 22 |
_PINCLUDE(gtk/gtk.h) |
| 23 |
|
| 24 |
|
| 25 |
namespace Gtk |
| 26 |
{ |
| 27 |
|
| 28 |
_CC_INCLUDE(gtk/gtk.h) |
| 29 |
|
| 30 |
/** A widget which indicates progress visually. |
| 31 |
* |
| 32 |
* The Gtk::ProgressBar is typically used to display the progress of a long |
| 33 |
* running operation. It provides a visual clue that processing is underway. |
| 34 |
* The Gtk::ProgressBar can be used in two different modes: percentage mode |
| 35 |
* and activity mode. |
| 36 |
* |
| 37 |
* When an application can determine how much work needs to take place (e.g. |
| 38 |
* read a fixed number of bytes from a file) and can monitor its progress, |
| 39 |
* it can use the Gtk::ProgressBar in percentage mode and the user sees a |
| 40 |
* growing bar indicating the percentage of the work that has been |
| 41 |
* completed. In this mode, the application is required to call |
| 42 |
* set_fraction() periodically to update the progress bar. |
| 43 |
* |
| 44 |
* When an application has no accurate way of knowing the amount of work to |
| 45 |
* do, it can use the Gtk::ProgressBar in activity mode, which shows |
| 46 |
* activity by a block moving back and forth within the progress area. In |
| 47 |
* this mode, the application is required to call pulse() perodically to |
| 48 |
* update the progress bar. |
| 49 |
* |
| 50 |
* There is quite a bit of flexibility provided to control the appearance of |
| 51 |
* the Gtk::ProgressBar. Functions are provided to control the orientation of |
| 52 |
* the bar, optional text can be displayed along with the bar, and the step |
| 53 |
* size used in activity mode can be set. |
| 54 |
* |
| 55 |
* The ProgressBar widget looks like this: |
| 56 |
* @image html progressbar1.png |
| 57 |
* |
| 58 |
* @ingroup Widgets |
| 59 |
*/ |
| 60 |
class GTKMM_API ProgressBar |
| 61 |
: public Widget, |
| 62 |
public Orientable |
| 63 |
{ |
| 64 |
_CLASS_GTKOBJECT(ProgressBar,GtkProgressBar,GTK_PROGRESS_BAR,Gtk::Widget,GtkWidget,GtkProgressBar,,GTKMM_API) |
| 65 |
_IMPLEMENTS_INTERFACE(Orientable) |
| 66 |
public: |
| 67 |
_CTOR_DEFAULT() |
| 68 |
|
| 69 |
_WRAP_METHOD(void pulse(), gtk_progress_bar_pulse) |
| 70 |
|
| 71 |
_WRAP_METHOD(Glib::ustring get_text() const, gtk_progress_bar_get_text) |
| 72 |
_WRAP_METHOD(void set_text(const Glib::ustring& text), gtk_progress_bar_set_text) |
| 73 |
|
| 74 |
_WRAP_METHOD(double get_fraction() const, gtk_progress_bar_get_fraction) |
| 75 |
_WRAP_METHOD(void set_fraction(double fraction), gtk_progress_bar_set_fraction) |
| 76 |
|
| 77 |
_WRAP_METHOD(double get_pulse_step() const, gtk_progress_bar_get_pulse_step) |
| 78 |
_WRAP_METHOD(void set_pulse_step(double fraction), gtk_progress_bar_set_pulse_step) |
| 79 |
|
| 80 |
_WRAP_METHOD(void set_inverted(bool inverted = true), gtk_progress_bar_set_inverted) |
| 81 |
_WRAP_METHOD(bool get_inverted() const, gtk_progress_bar_get_inverted ) |
| 82 |
|
| 83 |
_WRAP_METHOD(void set_ellipsize(Pango::EllipsizeMode mode), gtk_progress_bar_set_ellipsize) |
| 84 |
_WRAP_METHOD(Pango::EllipsizeMode get_ellipsize() const, gtk_progress_bar_get_ellipsize) |
| 85 |
|
| 86 |
_WRAP_METHOD(void set_show_text(bool show_text = true), gtk_progress_bar_set_show_text) |
| 87 |
_WRAP_METHOD(bool get_show_text() const, gtk_progress_bar_get_show_text) |
| 88 |
|
| 89 |
_WRAP_PROPERTY("fraction", double) |
| 90 |
_WRAP_PROPERTY("pulse-step", double) |
| 91 |
_WRAP_PROPERTY("text", Glib::ustring) |
| 92 |
_WRAP_PROPERTY("ellipsize", bool) |
| 93 |
_WRAP_PROPERTY("show-text", bool) |
| 94 |
_WRAP_PROPERTY("inverted", bool) |
| 95 |
}; |
| 96 |
|
| 97 |
} // namespace Gtk |