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