// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gtkmm/range.h>
#include <gtkmm/private/range_p.h>

// -*- c++ -*-
/* $Id: range.ccg,v 1.1 2003/01/21 13:40:35 murrayc Exp $ */

/* Copyright 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 <gtk/gtkrange.h>
#include <gtkmm/adjustment.h>

namespace Gtk
{

void Range::unset_adjustment()
{
  gtk_range_set_adjustment(gobj(), 0);
}

} // namespace Gtk


namespace
{


static const Glib::SignalProxyInfo Range_signal_value_changed_info =
{
  "value_changed",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static void Range_signal_adjust_bounds_callback(GtkRange* self, gdouble p0,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,double > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(p0
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Range_signal_adjust_bounds_info =
{
  "adjust_bounds",
  (GCallback) &Range_signal_adjust_bounds_callback,
  (GCallback) &Range_signal_adjust_bounds_callback
};


static void Range_signal_move_slider_callback(GtkRange* self, GtkScrollType p0,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,ScrollType > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(((ScrollType)(p0))
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Range_signal_move_slider_info =
{
  "move_slider",
  (GCallback) &Range_signal_move_slider_callback,
  (GCallback) &Range_signal_move_slider_callback
};


static gboolean Range_signal_change_value_callback(GtkRange* self, GtkScrollType p0,gdouble p1,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< bool,ScrollType,double > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        return static_cast<int>((*static_cast<SlotType*>(slot))(((ScrollType)(p0))
, p1
));
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }

  typedef gboolean RType;
  return RType();
}

static gboolean Range_signal_change_value_notify_callback(GtkRange* self, GtkScrollType p0,gdouble p1, void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,ScrollType,double > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(((ScrollType)(p0))
, p1
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }

  typedef gboolean RType;
  return RType();
}

static const Glib::SignalProxyInfo Range_signal_change_value_info =
{
  "change_value",
  (GCallback) &Range_signal_change_value_callback,
  (GCallback) &Range_signal_change_value_notify_callback
};


} // anonymous namespace

// static
GType Glib::Value<Gtk::SensitivityType>::value_type()
{
  return gtk_sensitivity_type_get_type();
}


namespace Glib
{

Gtk::Range* wrap(GtkRange* object, bool take_copy)
{
  return dynamic_cast<Gtk::Range *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}

} /* namespace Glib */

namespace Gtk
{


/* The *_Class implementation: */

const Glib::Class& Range_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Range_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gtk_range_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  }

  return *this;
}

void Range_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);

#ifdef GLIBMM_VFUNCS_ENABLED
  klass->get_range_border = &get_range_border_vfunc_callback;
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
  klass->value_changed = &value_changed_callback;
  klass->adjust_bounds = &adjust_bounds_callback;
  klass->move_slider = &move_slider_callback;
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
void Range_Class::get_range_border_vfunc_callback(GtkRange* self, GtkBorder* border)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->get_range_border_vfunc(border);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->get_range_border)
    (*base->get_range_border)(self, border);

}
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Range_Class::value_changed_callback(GtkRange* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_value_changed();
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->value_changed)
    (*base->value_changed)(self);
}
void Range_Class::adjust_bounds_callback(GtkRange* self, gdouble p0)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_adjust_bounds(p0
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->adjust_bounds)
    (*base->adjust_bounds)(self, p0);
}
void Range_Class::move_slider_callback(GtkRange* self, GtkScrollType p0)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_move_slider(((ScrollType)(p0))
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->move_slider)
    (*base->move_slider)(self, p0);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* Range_Class::wrap_new(GObject* o)
{
  return manage(new Range((GtkRange*)(o)));

}


/* The implementation: */

Range::Range(const Glib::ConstructParams& construct_params)
:
  Gtk::Widget(construct_params)
{
  }

Range::Range(GtkRange* castitem)
:
  Gtk::Widget((GtkWidget*)(castitem))
{
  }

Range::~Range()
{
  destroy_();
}

Range::CppClassType Range::range_class_; // initialize static member

GType Range::get_type()
{
  return range_class_.init().get_type();
}

GType Range::get_base_type()
{
  return gtk_range_get_type();
}


Range::Range()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Gtk::Widget(Glib::ConstructParams(range_class_.init()))
{
  }

void Range::set_update_policy(UpdateType policy)
{
gtk_range_set_update_policy(gobj(), ((GtkUpdateType)(policy))); 
}

UpdateType Range::get_update_policy() const
{
  return ((UpdateType)(gtk_range_get_update_policy(const_cast<GtkRange*>(gobj()))));
}

void Range::set_adjustment(Gtk::Adjustment& adjustment)
{
gtk_range_set_adjustment(gobj(), (adjustment).gobj()); 
}

