add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / colorselection.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_COLORSELECTION_H
4 #define _GTKMM_COLORSELECTION_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* Copyright (C) 1998-2002 The gtkmm Development Team
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Library General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Library General Public License for more details.
22  *
23  * You should have received a copy of the GNU Library General Public
24  * License along with this library; if not, write to the Free
25  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27
28
29 #include <gtkmm/box.h>
30 #include <gtkmm/dialog.h>
31 #include <gtkmm/button.h>
32
33
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 typedef struct _GtkColorSelection GtkColorSelection;
36 typedef struct _GtkColorSelectionClass GtkColorSelectionClass;
37 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
38
39
40 namespace Gtk
41 { class ColorSelection_Class; } // namespace Gtk
42 #ifndef DOXYGEN_SHOULD_SKIP_THIS
43 typedef struct _GtkColorSelectionDialog GtkColorSelectionDialog;
44 typedef struct _GtkColorSelectionDialogClass GtkColorSelectionDialogClass;
45 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
46
47
48 namespace Gtk
49 { class ColorSelectionDialog_Class; } // namespace Gtk
50 namespace Gtk
51 {
52
53 /** A widget used to select a color.
54  *
55  * This widget is used to select a color. It
56  * consists of a color wheel and number of sliders and entry boxes for color
57  * parameters such as hue, saturation, value, red, green, blue, and opacity.
58  *
59  * It is found on the standard color selection dialog box
60  * Gtk::ColorSelectionDialog. 
61  *
62  * @ingroup Widgets
63  */
64
65 class ColorSelection : public VBox
66 {
67   public:
68 #ifndef DOXYGEN_SHOULD_SKIP_THIS
69   typedef ColorSelection CppObjectType;
70   typedef ColorSelection_Class CppClassType;
71   typedef GtkColorSelection BaseObjectType;
72   typedef GtkColorSelectionClass BaseClassType;
73 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
74
75   virtual ~ColorSelection();
76
77 #ifndef DOXYGEN_SHOULD_SKIP_THIS
78
79 private:
80   friend class ColorSelection_Class;
81   static CppClassType colorselection_class_;
82
83   // noncopyable
84   ColorSelection(const ColorSelection&);
85   ColorSelection& operator=(const ColorSelection&);
86
87 protected:
88   explicit ColorSelection(const Glib::ConstructParams& construct_params);
89   explicit ColorSelection(GtkColorSelection* castitem);
90
91 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
92
93 public:
94 #ifndef DOXYGEN_SHOULD_SKIP_THIS
95   static GType get_type()      G_GNUC_CONST;
96   static GType get_base_type() G_GNUC_CONST;
97 #endif
98
99   ///Provides access to the underlying C GtkObject.
100   GtkColorSelection*       gobj()       { return reinterpret_cast<GtkColorSelection*>(gobject_); }
101
102   ///Provides access to the underlying C GtkObject.
103   const GtkColorSelection* gobj() const { return reinterpret_cast<GtkColorSelection*>(gobject_); }
104
105
106 public:
107   //C++ methods used to invoke GTK+ virtual functions:
108 #ifdef GLIBMM_VFUNCS_ENABLED
109 #endif //GLIBMM_VFUNCS_ENABLED
110
111 protected:
112   //GTK+ Virtual Functions (override these to change behaviour):
113 #ifdef GLIBMM_VFUNCS_ENABLED
114 #endif //GLIBMM_VFUNCS_ENABLED
115
116   //Default Signal Handlers::
117 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
118   virtual void on_color_changed();
119 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
120
121
122 private:
123
124   
125 public:
126   ColorSelection();
127
128   
129   /** Determines whether the colorsel has an opacity control.
130    * @return <tt>true</tt> if the @a colorsel  has an opacity control.  <tt>false</tt> if it does't.
131    */
132   bool get_has_opacity_control() const;
133   
134   /** Sets the @a colorsel  to use or not use opacity.
135    * @param has_opacity <tt>true</tt> if @a colorsel  can set the opacity, <tt>false</tt> otherwise.
136    */
137   void set_has_opacity_control(bool has_opacity = true);
138   
139   /** Determines whether the color selector has a color palette.
140    * @return <tt>true</tt> if the selector has a palette.  <tt>false</tt> if it hasn't.
141    */
142   bool get_has_palette() const;
143   
144   /** Shows and hides the palette based upon the value of @a has_palette .
145    * @param has_palette <tt>true</tt> if palette is to be visible, <tt>false</tt> otherwise.
146    */
147   void set_has_palette(bool has_palette = true);
148   
149   /** Sets the current color to be @a color .  The first time this is called, it will
150    * also set the original color to be @a color  too.
151    * @param color A Gdk::Color to set the current color with.
152    */
153   void set_current_color(const Gdk::Color& color);
154   
155   /** Sets the current opacity to be @a alpha .  The first time this is called, it will
156    * also set the original opacity to be @a alpha  too.
157    * @param alpha An integer between 0 and 65535.
158    */
159   void set_current_alpha(guint16 alpha);
160   Gdk::Color get_current_color() const;
161   
162   /** Return value: an integer between 0 and 65535.
163    * @return An integer between 0 and 65535.
164    */
165   guint16 get_current_alpha() const;
166   
167   /** Sets the 'previous' color to be @a color .  This function should be called with
168    * some hesitations, as it might seem confusing to have that color change.
169    * Calling set_current_color() will also set this color the first
170    * time it is called.
171    * @param color A Gdk::Color to set the previous color with.
172    */
173   void set_previous_color(const Gdk::Color& color);
174   
175   /** Sets the 'previous' alpha to be @a alpha .  This function should be called with
176    * some hesitations, as it might seem confusing to have that alpha change.
177    * @param alpha An integer between 0 and 65535.
178    */
179   void set_previous_alpha(guint16 alpha);
180   Gdk::Color get_previous_color() const;
181   
182   /** Return value: an integer between 0 and 65535.
183    * @return An integer between 0 and 65535.
184    */
185   guint16 get_previous_alpha() const;
186
187   
188   /** Gets the current state of the @a colorsel .
189    * @return <tt>true</tt> if the user is currently dragging a color around, and <tt>false</tt>
190    * if the selection has stopped.
191    */
192   bool is_adjusting() const;
193
194   static Gdk::ArrayHandle_Color palette_from_string(const Glib::ustring& str);
195   static Glib::ustring palette_to_string(const Gdk::ArrayHandle_Color& colors);
196
197   typedef sigc::slot<void, const Glib::RefPtr<Gdk::Screen>&,
198                             const Gdk::ArrayHandle_Color&> SlotChangePaletteHook;
199
200   static SlotChangePaletteHook set_change_palette_hook(const SlotChangePaletteHook& slot);
201
202   
203   /**
204    * @par Prototype:
205    * <tt>void on_my_%color_changed()</tt>
206    */
207
208   Glib::SignalProxy0< void > signal_color_changed();
209
210
211   #ifdef GLIBMM_PROPERTIES_ENABLED
212 /** Whether a palette should be used.
213    *
214    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
215    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
216    * the value of the property changes.
217    */
218   Glib::PropertyProxy<bool> property_has_palette() ;
219 #endif //#GLIBMM_PROPERTIES_ENABLED
220
221 #ifdef GLIBMM_PROPERTIES_ENABLED
222 /** Whether a palette should be used.
223    *
224    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
225    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
226    * the value of the property changes.
227    */
228   Glib::PropertyProxy_ReadOnly<bool> property_has_palette() const;
229 #endif //#GLIBMM_PROPERTIES_ENABLED
230
231   #ifdef GLIBMM_PROPERTIES_ENABLED
232 /** Whether the color selector should allow setting opacity.
233    *
234    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
235    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
236    * the value of the property changes.
237    */
238   Glib::PropertyProxy<bool> property_has_opacity_control() ;
239 #endif //#GLIBMM_PROPERTIES_ENABLED
240
241 #ifdef GLIBMM_PROPERTIES_ENABLED
242 /** Whether the color selector should allow setting opacity.
243    *
244    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
245    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
246    * the value of the property changes.
247    */
248   Glib::PropertyProxy_ReadOnly<bool> property_has_opacity_control() const;
249 #endif //#GLIBMM_PROPERTIES_ENABLED
250
251   #ifdef GLIBMM_PROPERTIES_ENABLED
252 /** The current color.
253    *
254    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
255    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
256    * the value of the property changes.
257    */
258   Glib::PropertyProxy<Gdk::Color> property_current_color() ;
259 #endif //#GLIBMM_PROPERTIES_ENABLED
260
261 #ifdef GLIBMM_PROPERTIES_ENABLED
262 /** The current color.
263    *
264    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
265    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
266    * the value of the property changes.
267    */
268   Glib::PropertyProxy_ReadOnly<Gdk::Color> property_current_color() const;
269 #endif //#GLIBMM_PROPERTIES_ENABLED
270
271   #ifdef GLIBMM_PROPERTIES_ENABLED
272 /** The current opacity value (0 fully transparent, 65535 fully opaque).
273    *
274    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
275    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
276    * the value of the property changes.
277    */
278   Glib::PropertyProxy<guint> property_current_alpha() ;
279 #endif //#GLIBMM_PROPERTIES_ENABLED
280
281 #ifdef GLIBMM_PROPERTIES_ENABLED
282 /** The current opacity value (0 fully transparent, 65535 fully opaque).
283    *
284    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
285    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
286    * the value of the property changes.
287    */
288   Glib::PropertyProxy_ReadOnly<guint> property_current_alpha() const;
289 #endif //#GLIBMM_PROPERTIES_ENABLED
290
291
292 };
293
294 /** This dialog allows the user to select a color.
295  * @ingroup Dialogs
296  */
297
298 class ColorSelectionDialog : public Dialog
299 {
300   public:
301 #ifndef DOXYGEN_SHOULD_SKIP_THIS
302   typedef ColorSelectionDialog CppObjectType;
303   typedef ColorSelectionDialog_Class CppClassType;
304   typedef GtkColorSelectionDialog BaseObjectType;
305   typedef GtkColorSelectionDialogClass BaseClassType;
306 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
307
308   virtual ~ColorSelectionDialog();
309
310 #ifndef DOXYGEN_SHOULD_SKIP_THIS
311
312 private:
313   friend class ColorSelectionDialog_Class;
314   static CppClassType colorselectiondialog_class_;
315
316   // noncopyable
317   ColorSelectionDialog(const ColorSelectionDialog&);
318   ColorSelectionDialog& operator=(const ColorSelectionDialog&);
319
320 protected:
321   explicit ColorSelectionDialog(const Glib::ConstructParams& construct_params);
322   explicit ColorSelectionDialog(GtkColorSelectionDialog* castitem);
323
324 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
325
326 public:
327 #ifndef DOXYGEN_SHOULD_SKIP_THIS
328   static GType get_type()      G_GNUC_CONST;
329   static GType get_base_type() G_GNUC_CONST;
330 #endif
331
332   ///Provides access to the underlying C GtkObject.
333   GtkColorSelectionDialog*       gobj()       { return reinterpret_cast<GtkColorSelectionDialog*>(gobject_); }
334
335   ///Provides access to the underlying C GtkObject.
336   const GtkColorSelectionDialog* gobj() const { return reinterpret_cast<GtkColorSelectionDialog*>(gobject_); }
337
338
339 public:
340   //C++ methods used to invoke GTK+ virtual functions:
341 #ifdef GLIBMM_VFUNCS_ENABLED
342 #endif //GLIBMM_VFUNCS_ENABLED
343
344 protected:
345   //GTK+ Virtual Functions (override these to change behaviour):
346 #ifdef GLIBMM_VFUNCS_ENABLED
347 #endif //GLIBMM_VFUNCS_ENABLED
348
349   //Default Signal Handlers::
350 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
351 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
352
353
354 private:
355
356   
357 public:
358
359   ColorSelectionDialog();
360   explicit ColorSelectionDialog(const Glib::ustring& title);
361
362    ColorSelection* get_colorsel();
363   const ColorSelection* get_colorsel() const;
364     Button* get_ok_button();
365   const Button* get_ok_button() const;
366     Button* get_cancel_button();
367   const Button* get_cancel_button() const;
368     Button* get_help_button();
369   const Button* get_help_button() const;
370  
371
372 };
373
374 } // namespace Gtk
375
376
377 namespace Glib
378 {
379   /** A Glib::wrap() method for this object.
380    * 
381    * @param object The C instance.
382    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
383    * @result A C++ instance that wraps this C instance.
384    *
385    * @relates Gtk::ColorSelection
386    */
387   Gtk::ColorSelection* wrap(GtkColorSelection* object, bool take_copy = false);
388 } //namespace Glib
389
390
391 namespace Glib
392 {
393   /** A Glib::wrap() method for this object.
394    * 
395    * @param object The C instance.
396    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
397    * @result A C++ instance that wraps this C instance.
398    *
399    * @relates Gtk::ColorSelectionDialog
400    */
401   Gtk::ColorSelectionDialog* wrap(GtkColorSelectionDialog* object, bool take_copy = false);
402 } //namespace Glib
403
404
405 #endif /* _GTKMM_COLORSELECTION_H */
406