grab stable branch
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / historytreestore.h
1 /* === S I N F 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 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_HISTORYTREESTORE_H
25 #define __SINFG_STUDIO_HISTORYTREESTORE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <gtkmm/treestore.h>
30 #include <sinfgapp/canvasinterface.h>
31 #include <gdkmm/pixbuf.h>
32 #include <sinfgapp/action.h>
33
34 /* === M A C R O S ========================================================= */
35
36 /* === T Y P E D E F S ===================================================== */
37
38 /* === C L A S S E S & S T R U C T S ======================================= */
39
40 namespace studio {
41
42 class Instance;
43         
44 class HistoryTreeStore : virtual public Gtk::TreeStore
45 {
46         /*
47  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
48         */
49
50 public:
51
52         class Model : public Gtk::TreeModel::ColumnRecord
53         {
54         public:
55         public:
56                 Gtk::TreeModelColumn<etl::handle<sinfgapp::Action::Undoable> > action;
57                 Gtk::TreeModelColumn<Glib::ustring> name;
58                 Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
59                 Gtk::TreeModelColumn<bool> is_active;
60                 Gtk::TreeModelColumn<bool> is_undo;
61                 Gtk::TreeModelColumn<bool> is_redo;
62
63                 Gtk::TreeModelColumn<Glib::ustring> canvas_id;
64                 Gtk::TreeModelColumn<sinfg::Canvas::Handle> canvas;
65
66                 Model()
67                 {
68                         add(action);
69                         add(name);
70                         add(icon);
71                         add(is_active);
72                         add(is_undo);
73                         add(is_redo);
74                         add(canvas_id);
75                         add(canvas);
76                 }
77         };
78
79         /*
80  -- ** -- P U B L I C  D A T A ------------------------------------------------
81         */
82
83 public:
84         
85         const Model model;
86
87         /*
88  -- ** -- P R I V A T E   D A T A ---------------------------------------------
89         */
90
91 private:
92
93         etl::loose_handle<studio::Instance> instance_;
94         Gtk::TreeIter curr_row; 
95
96         /*
97  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
98         */
99
100 private:
101         
102         /*
103  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
104         */
105
106 private:
107
108         void on_undo();
109         
110         void on_redo();
111         
112         void on_undo_stack_cleared();
113         
114         void on_redo_stack_cleared();
115         
116         void on_new_action(etl::handle<sinfgapp::Action::Undoable> action);
117
118         void on_action_status_changed(etl::handle<sinfgapp::Action::Undoable> action);
119
120         /*
121  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
122         */
123
124 public:
125         
126         HistoryTreeStore(etl::loose_handle<studio::Instance> instance_);
127         ~HistoryTreeStore();
128
129         etl::loose_handle<studio::Instance> instance() { return instance_; }
130         etl::loose_handle<const studio::Instance> instance()const { return instance_; }
131
132         void rebuild();
133
134         void refresh() { rebuild(); }
135
136         void insert_action(Gtk::TreeRow row,etl::handle<sinfgapp::Action::Undoable> action, bool is_active=true, bool is_undo=true, bool is_redo=false);
137
138         /*
139  -- ** -- P R O T E C T E D   M E T H O D S -----------------------------------
140         */
141
142 public:
143
144         static Glib::RefPtr<HistoryTreeStore> create(etl::loose_handle<studio::Instance> instance);
145         
146 }; // END of class HistoryTreeStore
147
148 }; // END of namespace studio
149
150 /* === E N D =============================================================== */
151
152 #endif