/* $Id: colorbutton.hg,v 1.5 2005/11/30 14:10:49 murrayc Exp $ */ /* colorbutton.h * * 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 Library General Public * License as published by the Free Software Foundation; either * version 2 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include _DEFS(gtkmm,gtk) _PINCLUDE(gtkmm/private/button_p.h) namespace Gtk { /** 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. * * @ingroup Widgets */ class ColorButton : public Button { _CLASS_GTKOBJECT(ColorButton, GtkColorButton, GTK_COLOR_BUTTON, Gtk::Button, GtkButton) 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. * * @newin2p4 */ _CTOR_DEFAULT() _IGNORE(gtk_color_button_new) /** 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. * * @newin2p4 */ _WRAP_CTOR(ColorButton(const Gdk::Color& color), gtk_color_button_new_with_color) _WRAP_METHOD(void set_color(const Gdk::Color& color), gtk_color_button_set_color) _WRAP_METHOD(void set_alpha(guint16 alpha), gtk_color_button_set_alpha) /** 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. * * @newin2p4 */ Gdk::Color get_color() const; _IGNORE(gtk_color_button_get_color) _WRAP_METHOD(guint16 get_alpha() const, gtk_color_button_get_alpha) _WRAP_METHOD(void set_use_alpha(bool use_alpha = true), gtk_color_button_set_use_alpha) _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) _WRAP_PROPERTY("alpha", guint16) /** The color_set signal is emitted when the user selects a color. When handling this signal, * use get_color() and get_alpha() to find out which color * was just selected. */ _WRAP_SIGNAL(void color_set(), "color-set") }; } // namespace Gtk