Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / keyframetree.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file keyframetree.h
3 **      \brief Template Header
4 **
5 **      $Id$
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_KEYFRAMETREE_H
26 #define __SYNFIG_STUDIO_KEYFRAMETREE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <gtkmm/treeview.h>
31 #include <gtkmm/treestore.h>
32 #include <synfigapp/canvasinterface.h>
33 #include <synfigapp/value_desc.h>
34 #include "keyframetreestore.h"
35 #include <synfig/keyframe.h>
36
37 /* === M A C R O S ========================================================= */
38
39 /* === T Y P E D E F S ===================================================== */
40
41 /* === C L A S S E S & S T R U C T S ======================================= */
42
43 namespace studio {
44
45 class CellRenderer_Time;
46
47 class KeyframeTree : public Gtk::TreeView
48 {
49         /*
50  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
51         */
52
53 public:
54
55         enum ColumnID
56         {
57                 COLUMNID_TIME,
58                 COLUMNID_DESCRIPTION,
59                 COLUMNID_JUMP,
60
61                 COLUMNID_END                    //!< \internal
62         };
63
64         /*
65  -- ** -- P U B L I C  D A T A ------------------------------------------------
66         */
67
68 public:
69
70         KeyframeTreeStore::Model model;
71
72         /*
73  -- ** -- P R I V A T E   D A T A ---------------------------------------------
74         */
75
76 private:
77
78         Glib::RefPtr<KeyframeTreeStore> keyframe_tree_store_;
79
80         CellRenderer_Time *cell_renderer_time;
81
82         CellRenderer_Time *cell_renderer_time_delta;
83
84         Gtk::CellRendererText *cell_renderer_description;
85
86         sigc::signal<void,synfig::Keyframe> signal_edited_;
87
88         sigc::signal<void,synfig::Keyframe,synfig::Time> signal_edited_time_;
89
90         sigc::signal<void,synfig::Keyframe,synfig::String> signal_edited_description_;
91
92         sigc::signal<void, int, Gtk::TreeRow, ColumnID> signal_user_click_;
93
94         bool editable_;
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_edited_time(const Glib::ustring&path_string,synfig::Time time);
109
110         void on_edited_time_delta(const Glib::ustring&path_string,synfig::Time time);
111
112         void on_edited_description(const Glib::ustring&path_string,const Glib::ustring &description);
113
114         bool on_event(GdkEvent *event);
115
116         void on_rend_desc_changed();
117
118         /*
119  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
120         */
121
122 public:
123
124         KeyframeTree();
125         ~KeyframeTree();
126
127         void set_model(Glib::RefPtr<KeyframeTreeStore> keyframe_tree_store_);
128
129         void set_editable(bool x=true);
130
131         bool get_editable()const { return editable_; }
132
133         //! Signal called when a keyframe has been edited in any way
134         sigc::signal<void,synfig::Keyframe>& signal_edited() { return signal_edited_; }
135
136         //! Signal called when a time has been edited.
137         sigc::signal<void,synfig::Keyframe,synfig::Time>& signal_edited_time() { return signal_edited_time_; }
138
139         //! Signal called when a description has been edited.
140         sigc::signal<void,synfig::Keyframe,synfig::String>& signal_edited_description() { return signal_edited_description_; }
141
142         sigc::signal<void,int, Gtk::TreeRow, ColumnID>& signal_user_click() { return signal_user_click_; }
143 }; // END of KeyframeTree
144
145 }; // END of namespace studio
146
147 /* === E N D =============================================================== */
148
149 #endif