Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_04 / synfig-studio / src / gtkmm / metadatatreestore.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file metadatatreestore.h
3 **      \brief Template Header
4 **
5 **      $Id: metadatatreestore.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
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_METADATATREESTORE_H
26 #define __SYNFIG_STUDIO_METADATATREESTORE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <gtkmm/treestore.h>
31 #include <synfigapp/canvasinterface.h>
32 #include <gdkmm/pixbuf.h>
33 #include <synfigapp/action.h>
34
35 /* === M A C R O S ========================================================= */
36
37 /* === T Y P E D E F S ===================================================== */
38
39 /* === C L A S S E S & S T R U C T S ======================================= */
40
41 namespace synfigapp { class CanvasInterface; }
42
43 namespace studio {
44         
45 class MetaDataTreeStore : virtual public Gtk::TreeStore
46 {
47         /*
48  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
49         */
50
51 public:
52
53         class Model : public Gtk::TreeModel::ColumnRecord
54         {
55         public:
56         public:
57                 Gtk::TreeModelColumn<Glib::ustring> key;
58                 Gtk::TreeModelColumn<Glib::ustring> data;
59
60                 Model()
61                 {
62                         add(key);
63                         add(data);
64                 }
65         };
66
67         /*
68  -- ** -- P U B L I C  D A T A ------------------------------------------------
69         */
70
71 public:
72         
73         const Model model;
74
75         /*
76  -- ** -- P R I V A T E   D A T A ---------------------------------------------
77         */
78
79 private:
80
81         etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
82
83         /*
84  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
85         */
86
87 private:
88         
89         /*
90  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
91         */
92
93 private:
94
95         void meta_data_changed(synfig::String key);
96
97         /*
98  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
99         */
100
101 public:
102         
103         ~MetaDataTreeStore();
104
105         etl::loose_handle<synfigapp::CanvasInterface> get_canvas_interface() { return canvas_interface_; }
106         etl::loose_handle<const synfigapp::CanvasInterface> get_canvas_interface()const { return canvas_interface_; }
107         synfig::Canvas::Handle get_canvas()const { return canvas_interface_->get_canvas(); }
108         synfig::Canvas::Handle get_canvas() { return canvas_interface_->get_canvas(); }
109
110         void rebuild();
111
112         void refresh() { rebuild(); }
113
114         /*
115  -- ** -- P R O T E C T E D   M E T H O D S -----------------------------------
116         */
117
118 protected:
119         MetaDataTreeStore(etl::loose_handle<synfigapp::CanvasInterface>);
120         void get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const;
121         void set_value_impl(const Gtk::TreeModel::iterator& iter, int column, const Glib::ValueBase& value);
122
123 public:
124
125         static Glib::RefPtr<MetaDataTreeStore> create(etl::loose_handle<synfigapp::CanvasInterface>);
126         
127 }; // END of class MetaDataTreeStore
128
129 }; // END of namespace studio
130
131 /* === E N D =============================================================== */
132
133 #endif