grab stable branch
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / compview.h
1 /*! ========================================================================
2 ** Sinfg
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 Robert B. Quattlebaum Jr.
7 **
8 ** This software and associated documentation
9 ** are CONFIDENTIAL and PROPRIETARY property of
10 ** the above-mentioned copyright holder.
11 **
12 ** You may not copy, print, publish, or in any
13 ** other way distribute this software without
14 ** a prior written agreement with
15 ** the copyright holder.
16 **
17 ** === N O T E S ===========================================================
18 **
19 ** ========================================================================= */
20
21 /* === S T A R T =========================================================== */
22
23 #ifndef __SINFG_COMPVIEW_H
24 #define __SINFG_COMPVIEW_H
25
26 /* === H E A D E R S ======================================================= */
27
28 #include <gtkmm/window.h>
29 #include <gtkmm/image.h>
30 #include <gtkmm/tooltips.h>
31 #include <gtkmm/table.h>
32 #include <gtkmm/button.h>
33 #include <gtkmm/menu.h>
34 #include <gtkmm/optionmenu.h>
35 #include <gtkmm/notebook.h>
36 #include <gtkmm/treeview.h>
37 #include <gtkmm/box.h>
38
39 #include <ETL/handle>
40
41 #include "dialogsettings.h"
42
43 /* === M A C R O S ========================================================= */
44
45 /* === T Y P E D E F S ===================================================== */
46
47 /* === C L A S S E S & S T R U C T S ======================================= */
48
49 namespace sinfg { class Canvas; };
50
51 namespace studio {
52
53 class Instance;
54 class CanvasView;
55
56 class CompView : public Gtk::Window
57 {
58         DialogSettings dialog_settings;
59         
60         Gtk::Tooltips tooltips;
61
62         Gtk::OptionMenu *instance_selector;
63         Gtk::Notebook *notebook;
64
65         Gtk::TreeView *canvas_tree;
66         Gtk::TreeView *action_tree;
67
68         Gtk::Menu       instance_list_menu;
69         Gtk::Menu       menu;
70
71         etl::loose_handle<studio::Instance>     selected_instance;
72
73         void set_selected_instance_(etl::handle<studio::Instance> x);
74
75         void clear_history();
76         void clear_redo();
77         
78 public:
79         CompView();
80         ~CompView();
81
82         etl::loose_handle<studio::Instance> get_selected_instance() { return selected_instance; }
83
84         etl::loose_handle<sinfg::Canvas> get_selected_canvas();
85
86         etl::loose_handle<studio::CanvasView> get_selected_canvas_view();
87
88         void set_selected_instance(etl::loose_handle<studio::Instance> x);
89
90         void set_selected_instance_signal(etl::handle<studio::Instance> x);
91
92         void new_instance(etl::handle<studio::Instance> x);
93
94         void delete_instance(etl::handle<studio::Instance> x);
95
96         void refresh_instances();
97
98         bool close();
99
100 private:
101         
102         Gtk::Widget* create_canvas_tree();
103         Gtk::Widget* create_action_tree();
104         Gtk::Widget* create_instance_selector();
105         
106         void on_row_activate(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *);
107         bool on_tree_event(GdkEvent *event);
108
109         bool on_action_event(GdkEvent *event);
110
111         void init_menu();
112
113         void menu_new_canvas();
114         void menu_delete();
115         void menu_rename();
116
117         void on_action_toggle(const Glib::ustring& path);
118 };
119
120 };
121
122 /* === E N D =============================================================== */
123
124 #endif