Gtk::Adjustment* Range::get_adjustment()
{
  return Glib::wrap(gtk_range_get_adjustment(gobj()));
}

const Gtk::Adjustment* Range::get_adjustment() const
{
  return const_cast<Range*>(this)->get_adjustment();
}

void Range::set_inverted(bool setting)
{
gtk_range_set_inverted(gobj(), static_cast<int>(setting)); 
}

bool Range::get_inverted() const
{
  return gtk_range_get_inverted(const_cast<GtkRange*>(gobj()));
}

void Range::set_lower_stepper_sensitivity(SensitivityType sensitivity)
{
gtk_range_set_lower_stepper_sensitivity(gobj(), ((GtkSensitivityType)(sensitivity))); 
}

SensitivityType Range::get_lower_stepper_sensitivity() const
{
  return ((SensitivityType)(gtk_range_get_lower_stepper_sensitivity(const_cast<GtkRange*>(gobj()))));
}

void Range::set_upper_stepper_sensitivity(SensitivityType sensitivity)
{
gtk_range_set_upper_stepper_sensitivity(gobj(), ((GtkSensitivityType)(sensitivity))); 
}

SensitivityType Range::get_upper_stepper_sensitivity() const
{
  return ((SensitivityType)(gtk_range_get_upper_stepper_sensitivity(const_cast<GtkRange*>(gobj()))));
}

void Range::set_increments(double step, double page)
{
gtk_range_set_increments(gobj(), step, page); 
}

void Range::set_range(double min, double max)
{
gtk_range_set_range(gobj(), min, max); 
}

void Range::set_value(double value)
{
gtk_range_set_value(gobj(), value); 
}

double Range::get_value() const
{
  return gtk_range_get_value(const_cast<GtkRange*>(gobj()));
}


Glib::SignalProxy0< void > Range::signal_value_changed()
{
  return Glib::SignalProxy0< void >(this, &Range_signal_value_changed_info);
}


Glib::SignalProxy1< void,double > Range::signal_adjust_bounds()
{
  return Glib::SignalProxy1< void,double >(this, &Range_signal_adjust_bounds_info);
}


Glib::SignalProxy1< void,ScrollType > Range::signal_move_slider()
{
  return Glib::SignalProxy1< void,ScrollType >(this, &Range_signal_move_slider_info);
}


Glib::SignalProxy2< bool,ScrollType,double > Range::signal_change_value()
{
  return Glib::SignalProxy2< bool,ScrollType,double >(this, &Range_signal_change_value_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<UpdateType> Range::property_update_policy() 
{
  return Glib::PropertyProxy<UpdateType>(this, "update-policy");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<UpdateType> Range::property_update_policy() const
{
  return Glib::PropertyProxy_ReadOnly<UpdateType>(this, "update-policy");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Adjustment*> Range::property_adjustment() 
{
  return Glib::PropertyProxy<Adjustment*>(this, "adjustment");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Adjustment*> Range::property_adjustment() const
{
  return Glib::PropertyProxy_ReadOnly<Adjustment*>(this, "adjustment");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Range::property_inverted() 
{
  return Glib::PropertyProxy<bool>(this, "inverted");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Range::property_inverted() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "inverted");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<SensitivityType> Range::property_lower_stepper_sensitivity() 
{
  return Glib::PropertyProxy<SensitivityType>(this, "lower-stepper-sensitivity");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<SensitivityType> Range::property_lower_stepper_sensitivity() const
{
  return Glib::PropertyProxy_ReadOnly<SensitivityType>(this, "lower-stepper-sensitivity");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<SensitivityType> Range::property_upper_stepper_sensitivity() 
{
  return Glib::PropertyProxy<SensitivityType>(this, "upper-stepper-sensitivity");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<SensitivityType> Range::property_upper_stepper_sensitivity() const
{
  return Glib::PropertyProxy_ReadOnly<SensitivityType>(this, "upper-stepper-sensitivity");
}
#endif //GLIBMM_PROPERTIES_ENABLED


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Gtk::Range::on_value_changed()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->value_changed)
    (*base->value_changed)(gobj());
}
void Gtk::Range::on_adjust_bounds(double new_value)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->adjust_bounds)
    (*base->adjust_bounds)(gobj(),new_value);
}
void Gtk::Range::on_move_slider(ScrollType scroll)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->move_slider)
    (*base->move_slider)(gobj(),((GtkScrollType)(scroll)));
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
void Gtk::Range::get_range_border_vfunc(GtkBorder* border) const
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->get_range_border)
    (*base->get_range_border)(const_cast<GtkRange*>(gobj()),border);
}
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gtk


