// Generated by gmmproc 2.66.7 -- 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;
  using SlotType = sigc::slot< bool,const Gdk::Rectangle&,GdkEventButton* >;

  auto obj = dynamic_cast<Regler*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        return static_cast<int>((*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, p1));
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }

  using RType = gboolean;
  return RType();
}

static gboolean Regler_signal_value_entry_notify_callback(GxRegler* self, GdkRectangle* p0,GdkEventButton* p1, void* data)
{
  using namespace Gxw;
  using SlotType = sigc::slot< void,const Gdk::Rectangle&,GdkEventButton* >;

  auto obj = dynamic_cast<Regler*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, p1);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }

  using RType = gboolean;
  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 gint Regler_signal_input_value_callback(GxRegler* self, gpointer p0,gpointer p1,void* data)
{
  using namespace Gxw;
  using SlotType = sigc::slot< int,void *,void * >;

  auto obj = dynamic_cast<Regler*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        return (*static_cast<SlotType*>(slot))(p0
, p1
);
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }

  using RType = gint;
  return RType();
}

static gint Regler_signal_input_value_notify_callback(GxRegler* self, gpointer p0,gpointer p1, void* data)
{
  using namespace Gxw;
  using SlotType = sigc::slot< void,void *,void * >;

  auto obj = dynamic_cast<Regler*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(p0
, p1
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }

  using RType = gint;
  return RType();
}

static const Glib::SignalProxyInfo Regler_signal_input_value_info =
{
  "input-value",
  (GCallback) &Regler_signal_input_value_callback,
  (GCallback) &Regler_signal_input_value_notify_callback
};


static gchar* Regler_signal_format_value_callback(GxRegler* self, gdouble p0,void* data)
{
  using namespace Gxw;
  using SlotType = sigc::slot< Glib::ustring,double >;

  auto obj = dynamic_cast<Regler*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto 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);
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }

  using RType = gchar*;
  return RType();
}

static gchar* Regler_signal_format_value_notify_callback(GxRegler* self, gdouble p0, void* data)
{
  using namespace Gxw;
  using SlotType = sigc::slot< void,double >;

  auto obj = dynamic_cast<Regler*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(p0
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }

  using RType = gchar*;
  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)
{
  const auto klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


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


gboolean Regler_Class::value_entry_callback(GxRegler* self, GdkRectangle* p0, GdkEventButton* p1)
{
  const auto 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_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->on_value_entry(Glib::wrap(p0)
, p1));
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  const auto 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);

  using RType = gboolean;
  return RType();
}
gint Regler_Class::input_value_callback(GxRegler* self, gpointer p0, gpointer p1)
{
  const auto 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_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return obj->on_input_value(p0
, p1
);
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  const auto 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->input_value)
    return (*base->input_value)(self, p0, p1);

  using RType = gint;
  return RType();
}
gchar* Regler_Class::format_value_callback(GxRegler* self, gdouble p0)
{
  const auto 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_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // 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);
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  const auto 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);

  using RType = gchar*;
  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(Regler&& src) noexcept
: Gtk::Range(std::move(src))
  , ControlParameter(std::move(src))
{}

Regler& Regler::operator=(Regler&& src) noexcept
{
  Gtk::Range::operator=(std::move(src));
  ControlParameter::operator=(std::move(src));
  return *this;
}

Regler::~Regler() noexcept
{
  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(nullptr),
  Gtk::Range(Glib::ConstructParams(regler_class_.init()))
{
  

}


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


Glib::SignalProxy< int,void *,void * > Regler::signal_input_value()
{
  return Glib::SignalProxy< int,void *,void * >(this, &Regler_signal_input_value_info);
}


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


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

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

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

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

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

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

Glib::PropertyProxy_ReadOnly< int > Regler::property_digits() const
{
  return Glib::PropertyProxy_ReadOnly< int >(this, "digits");
}

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

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


bool Gxw::Regler::on_value_entry(const Gdk::Rectangle& p1, GdkEventButton* p2)
{
  const auto 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);

  using RType = bool;
  return RType();
}
int Gxw::Regler::on_input_value(void * spin, void * new_val)
{
  const auto 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->input_value)
    return (*base->input_value)(gobj(),spin,new_val);

  using RType = int;
  return RType();
}
Glib::ustring Gxw::Regler::on_format_value(double value)
{
  const auto 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));

  using RType = Glib::ustring;
  return RType();
}


} // namespace Gxw


