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