add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / src / colorselection.hg
1 /* $Id: colorselection.hg,v 1.2 2004/02/10 14:50:11 murrayc Exp $ */
2
3 /* Copyright (C) 1998-2002 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 _DEFS(gtkmm,gtk)
21 _PINCLUDE(gtkmm/private/box_p.h)
22 _PINCLUDE(gtkmm/private/dialog_p.h)
23
24 #include <gtkmm/box.h>
25 #include <gtkmm/dialog.h>
26 #include <gtkmm/button.h>
27
28
29 namespace Gtk
30 {
31
32 /** A widget used to select a color.
33  *
34  * This widget is used to select a color. It
35  * consists of a color wheel and number of sliders and entry boxes for color
36  * parameters such as hue, saturation, value, red, green, blue, and opacity.
37  *
38  * It is found on the standard color selection dialog box
39  * Gtk::ColorSelectionDialog. 
40  *
41  * @ingroup Widgets
42  */
43 class ColorSelection : public VBox
44 {
45   _CLASS_GTKOBJECT(ColorSelection,GtkColorSelection,GTK_COLOR_SELECTION,Gtk::VBox,GtkVBox)
46   _IGNORE(gtk_color_selection_get_current_color, gtk_color_selection_get_previous_color,
47           gtk_color_selection_set_color, gtk_color_selection_get_color, gtk_color_selection_set_update_policy)
48 public:
49   _CTOR_DEFAULT()
50
51   _WRAP_METHOD(bool get_has_opacity_control() const, gtk_color_selection_get_has_opacity_control)
52   _WRAP_METHOD(void set_has_opacity_control(bool has_opacity = true), gtk_color_selection_set_has_opacity_control)
53   _WRAP_METHOD(bool get_has_palette() const, gtk_color_selection_get_has_palette)
54   _WRAP_METHOD(void set_has_palette(bool has_palette = true), gtk_color_selection_set_has_palette)
55   _WRAP_METHOD(void set_current_color(const Gdk::Color& color), gtk_color_selection_set_current_color)
56   _WRAP_METHOD(void set_current_alpha(guint16 alpha), gtk_color_selection_set_current_alpha)
57   Gdk::Color get_current_color() const;
58   _WRAP_METHOD(guint16 get_current_alpha() const, gtk_color_selection_get_current_alpha)
59   _WRAP_METHOD(void set_previous_color(const Gdk::Color& color), gtk_color_selection_set_previous_color)
60   _WRAP_METHOD(void set_previous_alpha(guint16 alpha), gtk_color_selection_set_previous_alpha)
61   Gdk::Color get_previous_color() const;
62   _WRAP_METHOD(guint16 get_previous_alpha() const, gtk_color_selection_get_previous_alpha)
63
64   _WRAP_METHOD(bool is_adjusting() const, gtk_color_selection_is_adjusting)
65
66   static Gdk::ArrayHandle_Color palette_from_string(const Glib::ustring& str);
67   static Glib::ustring palette_to_string(const Gdk::ArrayHandle_Color& colors);
68
69   typedef sigc::slot<void, const Glib::RefPtr<Gdk::Screen>&,
70                             const Gdk::ArrayHandle_Color&> SlotChangePaletteHook;
71
72   static SlotChangePaletteHook set_change_palette_hook(const SlotChangePaletteHook& slot);
73
74   _WRAP_SIGNAL(void color_changed(), "color_changed")
75
76   _WRAP_PROPERTY("has-palette", bool)
77   _WRAP_PROPERTY("has-opacity-control", bool)
78   _WRAP_PROPERTY("current-color", Gdk::Color)
79   _WRAP_PROPERTY("current-alpha", guint)
80 };
81
82 /** This dialog allows the user to select a color.
83  * @ingroup Dialogs
84  */
85 class ColorSelectionDialog : public Dialog
86 {
87   _CLASS_GTKOBJECT(ColorSelectionDialog,GtkColorSelectionDialog,GTK_COLOR_SELECTION_DIALOG,Gtk::Dialog,GtkDialog)
88   _UNMANAGEABLE()
89 public:
90
91   _CTOR_DEFAULT()
92   _WRAP_CTOR(ColorSelectionDialog(const Glib::ustring& title), gtk_color_selection_dialog_new)
93
94   _MEMBER_GET_PTR(colorsel,colorsel,ColorSelection*,GtkWidget*)
95   _MEMBER_GET_PTR(ok_button,ok_button,Button*,GtkWidget*)
96   _MEMBER_GET_PTR(cancel_button,cancel_button,Button*,GtkWidget*)
97   _MEMBER_GET_PTR(help_button,help_button,Button*,GtkWidget*)
98 };
99
100 } // namespace Gtk
101