Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_07_rc3 / src / gtkmm / layerparamtreestore.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file layerparamtreestore.h
3 **      \brief Template Header
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_STUDIO_LAYERPARAMTREESTORE_H
26 #define __SYNFIG_STUDIO_LAYERPARAMTREESTORE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <gtkmm/treestore.h>
31 #include <synfigapp/canvasinterface.h>
32 #include "canvastreestore.h"
33 #include <synfig/value.h>
34 #include <synfig/valuenode.h>
35 #include <synfig/paramdesc.h>
36
37 /* === M A C R O S ========================================================= */
38
39 /* === T Y P E D E F S ===================================================== */
40
41 /* === C L A S S E S & S T R U C T S ======================================= */
42
43 namespace studio {
44
45 class LayerTree;
46
47 class LayerParamTreeStore : public CanvasTreeStore
48 {
49         /*
50  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
51         */
52
53 public:
54         typedef std::list<synfig::Layer::Handle> LayerList;
55
56         /*
57  -- ** -- P U B L I C  D A T A ------------------------------------------------
58         */
59
60 public:
61
62         //! TreeModel for the layer parameters
63         class Model : public CanvasTreeStore::Model
64         {
65         public:
66
67                 Gtk::TreeModelColumn<synfig::ParamDesc> param_desc;
68
69                 Gtk::TreeModelColumn<bool>      is_inconsistent;
70                 Gtk::TreeModelColumn<bool>      is_toplevel;
71
72                 Model()
73                 {
74                         add(param_desc);
75                         add(is_inconsistent);
76                         add(is_toplevel);
77                 }
78         };
79
80         Model model;
81
82
83         /*
84  -- ** -- P R I V A T E   D A T A ---------------------------------------------
85         */
86
87 private:
88
89         int queued;
90
91         LayerTree* layer_tree;
92
93         LayerList layer_list;
94
95         sigc::connection queue_connection;
96
97         std::list<sigc::connection> changed_connection_list;
98
99         sigc::signal<void> signal_changed_;
100
101         /*
102  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
103         */
104
105 private:
106
107 protected:
108         virtual void  get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
109         virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
110         virtual void set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc);
111
112         /*
113  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
114         */
115
116 private:
117
118         void on_value_node_child_added(synfig::ValueNode::Handle value_node,synfig::ValueNode::Handle child);
119         void on_value_node_child_removed(synfig::ValueNode::Handle value_node,synfig::ValueNode::Handle child);
120
121         void on_value_node_added(synfig::ValueNode::Handle value_node);
122         void on_value_node_deleted(synfig::ValueNode::Handle value_node);
123         virtual void on_value_node_changed(synfig::ValueNode::Handle value_node);
124         void on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node);
125         void on_layer_param_changed(synfig::Layer::Handle handle,synfig::String param_name);
126
127         /*
128  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
129         */
130
131 public:
132
133         LayerParamTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_,
134                 LayerTree* layer_tree);
135         ~LayerParamTreeStore();
136
137         void rebuild();
138
139         void refresh();
140
141         void queue_refresh();
142
143         void queue_rebuild();
144
145         void refresh_row(Gtk::TreeModel::Row &row);
146
147         sigc::signal<void>& signal_changed() { return signal_changed_; }
148
149         void changed() { signal_changed_(); }
150
151         /*
152  -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
153         */
154
155 public:
156
157         static Glib::RefPtr<LayerParamTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_, LayerTree*layer_tree);
158 }; // END of class LayerParamTreeStore
159
160 }; // END of namespace studio
161
162 /* === E N D =============================================================== */
163
164 #endif