my log
[synfig.git] / synfig-studio / trunk / src / gtkmm / childrentreestore.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file childrentreestore.h
3 **      \brief Template Header
4 **
5 **      $Id: childrentreestore.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 __SYNFIG_STUDIO_CHILDRENTREESTORE_H
25 #define __SYNFIG_STUDIO_CHILDRENTREESTORE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <gtkmm/treestore.h>
30 #include <synfigapp/canvasinterface.h>
31 #include "canvastreestore.h"
32 #include <synfig/value.h>
33 #include <synfig/valuenode.h>
34 #include <set>
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 ChildrenTreeStore : public CanvasTreeStore
45 {
46         /*
47  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
48         */
49
50 public:
51
52         /*
53  -- ** -- P U B L I C  D A T A ------------------------------------------------
54         */
55
56 public:
57         
58         //! TreeModel for the layers
59         const Model model;
60
61         /*
62  -- ** -- P R I V A T E   D A T A ---------------------------------------------
63         */
64
65 private:
66         
67         Gtk::TreeModel::Row value_node_row;
68         Gtk::TreeModel::Row canvas_row;
69         
70         std::set<synfig::ValueNode::Handle> changed_set_;
71
72         std::set<synfig::ValueNode::Handle> replaced_set_;
73         
74         /*
75  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
76         */
77
78 private:
79         
80         sigc::connection changed_connection;
81         bool execute_changed_queued()const { return !changed_set_.empty() || !replaced_set_.empty(); }
82         bool execute_changed_value_nodes();
83         void clear_changed_queue() { changed_set_.clear(); replaced_set_.clear(); }
84         
85         /*
86  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
87         */
88
89 private:
90
91         void on_value_node_added(synfig::ValueNode::Handle value_node);
92         void on_value_node_deleted(synfig::ValueNode::Handle value_node);
93         void on_value_node_changed(synfig::ValueNode::Handle value_node);
94         void on_value_node_replaced(synfig::ValueNode::Handle replaced_value_node,synfig::ValueNode::Handle new_value_node);
95         void on_canvas_added(synfig::Canvas::Handle canvas);
96         void on_canvas_removed(synfig::Canvas::Handle canvas);
97
98         void set_value_impl(const Gtk::TreeModel::iterator& iter, int column, const Glib::ValueBase& value);
99
100         /*
101  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
102         */
103
104 public:
105         
106         ChildrenTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
107         ~ChildrenTreeStore();
108
109         void rebuild();
110
111         void refresh();
112
113         void rebuild_value_nodes();
114
115         void refresh_value_nodes();
116
117         void rebuild_canvases();
118
119         void refresh_canvases();
120
121         void refresh_row(Gtk::TreeModel::Row &row, bool do_children=false);
122
123         Gtk::TreeModel::Row get_canvas_row()const { return canvas_row; }
124         
125         Gtk::TreeModel::Row get_value_node_row()const { return value_node_row; }
126
127         /*
128  -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
129         */
130
131 public:
132         
133         static Glib::RefPtr<ChildrenTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
134 }; // END of class ChildrenTreeStore
135
136 }; // END of namespace studio
137
138 /* === E N D =============================================================== */
139
140 #endif