/* 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtkmm/widget.h>
#include <gtkmm/orientable.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/widget_p.h)


namespace Gtk
{

/** A bar that can be 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 three offsets
 * by default on the level bar: GTK_LEVEL_BAR_OFFSET_LOW,
 * GTK_LEVEL_BAR_OFFSET_HIGH and GTK_LEVEL_BAR_OFFSET_FULL, with
 * values 0.25, 0.75 and 1.0 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::LevelBar::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,
  public Orientable
{
  _CLASS_GTKOBJECT(LevelBar, GtkLevelBar, GTK_LEVEL_BAR, Gtk::Widget, GtkWidget, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(Orientable)
public:
  _WRAP_ENUM(Mode, GtkLevelBarMode, decl_prefix GTKMM_API)

  _CTOR_DEFAULT()
  _IGNORE(gtk_level_bar_new)

  _WRAP_METHOD(void set_mode(Mode mode), gtk_level_bar_set_mode)
  _WRAP_METHOD(Mode 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)

  // no_default_handler because GtkLevelBarClass is private.
  _WRAP_SIGNAL(void offset_changed(const Glib::ustring& name), offset_changed,
    detail_name offset_name, no_default_handler)

  _WRAP_PROPERTY("value", double)
  _WRAP_PROPERTY("min-value", double)
  _WRAP_PROPERTY("max-value", double)
  _WRAP_PROPERTY("mode", Mode)
  _WRAP_PROPERTY("inverted", bool)
};


} // namespace Gtk

