Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / 0.61.08 / 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 **      Copyright (c) 2007 Chris Moore
10 **
11 **      This package is free software; you can redistribute it and/or
12 **      modify it under the terms of the GNU General Public License as
13 **      published by the Free Software Foundation; either version 2 of
14 **      the License, or (at your option) any later version.
15 **
16 **      This package is distributed in the hope that it will be useful,
17 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 **      General Public License for more details.
20 **      \endlegal
21 */
22 /* ========================================================================= */
23
24 /* === S T A R T =========================================================== */
25
26 #ifndef __SYNFIG_STUDIO_LAYERPARAMTREESTORE_H
27 #define __SYNFIG_STUDIO_LAYERPARAMTREESTORE_H
28
29 /* === H E A D E R S ======================================================= */
30
31 #include <gtkmm/treestore.h>
32 #include <synfigapp/canvasinterface.h>
33 #include "canvastreestore.h"
34 #include <synfig/value.h>
35 #include <synfig/valuenode.h>
36 #include <synfig/paramdesc.h>
37
38 /* === M A C R O S ========================================================= */
39
40 /* === T Y P E D E F S ===================================================== */
41
42 /* === C L A S S E S & S T R U C T S ======================================= */
43
44 namespace studio {
45
46 class LayerTree;
47
48 class LayerParamTreeStore : public CanvasTreeStore
49 {
50         /*
51  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
52         */
53
54 public:
55         typedef std::list<synfig::Layer::Handle> LayerList;
56
57         /*
58  -- ** -- P U B L I C  D A T A ------------------------------------------------
59         */
60
61 public:
62
63         //! TreeModel for the layer parameters
64         class Model : public CanvasTreeStore::Model
65         {
66         public:
67
68                 Gtk::TreeModelColumn<synfig::ParamDesc> param_desc;
69
70                 Gtk::TreeModelColumn<bool>      is_inconsistent;
71                 Gtk::TreeModelColumn<bool>      is_toplevel;
72
73                 Model()
74                 {
75                         add(param_desc);
76                         add(is_inconsistent);
77                         add(is_toplevel);
78                 }
79         };
80
81         Model model;
82
83
84         /*
85  -- ** -- P R I V A T E   D A T A ---------------------------------------------
86         */
87
88 private:
89
90         int queued;
91
92         LayerTree* layer_tree;
93
94         LayerList layer_list;
95
96         sigc::connection queue_connection;
97
98         std::list<sigc::connection> changed_connection_list;
99
100         sigc::signal<void> signal_changed_;
101
102         /*
103  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
104         */
105
106 private:
107
108 protected:
109         virtual void  get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
110         virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
111         virtual void set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc);
112
113         /*
114  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
115         */
116
117 private:
118
119         void on_value_node_child_added(synfig::ValueNode::Handle value_node,synfig::ValueNode::Handle child);
120         void on_value_node_child_removed(synfig::ValueNode::Handle value_node,synfig::ValueNode::Handle child);
121
122         void on_value_node_added(synfig::ValueNode::Handle value_node);
123         void on_value_node_deleted(synfig::ValueNode::Handle value_node);
124         virtual void on_value_node_changed(synfig::ValueNode::Handle value_node);
125         virtual void on_value_node_renamed(synfig::ValueNode::Handle value_node);
126         void on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node);
127         void on_layer_param_changed(synfig::Layer::Handle handle,synfig::String param_name);
128
129         /*
130  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
131         */
132
133 public:
134
135         LayerParamTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_,
136                 LayerTree* layer_tree);
137         ~LayerParamTreeStore();
138
139         void rebuild();
140
141         void refresh();
142
143         void queue_refresh();
144
145         void queue_rebuild();
146
147         void refresh_row(Gtk::TreeModel::Row &row);
148
149         sigc::signal<void>& signal_changed() { return signal_changed_; }
150
151         void changed() { signal_changed_(); }
152
153         /*
154  -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
155         */
156
157 public:
158
159         static Glib::RefPtr<LayerParamTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_, LayerTree*layer_tree);
160 }; // END of class LayerParamTreeStore
161
162 }; // END of namespace studio
163
164 /* === E N D =============================================================== */
165
166 #endif