1 /* $Id: colorbutton.hg,v 1.5 2005/11/30 14:10:49 murrayc Exp $ */
5 * Copyright (C) 2003 The gtkmm Development Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <gtkmm/button.h>
23 #include <gdkmm/color.h>
25 _PINCLUDE(gtkmm/private/button_p.h)
31 /** A button to launch a color selection dialog.
33 * The GtkColorButton is a button which displays the currently selected color an allows to
34 * open a color selection dialog to change the color. It is suitable widget for selecting a
35 * color in a preference dialog.
39 class ColorButton : public Button
41 _CLASS_GTKOBJECT(ColorButton, GtkColorButton, GTK_COLOR_BUTTON, Gtk::Button, GtkButton)
44 /** Creates a new color button.
46 * This creates a widget in the form of a small button containing a swatch representing
47 * the current selected color. When the button is clicked, a color-selection dialog will
48 * open, allowing the user to select a color. The swatch will be updated to reflect the
49 * new color when the user finishes.
54 _IGNORE(gtk_color_button_new)
56 /** Creates a new color button with a predefined color.
58 * Same as Gtk::ColorButton::ColorButton(). Additionally takes a Gdk::Color and
59 * initializes the button with this color. Equivalent to calling set_color(@a color)
60 * after the default constructor.
62 * @param color A Gdk::Color to set the current color with.
66 _WRAP_CTOR(ColorButton(const Gdk::Color& color), gtk_color_button_new_with_color)
68 _WRAP_METHOD(void set_color(const Gdk::Color& color), gtk_color_button_set_color)
69 _WRAP_METHOD(void set_alpha(guint16 alpha), gtk_color_button_set_alpha)
71 /** Returns a copy of the the current color.
73 * Changes to the return value will have no effect on the Gtk::ColorButton.
75 * @return A Gdk::Color representing the current internal color of the Gtk::ColorButton.
79 Gdk::Color get_color() const;
80 _IGNORE(gtk_color_button_get_color)
82 _WRAP_METHOD(guint16 get_alpha() const, gtk_color_button_get_alpha)
83 _WRAP_METHOD(void set_use_alpha(bool use_alpha = true), gtk_color_button_set_use_alpha)
84 _WRAP_METHOD(bool get_use_alpha() const, gtk_color_button_get_use_alpha)
85 _WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_color_button_set_title)
86 _WRAP_METHOD(Glib::ustring get_title() const, gtk_color_button_get_title)
88 _WRAP_PROPERTY("use-alpha", bool)
89 _WRAP_PROPERTY("title", Glib::ustring)
90 _WRAP_PROPERTY("color", Gdk::Color)
91 _WRAP_PROPERTY("alpha", guint16)
93 /** The color_set signal is emitted when the user selects a color. When handling this signal,
94 * use get_color() and get_alpha() to find out which color
97 _WRAP_SIGNAL(void color_set(), "color-set")