14a425dc0292423bad1f0aec5fb6838531913465
[synfig.git] / synfig-studio / src / gui / cellrenderer / cellrenderer_value.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file cellrenderer_value.h
3 **      \brief Template File
4 **
5 **      $Id$
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_GTKMM_CELLRENDERER_VALUE_H
26 #define __SYNFIG_GTKMM_CELLRENDERER_VALUE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <gtk/gtk.h>
31 #include <gtkmm/ruler.h>
32 #include <gtkmm/arrow.h>
33 #include <gtkmm/image.h>
34 #include <gdkmm/pixbufloader.h>
35 #include <gtkmm/viewport.h>
36 #include <gtkmm/adjustment.h>
37 #include <gtkmm/scrolledwindow.h>
38 #include <gtkmm/table.h>
39 #include <gtkmm/statusbar.h>
40 #include <gtkmm/button.h>
41 #include <gtkmm/label.h>
42 #include <gtkmm/paned.h>
43 #include <gtkmm/treeview.h>
44 #include <gtkmm/treestore.h>
45 #include <gtkmm/adjustment.h>
46 #include <gtkmm/box.h>
47 #include <gtkmm/spinbutton.h>
48 #include <gtkmm/cellrenderer.h>
49 #include <gtkmm/checkbutton.h>
50
51 #include <gtkmm/colorselection.h>
52 #include <gtkmm/optionmenu.h>
53
54 //#include <synfig/synfig.h>
55 #include <synfig/paramdesc.h>
56 #include <synfig/value.h>
57
58
59 /* === M A C R O S ========================================================= */
60
61 /* === T Y P E D E F S ===================================================== */
62
63 /* === C L A S S E S & S T R U C T S ======================================= */
64
65 namespace studio {
66
67 class Widget_Color;
68 class Widget_CanvasChooser;
69 class Widget_Enum;
70 class Widget_Filename;
71 class Widget_Vector;
72 class Widget_Time;
73
74 class ValueBase_Entry;
75
76 class CellRenderer_ValueBase : public Gtk::CellRendererText
77 {
78         sigc::signal<void, const Glib::ustring&> signal_secondary_click_;
79         sigc::signal<void, const Glib::ustring&, synfig::ValueBase> signal_edited_;
80
81         Glib::Property<synfig::ValueBase> property_value_;
82         Glib::Property<etl::handle<synfig::Canvas> > property_canvas_;
83         Glib::Property<synfig::ParamDesc> property_param_desc_;
84
85         void string_edited_(const Glib::ustring&,const Glib::ustring&);
86
87         void gradient_edited(synfig::Gradient gradient, Glib::ustring path);
88         void color_edited(synfig::Color color, Glib::ustring path);
89
90         bool edit_value_done_called;
91 public:
92         sigc::signal<void, const Glib::ustring&> &signal_secondary_click()
93         {return signal_secondary_click_; }
94
95         sigc::signal<void, const Glib::ustring&, synfig::ValueBase> &signal_edited()
96         {return signal_edited_; }
97
98         Glib::PropertyProxy<synfig::ValueBase> property_value() { return property_value_.get_proxy();}
99         Glib::PropertyProxy<etl::handle<synfig::Canvas> > property_canvas() { return property_canvas_.get_proxy();}
100         Glib::PropertyProxy<synfig::ParamDesc> property_param_desc() { return property_param_desc_.get_proxy(); }
101         Glib::PropertyProxy<bool> property_inconsistent() { return property_foreground_set(); }
102
103         etl::handle<synfig::Canvas> get_canvas()const { return property_canvas_; }
104         synfig::ParamDesc get_param_desc()const { return property_param_desc_; }
105
106         CellRenderer_ValueBase();
107         ~CellRenderer_ValueBase();
108
109         ValueBase_Entry *value_entry;
110
111         void on_value_editing_done();
112
113         virtual void
114         render_vfunc(
115                 const Glib::RefPtr<Gdk::Drawable>& window,
116                 Gtk::Widget& widget,
117                 const Gdk::Rectangle& background_area,
118                 const Gdk::Rectangle& ca,
119                 const Gdk::Rectangle& expose_area,
120                 Gtk::CellRendererState flags);
121
122         virtual Gtk::CellEditable* start_editing_vfunc(GdkEvent* event,
123                                                  Gtk::Widget& widget,
124                                                  const Glib::ustring& path,
125                                                  const Gdk::Rectangle& background_area,
126                                                  const Gdk::Rectangle& cell_area,
127                                                  Gtk::CellRendererState flags);
128
129 }; // END of class CellRenderer_ValueBase
130
131 }; // END of namespace studio
132
133 /* === E N D =============================================================== */
134
135 #endif