Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_05 / synfig-studio / src / gtkmm / widget_gradient.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file widget_gradient.h
3 **      \brief Template Header
4 **
5 **      $Id: widget_gradient.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
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.
14 **
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.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_STUDIO_WIDGET_GRADIENT_H
26 #define __SYNFIG_STUDIO_WIDGET_GRADIENT_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <gtkmm/drawingarea.h>
31 #include <synfig/gradient.h>
32
33 /* === M A C R O S ========================================================= */
34
35 /* === T Y P E D E F S ===================================================== */
36
37 /* === C L A S S E S & S T R U C T S ======================================= */
38
39 namespace studio {
40
41 void render_gradient_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::Gradient &gradient);
42
43 class Widget_Gradient : public Gtk::DrawingArea
44 {
45         sigc::signal<void> signal_value_changed_;
46         sigc::signal<void> signal_clicked_;
47
48         sigc::signal<void,synfig::Gradient::CPoint> signal_cpoint_selected_;
49
50         synfig::Gradient gradient_;
51         
52         bool editable_;
53         
54         bool changed_;
55         
56         synfig::Gradient::CPoint        selected_cpoint;
57
58         void popup_menu(float x);       
59
60         void insert_cpoint(float x);    
61
62         void remove_cpoint(float x);    
63                 
64 public:
65         
66         Widget_Gradient();
67         
68         ~Widget_Gradient();
69
70         sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
71         sigc::signal<void>& signal_clicked() { return signal_clicked_; }
72
73         sigc::signal<void,synfig::Gradient::CPoint>& signal_cpoint_selected() { return signal_cpoint_selected_; }
74         
75         void set_value(const synfig::Gradient& x);
76
77         const synfig::Gradient& get_value()const { return gradient_; }  
78         
79         void set_editable(bool x=true) { editable_=x; }
80         
81         bool get_editable()const { return editable_; }
82
83
84         
85         void set_selected_cpoint(const synfig::Gradient::CPoint &x);
86
87         const synfig::Gradient::CPoint& get_selected_cpoint() { return selected_cpoint; }
88
89         void update_cpoint(const synfig::Gradient::CPoint &x);
90         
91
92
93         bool redraw(GdkEventExpose*bleh=NULL);
94
95         bool on_event(GdkEvent *event);
96 }; // END of class BlackLevelSelector
97
98 }; // END of namespace studio
99
100 /* === E N D =============================================================== */
101
102 #endif