Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_05 / synfig-studio / src / gtkmm / historytreestore.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file historytreestore.h
3 **      \brief Template Header
4 **
5 **      $Id: historytreestore.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_HISTORYTREESTORE_H
26 #define __SYNFIG_STUDIO_HISTORYTREESTORE_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 studio {
42
43 class Instance;
44         
45 class HistoryTreeStore : 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<etl::handle<synfigapp::Action::Undoable> > action;
58                 Gtk::TreeModelColumn<Glib::ustring> name;
59                 Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
60                 Gtk::TreeModelColumn<bool> is_active;
61                 Gtk::TreeModelColumn<bool> is_undo;
62                 Gtk::TreeModelColumn<bool> is_redo;
63
64                 Gtk::TreeModelColumn<Glib::ustring> canvas_id;
65                 Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
66
67                 Model()
68                 {
69                         add(action);
70                         add(name);
71                         add(icon);
72                         add(is_active);
73                         add(is_undo);
74                         add(is_redo);
75                         add(canvas_id);
76                         add(canvas);
77                 }
78         };
79
80         /*
81  -- ** -- P U B L I C  D A T A ------------------------------------------------
82         */
83
84 public:
85         
86         const Model model;
87
88         /*
89  -- ** -- P R I V A T E   D A T A ---------------------------------------------
90         */
91
92 private:
93
94         etl::loose_handle<studio::Instance> instance_;
95         Gtk::TreeIter curr_row; 
96
97         /*
98  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
99         */
100
101 private:
102         
103         /*
104  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
105         */
106
107 private:
108
109         void on_undo();
110         
111         void on_redo();
112         
113         void on_undo_stack_cleared();
114         
115         void on_redo_stack_cleared();
116         
117         void on_new_action(etl::handle<synfigapp::Action::Undoable> action);
118
119         void on_action_status_changed(etl::handle<synfigapp::Action::Undoable> action);
120
121         /*
122  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
123         */
124
125 public:
126         
127         HistoryTreeStore(etl::loose_handle<studio::Instance> instance_);
128         ~HistoryTreeStore();
129
130         etl::loose_handle<studio::Instance> instance() { return instance_; }
131         etl::loose_handle<const studio::Instance> instance()const { return instance_; }
132
133         void rebuild();
134
135         void refresh() { rebuild(); }
136
137         void insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool is_active=true, bool is_undo=true, bool is_redo=false);
138
139         /*
140  -- ** -- P R O T E C T E D   M E T H O D S -----------------------------------
141         */
142
143 public:
144
145         static Glib::RefPtr<HistoryTreeStore> create(etl::loose_handle<studio::Instance> instance);
146         
147 }; // END of class HistoryTreeStore
148
149 }; // END of namespace studio
150
151 /* === E N D =============================================================== */
152
153 #endif