- Main Page
- Related Pages
- Namespaces
- Classes
- Files

# widget_coloredit.h

Go to the documentation of this file.

    00001 /* === S Y N F I G ========================================================= */
    00021 /* ========================================================================= */
    00022
    00023 /* === S T A R T =========================================================== */
    00024
    00025 #ifndef __SYNFIG_STUDIO_WIDGET_COLOREDIT_H
    00026 #define __SYNFIG_STUDIO_WIDGET_COLOREDIT_H
    00027
    00028 /* === H E A D E R S ======================================================= */
    00029
    00030 #include <gtkmm/box.h>
    00031 #include <gtkmm/table.h>
    00032 #include <gtkmm/spinbutton.h>
    00033 #include <gtkmm/adjustment.h>
    00034 #include <gtkmm/drawingarea.h>
    00035 #include <synfig/color.h>
    00036 #include "widget_color.h"
    00037
    00038 /* === M A C R O S ========================================================= */
    00039
    00040 /* === T Y P E D E F S ===================================================== */
    00041
    00042 /* === C L A S S E S & S T R U C T S ======================================= */
    00043
    00044 namespace Gtk {
    00045     class Notebook;
    00046 };
    00047
    00048 namespace studio {
    00049
    00050 class ColorSlider : public Gtk::DrawingArea
    00051 {
    00052 public:
    00053     enum Type
    00054     {
    00055         TYPE_R,
    00056         TYPE_G,
    00057         TYPE_B,
    00058         TYPE_Y,
    00059         TYPE_U,
    00060         TYPE_V,
    00061         TYPE_HUE,
    00062         TYPE_SAT,
    00063         TYPE_A,
    00064
    00065         TYPE_END
    00066     };
    00067
    00068 private:
    00069
    00070     sigc::signal<void,Type,float> signal_slider_moved_;
    00071     sigc::signal<void> signal_activated_;
    00072
    00073     Type type;
    00074     synfig::Color color_;
    00075
    00076 public:
    00077
    00078     sigc::signal<void,Type,float>& signal_slider_moved() { return signal_slider_moved_; }
    00079     sigc::signal<void>& signal_activated() { return signal_activated_; }
    00080
    00081     Type
    00082     get_type()const { return type; }
    00083
    00084     const synfig::Color&
    00085     get_color()const { return color_; }
    00086
    00087
    00088     ColorSlider(const Type &x=TYPE_Y);
    00089
    00090     void
    00091     set_type(Type x);
    00092
    00093     void
    00094     set_color(synfig::Color x);
    00095
    00096     static void adjust_color(Type type, synfig::Color &color, float amount);
    00097
    00098 private:
    00099     typedef void (*slider_color_func)(synfig::Color &,float);
    00100
    00101     static void slider_color_TYPE_R(synfig::Color &color, float amount);
    00102     static void slider_color_TYPE_G(synfig::Color &color, float amount);
    00103     static void slider_color_TYPE_B(synfig::Color &color, float amount);
    00104     static void slider_color_TYPE_Y(synfig::Color &color, float amount);
    00105     static void slider_color_TYPE_U(synfig::Color &color, float amount);
    00106     static void slider_color_TYPE_V(synfig::Color &color, float amount);
    00107     static void slider_color_TYPE_HUE(synfig::Color &color, float amount);
    00108     static void slider_color_TYPE_SAT(synfig::Color &color, float amount);
    00109     static void slider_color_TYPE_A(synfig::Color &color, float amount);
    00110
    00111
    00112     bool
    00113     redraw(GdkEventExpose*bleh);
    00114     bool on_event(GdkEvent *event);
    00115 }; // END of class ColorSlider
    00116
    00117
    00118 class Widget_ColorEdit : public Gtk::Table
    00119 {
    00120     sigc::signal<void> signal_activated_;
    00121     sigc::signal<void> signal_value_changed_;
    00122
    00123     ColorSlider *slider_R;
    00124     ColorSlider *slider_G;
    00125     ColorSlider *slider_B;
    00126     Gtk::Label *hex_color_label;
    00127     Gtk::Entry *hex_color;
    00128
    00129     ColorSlider *slider_A;
    00130     ColorSlider *slider_Y;
    00131     ColorSlider *slider_U;
    00132     ColorSlider *slider_V;
    00133     ColorSlider *slider_SAT;
    00134     ColorSlider *slider_HUE;
    00135
    00136     Widget_Color widget_color;
    00137
    00138     bool hold_signals;
    00139
    00140     bool clamp_;
    00141
    00142     Gtk::SpinButton *spinbutton_R;
    00143     Gtk::SpinButton *spinbutton_G;
    00144     Gtk::SpinButton *spinbutton_B;
    00145     Gtk::SpinButton *spinbutton_A;
    00146
    00147     Gtk::Adjustment R_adjustment;
    00148     Gtk::Adjustment G_adjustment;
    00149     Gtk::Adjustment B_adjustment;
    00150     Gtk::Adjustment A_adjustment;
    00151
    00152     synfig::Color color;
    00153
    00154     Gtk::Notebook* notebook;
    00155
    00156 protected:
    00157
    00158     void on_value_changed();
    00159
    00160 public:
    00161
    00162     sigc::signal<void>& signal_activated() { return signal_activated_; }
    00163
    00164     sigc::signal<void>& signal_activate() { return signal_activated_; }
    00165
    00166     void on_slider_moved(ColorSlider::Type type, float amount);
    00167     void on_hex_edited();
    00168
    00169     //Glib::SignalProxy0<void> signal_activate() { return spinbutton_A->signal_activate(); }
    00170
    00171     sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
    00172
    00173     void activated() { signal_activated_(); }
    00174     void activate() { signal_activated_(); }
    00175     void set_value(const synfig::Color &data);
    00176     const synfig::Color &get_value();
    00177     synfig::Color get_value_raw();
    00178     void set_has_frame(bool x);
    00179     void set_digits(int x);
    00180     Widget_ColorEdit();
    00181     ~Widget_ColorEdit();
    00182 }; // END of class Widget_ColorEdit
    00183
    00184 }; // END of namespace studio
    00185
    00186 /* === E N D =============================================================== */
    00187
    00188 #endif