Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

colorselection.h

Go to the documentation of this file.
00001 /*  Inti: Integrated Foundation Classes
00002  *  Copyright (C) 2002 The Inti Development Team.
00003  *  Copyright (C) 2000 Red Hat, Inc.
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018  */
00019  
00027 
00028 #ifndef INTI_GTK_COLOR_SELECTION_H
00029 #define INTI_GTK_COLOR_SELECTION_H
00030 
00031 #ifndef INTI_GTK_VBOX_H
00032 #include <inti/gtk/box.h>
00033 #endif
00034 
00035 #ifndef INTI_GTK_DIALOG_H
00036 #include <inti/gtk/dialog.h>
00037 #endif
00038 
00039 #ifndef __GTK_COLOR_SELECTION_H__
00040 #include <gtk/gtkcolorsel.h>
00041 #endif
00042 
00043 #ifndef __GTK_COLOR_SELECTION_DIALOG_H__
00044 #include <gtk/gtkcolorseldialog.h>
00045 #endif
00046 
00047 namespace Inti {
00048 
00049 namespace Gdk { 
00050 class Color; 
00051 }
00052 
00053 namespace Gtk {
00054 
00055 class Button;
00056 class ColorSelectionClass;
00057 class ColorSelectionDialogClass;
00058 
00066 
00067 class ColorSelection : public VBox
00068 {
00069         friend class G::Object;
00070         friend class ColorSelectionClass;
00071 
00072         ColorSelection(const ColorSelection&);
00073         ColorSelection& operator=(const ColorSelection&);
00074         
00075 protected:
00078         
00079         explicit ColorSelection(GtkColorSelection *color_selection, bool reference = false);
00086 
00090 
00091         virtual void on_color_changed();
00093 
00095 //  Properties
00096 
00097         typedef G::Property<bool> HasOpacityControlPropertyType;
00098         typedef G::PropertyProxy<G::Object, HasOpacityControlPropertyType> HasOpacityControlPropertyProxy;
00099         static const HasOpacityControlPropertyType has_opacity_control_property;
00100 
00101         typedef G::Property<bool> HasPalettePropertyType;
00102         typedef G::PropertyProxy<G::Object, HasPalettePropertyType> HasPalettePropertyProxy;
00103         static const HasPalettePropertyType has_palette_property;
00104 
00105         typedef G::Property<Pointer<Gdk::Color> > CurrentColorPropertyType;
00106         typedef G::PropertyProxy<G::Object, CurrentColorPropertyType> CurrentColorPropertyProxy;
00107         static const CurrentColorPropertyType current_color_property;
00108 
00109         typedef G::Property<unsigned int> CurrentAlphaPropertyType;
00110         typedef G::PropertyProxy<G::Object, CurrentAlphaPropertyType> CurrentAlphaPropertyProxy;
00111         static const CurrentAlphaPropertyType current_alpha_property;
00112 
00113 //  Signals
00114 
00115         typedef G::Signal0<void> ColorChangedSignalType;
00116         typedef G::SignalProxy<TypeInstance, ColorChangedSignalType> ColorChangedSignalProxy;
00117         static const ColorChangedSignalType color_changed_signal;
00118 
00119 public:
00122 
00123         ColorSelection();
00125 
00126         virtual ~ColorSelection();
00128         
00132 
00133         GtkColorSelection* gtk_color_selection() const { return (GtkColorSelection*)instance; }
00135 
00136         GtkColorSelectionClass* gtk_color_selection_class() const;
00138 
00139         operator GtkColorSelection* () const;
00141 
00142         bool get_has_opacity_control() const;
00144 
00145         bool get_has_palette() const;
00147 
00148         Gdk::Color get_current_color() const;
00150 
00151         unsigned short get_current_alpha() const;
00153 
00154         Gdk::Color get_previous_color() const;
00156 
00157         unsigned short get_previous_alpha() const;
00159 
00160         bool is_adjusting() const;
00163 
00165         static bool palette_from_string(const String& str, std::vector<Pointer<Gdk::Color> >& colors);
00171 
00172         static String palette_to_string(const std::vector<Pointer<Gdk::Color> >& colors);
00176 
00179 
00180         void set_has_opacity_control(bool has_opacity);
00184         
00185         void set_has_palette(bool has_palette);
00188 
00189         void set_current_color(const Gdk::Color& color);
00194 
00195         void set_current_alpha(unsigned short alpha);
00200 
00201         void set_previous_color(const Gdk::Color& color);
00208 
00209         void set_previous_alpha(unsigned short alpha);
00215         
00219 
00220         const HasOpacityControlPropertyProxy prop_has_opacity_control()
00221         {
00222                 return HasOpacityControlPropertyProxy(this, &has_opacity_control_property);
00223         }
00225 
00226         const HasPalettePropertyProxy prop_has_palette()
00227         {
00228                 return HasPalettePropertyProxy(this, &has_palette_property);
00229         }
00231 
00232         const CurrentColorPropertyProxy prop_current_color()
00233         {
00234                 return CurrentColorPropertyProxy(this, &current_color_property);
00235         }
00237 
00238         const CurrentAlphaPropertyProxy prop_current_alpha()
00239         {
00240                 return CurrentAlphaPropertyProxy(this, &current_alpha_property);
00241         }
00243 
00247 
00248         const ColorChangedSignalProxy sig_color_changed()
00249         {
00250                 return ColorChangedSignalProxy(this, &color_changed_signal);
00251         }
00254 
00256 };
00257 
00263 
00264 class ColorSelectionDialog : public Dialog
00265 {
00266         friend class G::Object;
00267         friend class ColorSelectionDialogClass;
00268 
00269         ColorSelectionDialog(const ColorSelectionDialog&);
00270         ColorSelectionDialog& operator=(const ColorSelectionDialog&);
00271         
00272 protected:
00275 
00276         explicit ColorSelectionDialog(GtkColorSelectionDialog *color_selection_dialog, bool reference = false);
00283 
00285         
00286 public:
00289 
00290         ColorSelectionDialog();
00292 
00293         explicit ColorSelectionDialog(const String& title);
00296 
00297         virtual ~ColorSelectionDialog();
00299 
00303 
00304         GtkColorSelectionDialog* gtk_color_selection_dialog() const { return (GtkColorSelectionDialog*)instance; }
00306 
00307         GtkColorSelectionDialogClass* gtk_color_selection_dialog_class() const;
00309 
00310         operator GtkColorSelectionDialog* () const;
00312 
00313         ColorSelection* colorsel() const;
00317 
00318         Button* ok_button() const;
00320 
00321         Button* cancel_button() const;
00323 
00324         Button* help_button() const;
00326 
00328 };
00329 
00330 } // namespace Gtk
00331 
00332 } // namespace Inti
00333 
00334 #endif // INTI_GTK_COLOR_SELECTION_DIALOG_H
00335 
Main Page - Footer


Generated on Sun Sep 14 20:08:02 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002