/* Copyright (C) 2012 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ #include _DEFS(gtkmm,gtk) _PINCLUDE(gtkmm/private/widget_p.h) namespace Gtk { _WRAP_ENUM(LevelBarMode, GtkLevelBarMode, decl_prefix GTKMM_API) //TODO: Derive/Implement from Gtk::Orientable (and remove our mention of that //in the class documentation when we can break ABI. /** A bar that can used as a level indicator * * Typical use cases are displaying the strength * of a password, or showing the charge level of a battery. * * Use set_value() to set the current value, and * add_offset_value() to set the value offsets at which * the bar will be considered in a different state. There will be two offsets * by default on the level bar: Gtk::LEVEL_BAR_OFFSET_LOW and * Gtk::LEVEL_BAR_OFFSET_HIGH, with values 0.25 and 0.75 respectively. * * The default interval of values is between zero and one, but it's possible to * modify the interval using set_min_value() and * set_max_value(). The value will be always drawn in proportion to * the admissible interval, i.e. a value of 15 with a specified interval between * 10 and 20 is equivalent to a value of 0.5 with an interval between 0 and 1. * When Gtk::LEVEL_BAR_MODE_DISCRETE is used, the bar level is rendered * as a finite and number of separated blocks instead of a single one. The number * of blocks that will be rendered is equal to the number of units specified by * the admissible interval. * For instance, to build a bar rendered with five blocks, it's sufficient to * set the minimum value to 0 and the maximum value to 5 after changing the indicator * mode to discrete. * * @ingroup Widgets * @newin{3,6} */ class GTKMM_API LevelBar : public Widget { _CLASS_GTKOBJECT(LevelBar, GtkLevelBar, GTK_LEVEL_BAR, Gtk::Widget, GtkWidget, , , GTKMM_API) public: _CTOR_DEFAULT() _IGNORE(gtk_level_bar_new) //TODO: Remove this when we can break ABI to derive from Orientable. /** Sets the orientation of the widget. * * @newin{3,18} * * @param orientation The widget’s new orientation. */ void set_orientation(Orientation orientation); _WRAP_METHOD(void set_mode(LevelBarMode mode), gtk_level_bar_set_mode) _WRAP_METHOD(LevelBarMode get_mode() const, gtk_level_bar_get_mode) _WRAP_METHOD(void set_value(double value), gtk_level_bar_set_value) _WRAP_METHOD(double get_value() const, gtk_level_bar_get_value) _WRAP_METHOD(void set_min_value(double value), gtk_level_bar_set_min_value) _WRAP_METHOD(double get_min_value() const, gtk_level_bar_get_min_value) _WRAP_METHOD(void set_max_value(double value), gtk_level_bar_set_max_value) _WRAP_METHOD(double get_max_value() const, gtk_level_bar_get_max_value) _WRAP_METHOD(void set_inverted(bool inverted = true), gtk_level_bar_set_inverted) _WRAP_METHOD(bool get_inverted() const, gtk_level_bar_get_inverted) _WRAP_METHOD(void add_offset_value(const Glib::ustring& name, double value), gtk_level_bar_add_offset_value) _WRAP_METHOD(void remove_offset_value(const Glib::ustring& name), gtk_level_bar_remove_offset_value) _WRAP_METHOD(bool get_offset_value(const Glib::ustring& name, double& value) const, gtk_level_bar_get_offset_value) _WRAP_SIGNAL(void offset_changed(const Glib::ustring& name), offset_changed, detail_name offset_name, two_signal_methods) _WRAP_PROPERTY("value", double) _WRAP_PROPERTY("min-value", double) _WRAP_PROPERTY("max-value", double) _WRAP_PROPERTY("mode", LevelBarMode) _WRAP_PROPERTY("inverted", bool) }; } // namespace Gtk