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