synfig-studio  1.0.3
compview.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
25 /* === S T A R T =========================================================== */
26 
27 #ifndef __SYNFIG_COMPVIEW_H
28 #define __SYNFIG_COMPVIEW_H
29 
30 /* === H E A D E R S ======================================================= */
31 
32 #include <vector>
33 
34 #include <gtkmm/window.h>
35 #include <gtkmm/image.h>
36 #include <gtkmm/tooltip.h>
37 #include <gtkmm/table.h>
38 #include <gtkmm/button.h>
39 #include <gtkmm/menu.h>
40 #include <gtkmm/notebook.h>
41 #include <gtkmm/treeview.h>
42 #include <gtkmm/box.h>
43 #include <gtkmm/comboboxtext.h>
44 
45 #include <ETL/handle>
46 
47 #include "dialogsettings.h"
48 
49 /* === M A C R O S ========================================================= */
50 
51 /* === T Y P E D E F S ===================================================== */
52 
53 /* === C L A S S E S & S T R U C T S ======================================= */
54 
55 namespace synfig { class Canvas; };
56 
57 namespace studio {
58 
59 class Instance;
60 class CanvasView;
61 
62 class CompView : public Gtk::Window
63 {
64  DialogSettings dialog_settings;
65 
66  Gtk::Tooltip tooltip;
67 
68  Gtk::ComboBoxText instance_selector;
69  Gtk::Notebook *notebook;
70 
71  Gtk::TreeView *canvas_tree;
72  Gtk::TreeView *action_tree;
73 
74  Gtk::Menu menu;
75 
76  std::vector< etl::loose_handle<studio::Instance> > instances;
77  etl::loose_handle<studio::Instance> selected_instance;
78 
79  void set_selected_instance_(etl::handle<studio::Instance> x);
80 
81  void clear_history();
82  void clear_redo();
83 
84 protected:
86 
87 public:
88  CompView();
89  ~CompView();
90 
91  etl::loose_handle<studio::Instance> get_selected_instance() { return selected_instance; }
92 
93  etl::loose_handle<synfig::Canvas> get_selected_canvas();
94 
95  etl::loose_handle<studio::CanvasView> get_selected_canvas_view();
96 
97  void set_selected_instance(etl::loose_handle<studio::Instance> x);
98 
99  void set_selected_instance_signal(etl::handle<studio::Instance> x);
100 
101  void new_instance(etl::handle<studio::Instance> x);
102 
103  void delete_instance(etl::handle<studio::Instance> x);
104 
105  void refresh_instances();
106 
107  bool close();
108 
109 private:
110 
111  Gtk::Widget* create_canvas_tree();
112  Gtk::Widget* create_action_tree();
113 
114  void on_row_activate(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *);
115  bool on_tree_event(GdkEvent *event);
116 
117  bool on_action_event(GdkEvent *event);
118 
119  void init_menu();
120 
121  void menu_new_canvas();
122  void menu_delete();
123  void menu_rename();
124 
125  void on_action_toggle(const Glib::ustring& path);
126 };
127 
128 };
129 
130 /* === E N D =============================================================== */
131 
132 #endif