1 /* === S Y N F I G ========================================================= */
2 /*! \file widget_coloredit.h
3 ** \brief Template Header
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_STUDIO_WIDGET_COLOREDIT_H
26 #define __SYNFIG_STUDIO_WIDGET_COLOREDIT_H
28 /* === H E A D E R S ======================================================= */
30 #include <gtkmm/box.h>
31 #include <gtkmm/table.h>
32 #include <gtkmm/spinbutton.h>
33 #include <gtkmm/adjustment.h>
34 #include <gtkmm/drawingarea.h>
35 #include <synfig/color.h>
36 #include "widget_color.h"
38 /* === M A C R O S ========================================================= */
40 /* === T Y P E D E F S ===================================================== */
42 /* === C L A S S E S & S T R U C T S ======================================= */
50 class ColorSlider : public Gtk::DrawingArea
70 sigc::signal<void,Type,float> signal_slider_moved_;
71 sigc::signal<void> signal_activated_;
78 sigc::signal<void,Type,float>& signal_slider_moved() { return signal_slider_moved_; }
79 sigc::signal<void>& signal_activated() { return signal_activated_; }
82 get_type()const { return type; }
85 get_color()const { return color_; }
88 ColorSlider(const Type &x=TYPE_Y);
94 set_color(synfig::Color x);
96 static void adjust_color(Type type, synfig::Color &color, float amount);
99 typedef void (*slider_color_func)(synfig::Color &,float);
101 static void slider_color_TYPE_R(synfig::Color &color, float amount);
102 static void slider_color_TYPE_G(synfig::Color &color, float amount);
103 static void slider_color_TYPE_B(synfig::Color &color, float amount);
104 static void slider_color_TYPE_Y(synfig::Color &color, float amount);
105 static void slider_color_TYPE_U(synfig::Color &color, float amount);
106 static void slider_color_TYPE_V(synfig::Color &color, float amount);
107 static void slider_color_TYPE_HUE(synfig::Color &color, float amount);
108 static void slider_color_TYPE_SAT(synfig::Color &color, float amount);
109 static void slider_color_TYPE_A(synfig::Color &color, float amount);
113 redraw(GdkEventExpose*bleh);
114 bool on_event(GdkEvent *event);
115 }; // END of class ColorSlider
118 class Widget_ColorEdit : public Gtk::Table
120 sigc::signal<void> signal_activated_;
121 sigc::signal<void> signal_value_changed_;
123 ColorSlider *slider_R;
124 ColorSlider *slider_G;
125 ColorSlider *slider_B;
126 Gtk::Label *hex_color_label;
127 Gtk::Entry *hex_color;
129 ColorSlider *slider_A;
130 ColorSlider *slider_Y;
131 ColorSlider *slider_U;
132 ColorSlider *slider_V;
133 ColorSlider *slider_SAT;
134 ColorSlider *slider_HUE;
136 Widget_Color widget_color;
142 Gtk::SpinButton *spinbutton_R;
143 Gtk::SpinButton *spinbutton_G;
144 Gtk::SpinButton *spinbutton_B;
145 Gtk::SpinButton *spinbutton_A;
147 Gtk::Adjustment R_adjustment;
148 Gtk::Adjustment G_adjustment;
149 Gtk::Adjustment B_adjustment;
150 Gtk::Adjustment A_adjustment;
154 Gtk::Notebook* notebook;
158 void on_value_changed();
162 sigc::signal<void>& signal_activated() { return signal_activated_; }
164 sigc::signal<void>& signal_activate() { return signal_activated_; }
166 void on_slider_moved(ColorSlider::Type type, float amount);
167 void on_hex_edited();
169 //Glib::SignalProxy0<void> signal_activate() { return spinbutton_A->signal_activate(); }
171 sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
173 void activated() { signal_activated_(); }
174 void activate() { signal_activated_(); }
175 void set_value(const synfig::Color &data);
176 const synfig::Color &get_value();
177 synfig::Color get_value_raw();
178 void set_has_frame(bool x);
179 void set_digits(int x);
182 }; // END of class Widget_ColorEdit
184 }; // END of namespace studio
186 /* === E N D =============================================================== */