Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_05 / synfig-studio / src / gtkmm / compview.h
1 /*! ========================================================================
2 ** Synfig
3 ** Template Header File
4 ** $Id: compview.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
5 **
6 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
7 **
8 **      This package is free software; you can redistribute it and/or
9 **      modify it under the terms of the GNU General Public License as
10 **      published by the Free Software Foundation; either version 2 of
11 **      the License, or (at your option) any later version.
12 **
13 **      This package is distributed in the hope that it will be useful,
14 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
15 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 **      General Public License for more details.
17 **
18 ** === N O T E S ===========================================================
19 **
20 ** ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_COMPVIEW_H
25 #define __SYNFIG_COMPVIEW_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <gtkmm/window.h>
30 #include <gtkmm/image.h>
31 #include <gtkmm/tooltips.h>
32 #include <gtkmm/table.h>
33 #include <gtkmm/button.h>
34 #include <gtkmm/menu.h>
35 #include <gtkmm/optionmenu.h>
36 #include <gtkmm/notebook.h>
37 #include <gtkmm/treeview.h>
38 #include <gtkmm/box.h>
39
40 #include <ETL/handle>
41
42 #include "dialogsettings.h"
43
44 /* === M A C R O S ========================================================= */
45
46 /* === T Y P E D E F S ===================================================== */
47
48 /* === C L A S S E S & S T R U C T S ======================================= */
49
50 namespace synfig { class Canvas; };
51
52 namespace studio {
53
54 class Instance;
55 class CanvasView;
56
57 class CompView : public Gtk::Window
58 {
59         DialogSettings dialog_settings;
60         
61         Gtk::Tooltips tooltips;
62
63         Gtk::OptionMenu *instance_selector;
64         Gtk::Notebook *notebook;
65
66         Gtk::TreeView *canvas_tree;
67         Gtk::TreeView *action_tree;
68
69         Gtk::Menu       instance_list_menu;
70         Gtk::Menu       menu;
71
72         etl::loose_handle<studio::Instance>     selected_instance;
73
74         void set_selected_instance_(etl::handle<studio::Instance> x);
75
76         void clear_history();
77         void clear_redo();
78         
79 public:
80         CompView();
81         ~CompView();
82
83         etl::loose_handle<studio::Instance> get_selected_instance() { return selected_instance; }
84
85         etl::loose_handle<synfig::Canvas> get_selected_canvas();
86
87         etl::loose_handle<studio::CanvasView> get_selected_canvas_view();
88
89         void set_selected_instance(etl::loose_handle<studio::Instance> x);
90
91         void set_selected_instance_signal(etl::handle<studio::Instance> x);
92
93         void new_instance(etl::handle<studio::Instance> x);
94
95         void delete_instance(etl::handle<studio::Instance> x);
96
97         void refresh_instances();
98
99         bool close();
100
101 private:
102         
103         Gtk::Widget* create_canvas_tree();
104         Gtk::Widget* create_action_tree();
105         Gtk::Widget* create_instance_selector();
106         
107         void on_row_activate(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *);
108         bool on_tree_event(GdkEvent *event);
109
110         bool on_action_event(GdkEvent *event);
111
112         void init_menu();
113
114         void menu_new_canvas();
115         void menu_delete();
116         void menu_rename();
117
118         void on_action_toggle(const Glib::ustring& path);
119 };
120
121 };
122
123 /* === E N D =============================================================== */
124
125 #endif