initial version
[synfig.git] / synfig-studio / trunk / src / gtkmm / layerparamtreestore.h
1 /* === S I N F G =========================================================== */
2 /*!     \file layerparamtreestore.h
3 **      \brief Template Header
4 **
5 **      $Id: layerparamtreestore.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SINFG_STUDIO_LAYERPARAMTREESTORE_H
25 #define __SINFG_STUDIO_LAYERPARAMTREESTORE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <gtkmm/treestore.h>
30 #include <sinfgapp/canvasinterface.h>
31 #include "canvastreestore.h"
32 #include <sinfg/value.h>
33 #include <sinfg/valuenode.h>
34 #include <sinfg/paramdesc.h>
35
36 /* === M A C R O S ========================================================= */
37
38 /* === T Y P E D E F S ===================================================== */
39
40 /* === C L A S S E S & S T R U C T S ======================================= */
41
42 namespace studio {
43
44 class LayerTree;
45         
46 class LayerParamTreeStore : public CanvasTreeStore
47 {
48         /*
49  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
50         */
51
52 public:
53         typedef std::list<sinfg::Layer::Handle> LayerList;
54
55         /*
56  -- ** -- P U B L I C  D A T A ------------------------------------------------
57         */
58
59 public:
60         
61         //! TreeModel for the layer parameters
62         class Model : public CanvasTreeStore::Model
63         {
64         public:
65
66                 Gtk::TreeModelColumn<sinfg::ParamDesc>  param_desc;
67
68                 Gtk::TreeModelColumn<bool>      is_inconsistent;
69                 Gtk::TreeModelColumn<bool>      is_toplevel;
70
71                 Model()
72                 {
73                         add(param_desc);
74                         add(is_inconsistent);
75                         add(is_toplevel);
76                 }
77         };
78         
79         Model model;
80
81         
82         /*
83  -- ** -- P R I V A T E   D A T A ---------------------------------------------
84         */
85
86 private:
87
88         int queued;
89         
90         LayerTree* layer_tree;
91         
92         LayerList layer_list;
93
94         sigc::connection queue_connection;
95         
96         std::list<sigc::connection> changed_connection_list;
97
98         sigc::signal<void> signal_changed_;
99
100         /*
101  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
102         */
103
104 private:
105
106 protected:
107         virtual void  get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
108         virtual void set_value_impl (const Gtk::TreeModel::iterator& row, int column, const Glib::ValueBase& value);
109         virtual void set_row(Gtk::TreeRow row,sinfgapp::ValueDesc value_desc);
110
111         /*
112  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
113         */
114
115 private:
116
117         void on_value_node_child_added(sinfg::ValueNode::Handle value_node,sinfg::ValueNode::Handle child);
118         void on_value_node_child_removed(sinfg::ValueNode::Handle value_node,sinfg::ValueNode::Handle child);
119
120         void on_value_node_added(sinfg::ValueNode::Handle value_node);
121         void on_value_node_deleted(sinfg::ValueNode::Handle value_node);
122         virtual void on_value_node_changed(sinfg::ValueNode::Handle value_node);
123         void on_value_node_replaced(sinfg::ValueNode::Handle replaced_value_node,sinfg::ValueNode::Handle new_value_node);
124         void on_layer_param_changed(sinfg::Layer::Handle handle,sinfg::String param_name);
125
126         /*
127  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
128         */
129
130 public:
131         
132         LayerParamTreeStore(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_,
133                 LayerTree* layer_tree);
134         ~LayerParamTreeStore();
135
136         void rebuild();
137
138         void refresh();
139
140         void queue_refresh();
141
142         void queue_rebuild();
143
144         void refresh_row(Gtk::TreeModel::Row &row);
145
146         sigc::signal<void>& signal_changed() { return signal_changed_; }
147
148         void changed() { signal_changed_(); }
149         
150         /*
151  -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
152         */
153
154 public:
155         
156         static Glib::RefPtr<LayerParamTreeStore> create(etl::loose_handle<sinfgapp::CanvasInterface> canvas_interface_, LayerTree*layer_tree);
157 }; // END of class LayerParamTreeStore
158
159 }; // END of namespace studio
160
161 /* === E N D =============================================================== */
162
163 #endif