/* Copyright (C) 2003 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 . */ #include #ifndef GTKMM_DISABLE_DEPRECATED #include #endif #include _DEFS(gtkmm,gtk) _PINCLUDE(gtkmm/private/button_p.h) #m4 _PUSH(SECTION_CC_PRE_INCLUDES) #undef GTK_DISABLE_DEPRECATED #define GDK_DISABLE_DEPRECATION_WARNINGS 1 #m4 _POP() namespace Gtk { //TODO: Derive from (and implement) ColorChooser when we can break ABI. /** A button to launch a color selection dialog. * * The GtkColorButton is a button which displays the currently selected color an allows to * open a color selection dialog to change the color. It is suitable widget for selecting a * color in a preference dialog. * * The ColorButton widget looks like this: * @image html colorbutton1.png * * @ingroup Widgets */ class GTKMM_API ColorButton : public Button //TODO: When we can break ABI: public ColorChooser { _CLASS_GTKOBJECT(ColorButton, GtkColorButton, GTK_COLOR_BUTTON, Gtk::Button, GtkButton, , , GTKMM_API) //TODO: When we can break ABI: _IMPLEMENTS_INTERFACE(ColorChooser) public: /** Creates a new color button. * * This creates a widget in the form of a small button containing a swatch representing * the current selected color. When the button is clicked, a color-selection dialog will * open, allowing the user to select a color. The swatch will be updated to reflect the * new color when the user finishes. * * @newin{2,4} */ _CTOR_DEFAULT() _IGNORE(gtk_color_button_new) // _WRAP_CTOR does not take a 'deprecated' parameter. // _WRAP_CTOR(ColorButton(const Gdk::Color& color), gtk_color_button_new_with_color) #ifndef GTKMM_DISABLE_DEPRECATED /** Creates a new color button with a predefined color. * * Same as Gtk::ColorButton::ColorButton(). Additionally takes a Gdk::Color and * initializes the button with this color. Equivalent to calling set_color(@a color) * after the default constructor. * * @param color A Gdk::Color to set the current color with. * * @newin{2,4} * @deprecated "Use the constructor that takes a Gdk::RGBA instead." */ explicit ColorButton(const Gdk::Color& color); _IGNORE(gtk_color_button_new_with_color) #endif //GTKMM_DISABLE_DEPRECATED /** Creates a new color button with a predefined color. * * Same as Gtk::ColorButton::ColorButton(). Additionally takes a Gdk::RGBA and * initializes the button with this color. Equivalent to calling set_rgba(@a color) * after the default constructor. * * @param rgba A Gdk::RGBA to set the current color with. * * @newin{3,0} */ _WRAP_CTOR(ColorButton(const Gdk::RGBA& rgba), gtk_color_button_new_with_rgba) //TODO: When we can implement interface ColorChooser: deprecated "Use Gtk::ColorChooser::set_rgba() instead." _WRAP_METHOD(void set_color(const Gdk::Color& color), gtk_color_button_set_color, deprecated "Use set_rgba() instead.") //TODO: When we can implement interface ColorChooser: deprecated "Use Gtk::ColorChooser::set_rgba() instead." _WRAP_METHOD(void set_alpha(guint16 alpha), gtk_color_button_set_alpha, deprecated "Use set_rgba() instead.") //TODO: When we can implement interface ColorChooser: deprecated "Use Gtk::ColorChooser::set_rgba() instead." _WRAP_METHOD(void set_rgba(const Gdk::RGBA& rgba), gtk_color_button_set_rgba) #ifndef GTKMM_DISABLE_DEPRECATED //TODO: When we can implement interface ColorChooser: deprecated Use Gtk::ColorChooser::get_rgba() instead. /** Returns a copy of the the current color. * * Changes to the return value will have no effect on the Gtk::ColorButton. * * @return A Gdk::Color representing the current internal color of the Gtk::ColorButton. * * @newin{2,4} * @deprecated Use get_rgba() instead. */ Gdk::Color get_color() const; _IGNORE(gtk_color_button_get_color) #endif //GTKMM_DISABLE_DEPRECATED //TODO: When we can implement interface ColorChooser: deprecated Use Gtk::ColorChooser::get_rgba() instead. /** Returns a copy of the the current color. * * Changes to the return value will have no effect on the Gtk::ColorButton. * * @return A Gdk::RGBA representing the current internal color of the Gtk::ColorButton. * * @newin{3,0} */ Gdk::RGBA get_rgba() const; _IGNORE(gtk_color_button_get_rgba) //TODO: When we can implement interface ColorChooser: deprecated "Use Gtk::ColorChooser::get_rgba() instead." _WRAP_METHOD(guint16 get_alpha() const, gtk_color_button_get_alpha, deprecated "Use get_rgba() instead.") //TODO: When we can implement interface ColorChooser: deprecated "Use Gtk::ColorChooser::set_use_alpha() instead." _WRAP_METHOD(void set_use_alpha(bool use_alpha = true), gtk_color_button_set_use_alpha) //TODO: When we can implement interface ColorChooser: deprecated "Use Gtk::ColorChooser::get_use_alpha() instead." _WRAP_METHOD(bool get_use_alpha() const, gtk_color_button_get_use_alpha) _WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_color_button_set_title) _WRAP_METHOD(Glib::ustring get_title() const, gtk_color_button_get_title) _WRAP_PROPERTY("use-alpha", bool) _WRAP_PROPERTY("title", Glib::ustring) _WRAP_PROPERTY("color", Gdk::Color, deprecated "Use property_rgba() instead.") _WRAP_PROPERTY("rgba", Gdk::RGBA) _WRAP_PROPERTY("alpha", guint16) //Todo: Remove this when we remove the "color" property too. _WRAP_PROPERTY("show-editor", bool) _WRAP_SIGNAL(void color_set(), "color-set") }; } // namespace Gtk