add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / colorbutton.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_COLORBUTTON_H
4 #define _GTKMM_COLORBUTTON_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* colorbutton.h
12  *
13  * Copyright (C) 2003 The gtkmm Development Team
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library; if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29
30 #include <gtkmm/button.h>
31 #include <gdkmm/color.h>
32
33
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 typedef struct _GtkColorButton GtkColorButton;
36 typedef struct _GtkColorButtonClass GtkColorButtonClass;
37 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
38
39
40 namespace Gtk
41 { class ColorButton_Class; } // namespace Gtk
42 namespace Gtk
43 {
44
45 /** A button to launch a color selection dialog.
46  *
47  * The GtkColorButton is a button which displays the currently selected color an allows to
48  * open a color selection dialog to change the color. It is suitable widget for selecting a
49  * color in a preference dialog.
50  *
51  * @ingroup Widgets
52  */
53
54 class ColorButton : public Button
55 {
56   public:
57 #ifndef DOXYGEN_SHOULD_SKIP_THIS
58   typedef ColorButton CppObjectType;
59   typedef ColorButton_Class CppClassType;
60   typedef GtkColorButton BaseObjectType;
61   typedef GtkColorButtonClass BaseClassType;
62 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
63
64   virtual ~ColorButton();
65
66 #ifndef DOXYGEN_SHOULD_SKIP_THIS
67
68 private:
69   friend class ColorButton_Class;
70   static CppClassType colorbutton_class_;
71
72   // noncopyable
73   ColorButton(const ColorButton&);
74   ColorButton& operator=(const ColorButton&);
75
76 protected:
77   explicit ColorButton(const Glib::ConstructParams& construct_params);
78   explicit ColorButton(GtkColorButton* castitem);
79
80 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
81
82 public:
83 #ifndef DOXYGEN_SHOULD_SKIP_THIS
84   static GType get_type()      G_GNUC_CONST;
85   static GType get_base_type() G_GNUC_CONST;
86 #endif
87
88   ///Provides access to the underlying C GtkObject.
89   GtkColorButton*       gobj()       { return reinterpret_cast<GtkColorButton*>(gobject_); }
90
91   ///Provides access to the underlying C GtkObject.
92   const GtkColorButton* gobj() const { return reinterpret_cast<GtkColorButton*>(gobject_); }
93
94
95 public:
96   //C++ methods used to invoke GTK+ virtual functions:
97 #ifdef GLIBMM_VFUNCS_ENABLED
98 #endif //GLIBMM_VFUNCS_ENABLED
99
100 protected:
101   //GTK+ Virtual Functions (override these to change behaviour):
102 #ifdef GLIBMM_VFUNCS_ENABLED
103 #endif //GLIBMM_VFUNCS_ENABLED
104
105   //Default Signal Handlers::
106 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
107   virtual void on_color_set();
108 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
109
110
111 private:
112
113 public:
114
115   /** Creates a new color button.
116    * 
117    * This creates a widget in the form of a small button containing a swatch representing
118    * the current selected color. When the button is clicked, a color-selection dialog will
119    * open, allowing the user to select a color. The swatch will be updated to reflect the
120    * new color when the user finishes.
121    *
122    * @newin2p4
123    */
124   ColorButton();
125   
126   
127   /** Creates a new color button with a predefined color.
128    * 
129    * Same as Gtk::ColorButton::ColorButton(). Additionally takes a Gdk::Color and
130    * initializes the button with this color. Equivalent to calling set_color(@a color)
131    * after the default constructor.
132    *
133    * @param color A Gdk::Color to set the current color with.
134    *
135    * @newin2p4
136    */
137   explicit ColorButton(const Gdk::Color& color);
138
139   
140   /** Sets the current color to be @a color .
141    * 
142    * @newin2p4
143    * @param color A Gdk::Color to set the current color with.
144    */
145   void set_color(const Gdk::Color& color);
146   
147   /** Sets the current opacity to be @a alpha . 
148    * 
149    * @newin2p4
150    * @param alpha An integer between 0 and 65535.
151    */
152   void set_alpha(guint16 alpha);
153   
154   /** Returns a copy of the the current color.
155    * 
156    * Changes to the return value will have no effect on the Gtk::ColorButton.
157    *
158    * @return A Gdk::Color representing the current internal color of the Gtk::ColorButton.
159    *
160    * @newin2p4
161    */
162   Gdk::Color get_color() const;
163   
164   
165   /** Return value: an integer between 0 and 65535.
166    * @return An integer between 0 and 65535.
167    * 
168    * @newin2p4.
169    */
170   guint16 get_alpha() const;
171   
172   /** Sets whether or not the color button should use the alpha channel.
173    * 
174    * @newin2p4
175    * @param use_alpha <tt>true</tt> if color button should use alpha channel, <tt>false</tt> if not.
176    */
177   void set_use_alpha(bool use_alpha = true);
178   
179   /** Does the color selection dialog use the alpha channel?
180    * @return <tt>true</tt> if the color sample uses alpha channel, <tt>false</tt> if not.
181    * 
182    * @newin2p4.
183    */
184   bool get_use_alpha() const;
185   
186   /** Sets the title for the color selection dialog.
187    * 
188    * @newin2p4
189    * @param title String containing new window title.
190    */
191   void set_title(const Glib::ustring& title);
192   
193   /** Gets the title of the color selection dialog.
194    * 
195    * @newin2p4
196    * @return The title.
197    */
198   Glib::ustring get_title() const;
199
200   #ifdef GLIBMM_PROPERTIES_ENABLED
201 /** Whether or not to give the color an alpha value.
202    *
203    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
204    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
205    * the value of the property changes.
206    */
207   Glib::PropertyProxy<bool> property_use_alpha() ;
208 #endif //#GLIBMM_PROPERTIES_ENABLED
209
210 #ifdef GLIBMM_PROPERTIES_ENABLED
211 /** Whether or not to give the color an alpha value.
212    *
213    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
214    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
215    * the value of the property changes.
216    */
217   Glib::PropertyProxy_ReadOnly<bool> property_use_alpha() const;
218 #endif //#GLIBMM_PROPERTIES_ENABLED
219
220   #ifdef GLIBMM_PROPERTIES_ENABLED
221 /** The title of the color selection dialog.
222    *
223    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
224    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
225    * the value of the property changes.
226    */
227   Glib::PropertyProxy<Glib::ustring> property_title() ;
228 #endif //#GLIBMM_PROPERTIES_ENABLED
229
230 #ifdef GLIBMM_PROPERTIES_ENABLED
231 /** The title of the color selection dialog.
232    *
233    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
234    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
235    * the value of the property changes.
236    */
237   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_title() const;
238 #endif //#GLIBMM_PROPERTIES_ENABLED
239
240   #ifdef GLIBMM_PROPERTIES_ENABLED
241 /** The selected color.
242    *
243    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
244    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
245    * the value of the property changes.
246    */
247   Glib::PropertyProxy<Gdk::Color> property_color() ;
248 #endif //#GLIBMM_PROPERTIES_ENABLED
249
250 #ifdef GLIBMM_PROPERTIES_ENABLED
251 /** The selected color.
252    *
253    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
254    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
255    * the value of the property changes.
256    */
257   Glib::PropertyProxy_ReadOnly<Gdk::Color> property_color() const;
258 #endif //#GLIBMM_PROPERTIES_ENABLED
259
260   #ifdef GLIBMM_PROPERTIES_ENABLED
261 /** The selected opacity value (0 fully transparent, 65535 fully opaque).
262    *
263    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
264    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
265    * the value of the property changes.
266    */
267   Glib::PropertyProxy<guint16> property_alpha() ;
268 #endif //#GLIBMM_PROPERTIES_ENABLED
269
270 #ifdef GLIBMM_PROPERTIES_ENABLED
271 /** The selected opacity value (0 fully transparent, 65535 fully opaque).
272    *
273    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
274    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
275    * the value of the property changes.
276    */
277   Glib::PropertyProxy_ReadOnly<guint16> property_alpha() const;
278 #endif //#GLIBMM_PROPERTIES_ENABLED
279
280
281   /** The color_set signal is emitted when the user selects a color. When handling this signal,
282    * use get_color() and get_alpha() to find out which color 
283    * was just selected.
284    *
285    * @par Prototype:
286    * <tt>void on_my_%color_set()</tt>
287    */
288
289   Glib::SignalProxy0< void > signal_color_set();
290                     
291
292 };
293
294
295 } // namespace Gtk
296
297
298 namespace Glib
299 {
300   /** A Glib::wrap() method for this object.
301    * 
302    * @param object The C instance.
303    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
304    * @result A C++ instance that wraps this C instance.
305    *
306    * @relates Gtk::ColorButton
307    */
308   Gtk::ColorButton* wrap(GtkColorButton* object, bool take_copy = false);
309 } //namespace Glib
310
311
312 #endif /* _GTKMM_COLORBUTTON_H */
313