/* $Id: range.hg,v 1.8 2006/04/12 11:11:25 murrayc Exp $ */

/* Copyright (C) 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

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


namespace Gtk
{

_WRAP_ENUM(SensitivityType, GtkSensitivityType)

class Adjustment;

/** Base class for widgets which visualize an adjustment.
 *
 * @ingroup Widgets
 */
class Range : public Widget
{
  _CLASS_GTKOBJECT(Range,GtkRange,GTK_RANGE,Gtk::Widget,GtkWidget)
protected:
  _CTOR_DEFAULT
public:
  

  _WRAP_METHOD(void set_update_policy(UpdateType policy), gtk_range_set_update_policy)
  _WRAP_METHOD(UpdateType get_update_policy() const, gtk_range_get_update_policy)
  _WRAP_METHOD(void set_adjustment(Gtk::Adjustment& adjustment), gtk_range_set_adjustment)
  void unset_adjustment();

  _WRAP_METHOD(Gtk::Adjustment* get_adjustment(), gtk_range_get_adjustment)
  _WRAP_METHOD(const Gtk::Adjustment* get_adjustment() const, gtk_range_get_adjustment, constversion)
  _WRAP_METHOD(void set_inverted(bool setting = true), gtk_range_set_inverted)
  _WRAP_METHOD(bool get_inverted() const, gtk_range_get_inverted)

  _WRAP_METHOD(void set_lower_stepper_sensitivity(SensitivityType sensitivity), gtk_range_set_lower_stepper_sensitivity)
  _WRAP_METHOD(SensitivityType get_lower_stepper_sensitivity() const, gtk_range_get_lower_stepper_sensitivity)
  _WRAP_METHOD(void set_upper_stepper_sensitivity(SensitivityType sensitivity), gtk_range_set_upper_stepper_sensitivity)
  _WRAP_METHOD(SensitivityType get_upper_stepper_sensitivity() const, gtk_range_get_upper_stepper_sensitivity)

  _WRAP_METHOD(void set_increments(double step, double  page), gtk_range_set_increments)
  _WRAP_METHOD(void set_range(double min, double max), gtk_range_set_range)
  _WRAP_METHOD(void set_value(double value), gtk_range_set_value)
  _WRAP_METHOD(double get_value() const, gtk_range_get_value)

  _WRAP_METHOD(void set_show_fill_level(bool show_fill_level = true), gtk_range_set_show_fill_level)
  _WRAP_METHOD(bool get_show_fill_level() const, gtk_range_get_show_fill_level)
  _WRAP_METHOD(void set_restrict_to_fill_level(bool restrict_to_fill_level = true), gtk_range_set_restrict_to_fill_level)
  _WRAP_METHOD(bool get_restrict_to_fill_level() const, gtk_range_get_restrict_to_fill_level)
  _WRAP_METHOD(void set_fill_level(double fill_level), gtk_range_set_fill_level)
  _WRAP_METHOD(double get_fill_level() const, gtk_range_get_fill_level)

  _WRAP_SIGNAL(void value_changed(), "value_changed")
  _WRAP_SIGNAL(void adjust_bounds(double new_value), "adjust_bounds")
  _WRAP_SIGNAL(void move_slider(ScrollType scroll), "move_slider")
  
  //We use no_default_handler for this, because we can not add a new vfunc to 2.5 without breaking ABI.
  //TODO: Remove no_default_handler when we do an ABI-break-with-parallel-install.
  /** The change_value signal is emitted when a scroll action is
   * performed on a range.  It allows an application to determine the
   * type of scroll event that occurred and the resultant new value.
   * The application can handle the event itself and return true to
   * prevent further processing.  Or, by returning false, it can pass
   * the event to other handlers until the default GTK+ handler is
   * reached.
   *
   * The value parameter is unrounded.  An application that overrides
   * the change_value signal is responsible for clamping the value to
   * the desired number of decimal digits; the default handler 
   * clamps the value based on range->round_digits.
   *
   * It is not possible to use delayed update policies in an overridden
   * change_value handler.
   *
   * @param scroll the type of scroll action that was performed.
   * @param new_value the new value resulting from the scroll action.
   * @result true to prevent other handlers from being invoked for the
   * signal, or false to propagate the signal further.
   */
  _WRAP_SIGNAL(bool change_value(ScrollType scroll, double new_value), "change_value", no_default_handler)

  _WRAP_PROPERTY("update-policy", UpdateType)
  _WRAP_PROPERTY("adjustment", Adjustment*)
  _WRAP_PROPERTY("inverted", bool)
  _WRAP_PROPERTY("lower-stepper-sensitivity", SensitivityType)
  _WRAP_PROPERTY("upper-stepper-sensitivity", SensitivityType)
  _WRAP_PROPERTY("show-fill-level", bool)
  _WRAP_PROPERTY("restrict-to-fill-level", bool)
  _WRAP_PROPERTY("fill-level", double)
  
protected:
  _WRAP_VFUNC(void get_range_border(GtkBorder* border) const, get_range_border)
};

} // namespace Gtk

