synfig-studio  1.0.3
canvastreestore.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
21 /* ========================================================================= */
22 
23 /* === S T A R T =========================================================== */
24 
25 #ifndef __SYNFIG_STUDIO_CANVASTREESTORE_H
26 #define __SYNFIG_STUDIO_CANVASTREESTORE_H
27 
28 /* === H E A D E R S ======================================================= */
29 
30 #include <gtkmm/treestore.h>
32 #include <gdkmm/pixbuf.h>
33 #include <synfigapp/value_desc.h>
34 #include <gtkmm/treeview.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 CellRenderer_TimeTrack;
45 class CellRenderer_ValueBase;
46 
47  enum ColumnID
48  {
53 
55  };
56 #define COLUMNID_NAME COLUMNID_ID
57 
58 class CanvasTreeStore : virtual public Gtk::TreeStore
59 {
60  /*
61  -- ** -- P U B L I C T Y P E S ---------------------------------------------
62  */
63 
64 public:
65 
66  class Model : public Gtk::TreeModel::ColumnRecord
67  {
68  public:
69  Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
70  Gtk::TreeModelColumn<Glib::ustring> label;
71  Gtk::TreeModelColumn<Glib::ustring> name;
72  Gtk::TreeModelColumn<Glib::ustring> id;
73 
74  Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
75  Gtk::TreeModelColumn<bool> is_canvas;
76 
77  Gtk::TreeModelColumn<synfig::ValueNode::Handle> value_node;
78  Gtk::TreeModelColumn<bool> is_value_node;
79  Gtk::TreeModelColumn<synfig::ValueBase> value;
80  Gtk::TreeModelColumn<Glib::ustring> type;
81  Gtk::TreeModelColumn<int> link_id;
82  Gtk::TreeModelColumn<int> link_count;
83 
84  Gtk::TreeModelColumn<bool> is_editable;
85 
86  Gtk::TreeModelColumn<bool> is_shared;
87  Gtk::TreeModelColumn<bool> is_exported;
88 
89  Gtk::TreeModelColumn<synfigapp::ValueDesc> value_desc;
90  Gtk::TreeModelColumn<synfig::ParamDesc> child_param_desc;
91 
92  Gtk::TreeModelColumn<Glib::ustring> tooltip;
93 
94  Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > interpolation_icon;
95  Gtk::TreeModelColumn<bool> is_static;
96  Gtk::TreeModelColumn<bool> interpolation_icon_visible;
97 
99  {
100  add(value);
101  add(name);
102  add(label);
103  add(icon);
104  add(type);
105  add(id);
106  add(canvas);
107  add(value_node);
108  add(is_canvas);
109  add(is_value_node);
110 
111  add(is_shared);
112  add(is_exported);
113  add(is_editable);
114  add(value_desc);
115  add(child_param_desc);
116  add(link_count);
117  add(link_id);
118 
119  add(tooltip);
120  add(interpolation_icon);
121  add(is_static);
123  }
124  };
125 
126  /*
127  -- ** -- P U B L I C D A T A ------------------------------------------------
128  */
129 
130 public:
131 
132  const Model model;
133 
134  //std::multimap<etl::handle<ValueNode>, sigc::connection> connection_map;
135 
136  /*
137  -- ** -- P R I V A T E D A T A ---------------------------------------------
138  */
139 
140 private:
141 
142  etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
143 
144  /*
145  -- ** -- P R I V A T E M E T H O D S ---------------------------------------
146  */
147 
148 private:
149  synfig::ValueNode::Handle expandable_bone_parent(synfig::ValueNode::Handle node);
150 
151 protected:
152  virtual void get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
153 
154  /*
155  -- ** -- S I G N A L T E R M I N A L S -------------------------------------
156  */
157 
158 private:
159 
160  /*
161  -- ** -- P U B L I C M E T H O D S -----------------------------------------
162  */
163 
164 public:
165 
166  CanvasTreeStore(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_);
168 
169  etl::loose_handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
170  etl::loose_handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
171 
172  virtual void rebuild_row(Gtk::TreeModel::Row &row, bool do_children=true);
173 
174  virtual void refresh_row(Gtk::TreeModel::Row &row, bool do_children=true);
175 
176  virtual void set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool do_children=true);
177 
178  bool find_first_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter);
179  bool find_next_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter);
180 
181  bool find_first_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter);
182  bool find_next_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter);
183 
184 
185  static CellRenderer_ValueBase* add_cell_renderer_value(Gtk::TreeView::Column* column);
186 
187  static CellRenderer_TimeTrack* add_cell_renderer_value_node(Gtk::TreeView::Column* column);
188 
189  etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
190 
191  virtual void on_value_node_changed(synfig::ValueNode::Handle value_node)=0;
192 
193  /*
194  -- ** -- P R O T E C T E D M E T H O D S -----------------------------------
195  */
196 
197 public:
198 
199 }; // END of class CanvasTreeStore
200 
201 }; // END of namespace studio
202 
203 /* === E N D =============================================================== */
204 
205 #endif