/* Copyright (C) 2007 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, see . */ _CONFIGINCLUDE(gtkmmconfig.h) #include #include #include #include #include _DEFS(gtkmm,gtk) _PINCLUDE(gtkmm/private/button_p.h) namespace Gtk { /** A button which pops up a scale widget. * * This kind of widget is commonly used for volume controls in multimedia * applications, and there is a Gtk::VolumeButton subclass that is tailored * for this use case. * * @ingroup Widgets * @newin{2,12} */ class GTKMM_API ScaleButton : public Button, public Orientable { _CLASS_GTKOBJECT(ScaleButton, GtkScaleButton, GTK_SCALE_BUTTON, Gtk::Button, GtkButton, , , GTKMM_API) _IMPLEMENTS_INTERFACE(Orientable) public: //We custom-implement the constructor because gtk_scale_button_new() does more than just call g_object_new(). /** Creates a GtkScaleButton, with a range between min and max , with a stepping of step. * * @param size A stock icon size. * @param min The minimum value of the scale (usually 0). * @param max The maximum value of the scale (usually 100). * @param step The stepping of value when a scroll-wheel event, or up/down arrow event occurs (usually 2). * @param icons A vector of icon names. */ explicit ScaleButton(IconSize size, double min, double max, double step, const std::vector& icons); _IGNORE(gtk_scale_button_new) //We add the constructor without icons because the C functions allows that to be NULL. /** Creates a GtkScaleButton, with a range between min and max , with a stepping of step. * * @param size A stock icon size. * @param min The minimum value of the scale (usually 0). * @param max The maximum value of the scale (usually 100). * @param step The stepping of value when a scroll-wheel event, or up/down arrow event occurs (usually 2). * * @newin{3,16} */ explicit ScaleButton(IconSize size, double min, double max, double step); #m4 _CONVERSION(`const std::vector&',`const gchar**',`Glib::ArrayHandler::vector_to_array($3).data ()') _WRAP_METHOD(void set_icons(const std::vector& icons), gtk_scale_button_set_icons) _WRAP_METHOD(double get_value() const, gtk_scale_button_get_value) _WRAP_METHOD(void set_value(double value), gtk_scale_button_set_value) _WRAP_METHOD(Glib::RefPtr get_adjustment(), gtk_scale_button_get_adjustment, refreturn) _WRAP_METHOD(Glib::RefPtr get_adjustment() const, gtk_scale_button_get_adjustment, refreturn, constversion) _WRAP_METHOD(void set_adjustment(const Glib::RefPtr& adjustment), gtk_scale_button_set_adjustment) //TODO: Change the Widget* return type to Gtk::Button: https://bugzilla.gnome.org/show_bug.cgi?id=539944 _WRAP_METHOD(Widget* get_plus_button(), gtk_scale_button_get_plus_button) _WRAP_METHOD(const Widget* get_plus_button() const, gtk_scale_button_get_plus_button, constversion) //TODO: Change the Widget* return type to Gtk::Button: https://bugzilla.gnome.org/show_bug.cgi?id=539944 _WRAP_METHOD(Widget* get_minus_button(), gtk_scale_button_get_minus_button) _WRAP_METHOD(const Widget* get_minus_button() const, gtk_scale_button_get_minus_button, constversion) //TODO: Use a more specific return type? _WRAP_METHOD(Gtk::Widget* get_popup(), gtk_scale_button_get_popup) _WRAP_METHOD(const Gtk::Widget* get_popup() const, gtk_scale_button_get_popup) _WRAP_SIGNAL(void value_changed(double value), "value_changed") //Ignore key-binding signals: _IGNORE_SIGNAL("popup") _IGNORE_SIGNAL("popdown") _WRAP_PROPERTY("value", double) _WRAP_PROPERTY("size", IconSize) _WRAP_PROPERTY("adjustment", Adjustment*) _WRAP_PROPERTY("icons", std::vector) }; } // namespace Gtk