// Generated by gtkmmproc -- DO NOT MODIFY!


#include <glibmm.h>

#include <gxwmm/regler.h>
#include <gxwmm/private/regler_p.h>


/*
 * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <gxw/GxRegler.h>
#include <string.h> // needed by some compiler because of generated strlen()

namespace
{


static gboolean Regler_signal_value_entry_callback(GxRegler* self, GdkRectangle* p0,GdkEventButton* p1,void* data)
{
  using namespace Gxw;
  typedef sigc::slot< bool,const Gdk::Rectangle&,GdkEventButton* > 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))(Glib::wrap(p0)
, p1));
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }

  typedef gboolean RType;
  return RType();
}

static gboolean Regler_signal_value_entry_notify_callback(GxRegler* self, GdkRectangle* p0,GdkEventButton* p1, void* data)
{
  using namespace Gxw;
  typedef sigc::slot< void,const Gdk::Rectangle&,GdkEventButton* > 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))(Glib::wrap(p0)
, p1);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }

  typedef gboolean RType;
  return RType();
}

static const Glib::SignalProxyInfo Regler_signal_value_entry_info =
{
  "value-entry",
  (GCallback) &Regler_signal_value_entry_callback,
  (GCallback) &Regler_signal_value_entry_notify_callback
};


static gchar* Regler_signal_format_value_callback(GxRegler* self, gdouble p0,void* data)
{
  using namespace Gxw;
  typedef sigc::slot< Glib::ustring,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 (strlen((*static_cast<SlotType*>(slot))(p0
).c_str()) ? g_strdup((*static_cast<SlotType*>(slot))(p0
).c_str()) : 0);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }

  typedef gchar* RType;
  return RType();
}

static gchar* Regler_signal_format_value_notify_callback(GxRegler* self, gdouble p0, void* data)
{
  using namespace Gxw;
  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
  }

  typedef gchar* RType;
  return RType();
}

static const Glib::SignalProxyInfo Regler_signal_format_value_info =
{
  "format_value",
  (GCallback) &Regler_signal_format_value_callback,
  (GCallback) &Regler_signal_format_value_notify_callback
};


} // anonymous namespace


namespace Glib
{

Gxw::Regler* wrap(GxRegler* object, bool take_copy)
{
  return dynamic_cast<Gxw::Regler *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}

} /* namespace Glib */

namespace Gxw
{


/* The *_Class implementation: */

const Glib::Class& Regler_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_ = &Regler_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(gx_regler_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  ControlParameter::add_interface(get_type());

  }

  return *this;
}


void Regler_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);


  klass->value_entry = &value_entry_callback;
  klass->format_value = &format_value_callback;
}


gboolean Regler_Class::value_entry_callback(GxRegler* self, GdkRectangle* p0, GdkEventButton* p1)
{
  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.
        return static_cast<int>(obj->on_value_entry(Glib::wrap(p0)
, p1));
      #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_entry)
    return (*base->value_entry)(self, p0, p1);

  typedef gboolean RType;
  return RType();
}
gchar* Regler_Class::format_value_callback(GxRegler* 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.
        return (strlen(obj->on_format_value(p0
).c_str()) ? g_strdup(obj->on_format_value(p0
).c_str()) : 0);
      #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->format_value)
    return (*base->format_value)(self, p0);

  typedef gchar* RType;
  return RType();
}


Glib::ObjectBase* Regler_Class::wrap_new(GObject* o)
{
  return manage(new Regler((GxRegler*)(o)));

}


/* The implementation: */

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

Regler::Regler(GxRegler* castitem)
:
  Gtk::Range((GtkRange*)(castitem))
{
  }

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

Regler::CppClassType Regler::regler_class_; // initialize static member

GType Regler::get_type()
{
  return regler_class_.init().get_type();
}


GType Regler::get_base_type()
{
  return gx_regler_get_type();
}


void Regler::set_label_ref(Gtk::Label* p1)
{
  gx_regler_set_label_ref(gobj(), (GtkLabel*)Glib::unwrap(p1)); 
}

Gtk::Label* Regler::get_label_ref()
{
  return Glib::wrap(gx_regler_get_label_ref(gobj()));
}

void Regler::set_show_value(bool p1)
{
  gx_regler_set_show_value(gobj(), static_cast<int>(p1)); 
}

bool Regler::get_show_value()
{
  return gx_regler_get_show_value(gobj());
}

void Regler::set_value_position(Gtk::PositionType p1)
{
  gx_regler_set_value_position(gobj(), ((GtkPositionType)(p1))); 
}

Gtk::PositionType Regler::get_value_position()
{
  return ((Gtk::PositionType)(gx_regler_get_value_position(gobj())));
}

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

}


Glib::SignalProxy2< bool,const Gdk::Rectangle&,GdkEventButton* > Regler::signal_value_entry()
{
  return Glib::SignalProxy2< bool,const Gdk::Rectangle&,GdkEventButton* >(this, &Regler_signal_value_entry_info);
}


Glib::SignalProxy1< Glib::ustring,double > Regler::signal_format_value()
{
  return Glib::SignalProxy1< Glib::ustring,double >(this, &Regler_signal_format_value_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< Gtk::Label > Regler::property_label_ref() 
{
  return Glib::PropertyProxy< Gtk::Label >(this, "label-ref");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Gtk::Label > Regler::property_label_ref() const
{
  return Glib::PropertyProxy_ReadOnly< Gtk::Label >(this, "label-ref");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< bool > Regler::property_show_value() 
{
  return Glib::PropertyProxy< bool >(this, "show-value");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< bool > Regler::property_show_value() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "show-value");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< double > Regler::property_value_xalign() 
{
  return Glib::PropertyProxy< double >(this, "value-xalign");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< double > Regler::property_value_xalign() const
{
  return Glib::PropertyProxy_ReadOnly< double >(this, "value-xalign");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< int > Regler::property_digits() const
{
  return Glib::PropertyProxy_ReadOnly< int >(this, "digits");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< Gtk::PositionType > Regler::property_value_position() 
{
  return Glib::PropertyProxy< Gtk::PositionType >(this, "value-position");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Gtk::PositionType > Regler::property_value_position() const
{
  return Glib::PropertyProxy_ReadOnly< Gtk::PositionType >(this, "value-position");
}
#endif //GLIBMM_PROPERTIES_ENABLED


bool Gxw::Regler::on_value_entry(const Gdk::Rectangle& p1, GdkEventButton* p2)
{
  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_entry)
    return (*base->value_entry)(gobj(),const_cast<GdkRectangle*>(p1.gobj()),p2);

  typedef bool RType;
  return RType();
}
Glib::ustring Gxw::Regler::on_format_value(double 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->format_value)
    return Glib::convert_const_gchar_ptr_to_ustring((*base->format_value)(gobj(),value));

  typedef Glib::ustring RType;
  return RType();
}


} // namespace Gxw


