initial version
[synfig.git] / synfig-studio / trunk / src / gtkmm / childrentree.h
1 /* === S I N F G =========================================================== */
2 /*!     \file childrentree.h
3 **      \brief Template Header
4 **
5 **      $Id: childrentree.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_CHILDRENTREE_H
25 #define __SINFG_STUDIO_CHILDRENTREE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <gtkmm/treeview.h>
30 #include <gtkmm/treestore.h>
31 #include <gtkmm/tooltips.h>
32 #include <gtkmm/table.h>
33 #include <gtkmm/box.h>
34 #include <gtkmm/adjustment.h>
35 #include <gtkmm/scale.h>
36 #include <gtkmm/button.h>
37
38 #include <sinfgapp/canvasinterface.h>
39 #include <sinfgapp/value_desc.h>
40 #include "childrentreestore.h"
41 #include <sinfg/valuenode_animated.h>
42
43 #include "widget_value.h"
44
45 /* === M A C R O S ========================================================= */
46
47 /* === T Y P E D E F S ===================================================== */
48
49 /* === C L A S S E S & S T R U C T S ======================================= */
50
51 namespace studio {
52
53 class CellRenderer_TimeTrack;
54 class CellRenderer_ValueBase;
55
56 class ChildrenTree : public Gtk::Table
57 {
58         /*
59  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
60         */
61
62 public:
63
64         typedef studio::ColumnID ColumnID;
65
66         /*
67  -- ** -- P U B L I C  D A T A ------------------------------------------------
68         */
69
70 public:
71         
72         ChildrenTreeStore::Model model;
73         
74         /*
75  -- ** -- P R I V A T E   D A T A ---------------------------------------------
76         */
77
78 private:
79
80         Gtk::Tooltips tooltips_;
81
82         Gtk::TreePath last_tooltip_path;
83
84         Gtk::TreeView tree_view;
85
86         Gtk::HBox *hbox;
87
88         Glib::RefPtr<ChildrenTreeStore> children_tree_store_;
89
90         CellRenderer_TimeTrack *cellrenderer_time_track;
91
92         Gtk::TreeView::Column* column_time_track;
93
94         CellRenderer_ValueBase *cellrenderer_value;
95
96         sigc::signal<void,sinfgapp::ValueDesc,sinfg::ValueBase> signal_edited_value_;
97
98         sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_user_click_;
99
100         sigc::signal<void,sinfgapp::ValueDesc,sinfg::Waypoint, int> signal_waypoint_clicked_;
101
102         Gtk::Button *button_raise;
103         Gtk::Button *button_lower;
104         Gtk::Button *button_duplicate;
105         Gtk::Button *button_delete;
106
107         Widget_ValueBase blend_method_widget;
108         
109         /*
110  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
111         */
112
113 private:
114         
115         /*
116  -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
117         */
118
119 private:
120
121         void on_edited_value(const Glib::ustring&path_string,sinfg::ValueBase value);
122
123         void on_waypoint_clicked(const Glib::ustring &, sinfg::Waypoint,int button);
124
125         bool on_tree_event(GdkEvent *event);
126
127         void on_selection_changed();
128
129         void on_dirty_preview();
130
131         void on_raise_pressed();
132
133         void on_lower_pressed();
134
135         void on_duplicate_pressed();
136
137         void on_delete_pressed();
138
139         /*
140  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
141         */
142
143 public:
144
145         Gtk::HBox& get_hbox() { return *hbox; }
146
147         Gtk::TreeView& get_tree_view() { return tree_view; }
148         
149         Glib::RefPtr<Gtk::TreeSelection> get_selection() { return tree_view.get_selection(); }
150         Glib::SignalProxy1< bool,GdkEvent* >  signal_event () { return tree_view.signal_event(); }
151         
152         ChildrenTree();
153         ~ChildrenTree();
154
155         void set_model(Glib::RefPtr<ChildrenTreeStore> children_tree_store_);
156
157         void set_time_adjustment(Gtk::Adjustment &adjustment);
158
159         void set_show_timetrack(bool x=true);
160
161         //! Signal called with a value has been edited.
162         sigc::signal<void,sinfgapp::ValueDesc,sinfg::ValueBase>& signal_edited_value() { return signal_edited_value_; }
163
164         sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_user_click() { return signal_user_click_; }
165
166         sigc::signal<void,sinfgapp::ValueDesc,sinfg::Waypoint, int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
167
168         etl::handle<sinfgapp::SelectionManager> get_selection_manager() { return children_tree_store_->canvas_interface()->get_selection_manager(); }
169
170 }; // END of ChildrenTree
171
172 }; // END of namespace studio
173
174 /* === E N D =============================================================== */
175
176 #endif