/*
 * 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 <gtkmm/range.h>
#include <gtkmm/label.h>
#include <gdkmm/rectangle.h>
#include <gxwmm/controlparameter.h>

_DEFS(gxwmm,gxw)
_PINCLUDE(gtkmm/private/range_p.h)

namespace Gxw {

class Regler: public Gtk::Range, public ControlParameter {
	_CLASS_GTKOBJECT(Regler,GxRegler,GX_REGLER,Gtk::Range,GtkRange)
	_IMPLEMENTS_INTERFACE(ControlParameter)
	public:
	_WRAP_METHOD(void set_label_ref(Gtk::Label*), gx_regler_set_label_ref)
	_WRAP_METHOD(Gtk::Label* get_label_ref(), gx_regler_get_label_ref)
	_WRAP_METHOD(void set_show_value(bool), gx_regler_set_show_value)
	_WRAP_METHOD(bool get_show_value(), gx_regler_get_show_value)
	_WRAP_METHOD(void set_value_position(Gtk::PositionType), gx_regler_set_value_position)
	_WRAP_METHOD(Gtk::PositionType get_value_position(), gx_regler_get_value_position)
#m4 _CONVERSION(`GdkRectangle*', `const Gdk::Rectangle&', Glib::wrap($3))
	_WRAP_SIGNAL(bool value_entry(const Gdk::Rectangle&, GdkEventButton*), "value-entry")
	_WRAP_SIGNAL(int input_value(void *spin, void *new_val), "input-value")
	_WRAP_PROPERTY("label-ref", Gtk::Label)
	_WRAP_PROPERTY("show-value", bool)
	_WRAP_PROPERTY("value-xalign", double)
	_WRAP_PROPERTY("digits", int)
	_WRAP_PROPERTY("value-position", Gtk::PositionType)

#m4 dnl// The ::format_value signal handler should return a newly allocated string.
#m4 _CONVERSION(`Glib::ustring',`gchar*',`(strlen($3.c_str()) ? g_strdup($3.c_str()) : 0)')
	_WRAP_SIGNAL(Glib::ustring format_value(double value), "format_value")

	protected:
	_CTOR_DEFAULT
};

} // namespace Gxw
