// Generated by gmmproc 2.77.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gtkmm/scale.h>
#include <gtkmm/private/scale_p.h>


/*
 * 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 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/adjustment.h>

#include <gtk/gtk.h>
#include <math.h>
#include <cstring> //For strlen()
#include <memory>

using std::strlen;

namespace
{
extern "C"
{
static char* SignalProxy_Scale_format_value_callback(GtkScale* /* scale */,
  double value, gpointer user_data)
{
  auto the_slot = static_cast<Gtk::Scale::SlotFormatValue*>(user_data);

  try
  {
    return g_strdup(((*the_slot)(value)).c_str());
  }
  catch (...)
  {
    Glib::exception_handlers_invoke();
  }
  return g_strdup("?");
}

static void SignalProxy_Scale_format_value_callback_destroy(void* data)
{
  delete static_cast<Gtk::Scale::SlotFormatValue*>(data);
}
} // extern "C"
} // anonymous namespace

namespace Gtk
{

Scale::Scale(Orientation orientation)
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(nullptr),
  Range(Glib::ConstructParams(scale_class_.init(), "orientation",(GtkOrientation)(orientation), nullptr))
{
}

Scale::Scale(const Glib::RefPtr<Adjustment>& adjustment, Orientation orientation)
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(nullptr),
  Range(Glib::ConstructParams(scale_class_.init(), "adjustment",Glib::unwrap(adjustment),"orientation",(GtkOrientation)(orientation), nullptr))
{
}

void Scale::set_format_value_func(const SlotFormatValue& slot)
{
  // Create a copy of the slot object. A pointer to this will be passed
  // through the callback's data parameter. It will be deleted
  // when SignalProxy_Scale_format_value_callback_destroy() is called.
  auto slot_copy = new SlotFormatValue(slot);

  gtk_scale_set_format_value_func(gobj(),
    &SignalProxy_Scale_format_value_callback, slot_copy,
    &SignalProxy_Scale_format_value_callback_destroy);
}

void Scale::unset_format_value_func()
{
  gtk_scale_set_format_value_func(gobj(), nullptr, nullptr, nullptr);
}

} // namespace Gtk

namespace
{
} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */

namespace Gtk
{


/* The *_Class implementation: */

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

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

  }

  return *this;
}


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


}


Glib::ObjectBase* Scale_Class::wrap_new(GObject* o)
{
  return manage(new Scale((GtkScale*)(o)));

}


/* The implementation: */

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

Scale::Scale(GtkScale* castitem)
:
  Gtk::Range((GtkRange*)(castitem))
{
  }


Scale::Scale(Scale&& src) noexcept
: Gtk::Range(std::move(src))
{}

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

Scale::~Scale() noexcept
{
  destroy_();
}

Scale::CppClassType Scale::scale_class_; // initialize static member

GType Scale::get_type()
{
  return scale_class_.init().get_type();
}


GType Scale::get_base_type()
{
  return gtk_scale_get_type();
}


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

}

void Scale::set_digits(int digits)
{
  gtk_scale_set_digits(gobj(), digits);
}

int Scale::get_digits() const
{
  return gtk_scale_get_digits(const_cast<GtkScale*>(gobj()));
}

void Scale::set_draw_value(bool draw_value)
{
  gtk_scale_set_draw_value(gobj(), static_cast<int>(draw_value));
}

bool Scale::get_draw_value() const
{
  return gtk_scale_get_draw_value(const_cast<GtkScale*>(gobj()));
}

void Scale::set_value_pos(PositionType pos)
{
  gtk_scale_set_value_pos(gobj(), static_cast<GtkPositionType>(pos));
}

PositionType Scale::get_value_pos() const
{
  return static_cast<PositionType>(gtk_scale_get_value_pos(const_cast<GtkScale*>(gobj())));
}

void Scale::set_has_origin(bool has_origin)
{
  gtk_scale_set_has_origin(gobj(), static_cast<int>(has_origin));
}

bool Scale::get_has_origin() const
{
  return gtk_scale_get_has_origin(const_cast<GtkScale*>(gobj()));
}

Glib::RefPtr<Pango::Layout> Scale::get_layout()
{
  auto retvalue = Glib::wrap(gtk_scale_get_layout(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Pango::Layout> Scale::get_layout() const
{
  return const_cast<Scale*>(this)->get_layout();
}

void Scale::get_layout_offsets(int& x, int& y) const
{
  gtk_scale_get_layout_offsets(const_cast<GtkScale*>(gobj()), &(x), &(y));
}

void Scale::add_mark(double value, PositionType position, const Glib::ustring& markup)
{
  gtk_scale_add_mark(gobj(), value, static_cast<GtkPositionType>(position), markup.c_str());
}

void Scale::clear_marks()
{
  gtk_scale_clear_marks(gobj());
}


Glib::PropertyProxy< int > Scale::property_digits() 
{
  return Glib::PropertyProxy< int >(this, "digits");
}

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

Glib::PropertyProxy< bool > Scale::property_draw_value() 
{
  return Glib::PropertyProxy< bool >(this, "draw-value");
}

Glib::PropertyProxy_ReadOnly< bool > Scale::property_draw_value() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "draw-value");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<PositionType>::value,
  "Type PositionType cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< PositionType > Scale::property_value_pos() 
{
  return Glib::PropertyProxy< PositionType >(this, "value-pos");
}

Glib::PropertyProxy_ReadOnly< PositionType > Scale::property_value_pos() const
{
  return Glib::PropertyProxy_ReadOnly< PositionType >(this, "value-pos");
}

Glib::PropertyProxy< bool > Scale::property_has_origin() 
{
  return Glib::PropertyProxy< bool >(this, "has-origin");
}

Glib::PropertyProxy_ReadOnly< bool > Scale::property_has_origin() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "has-origin");
}


} // namespace Gtk


