synfig-studio  1.0.3
dockable.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
21 /* ========================================================================= */
22 
23 /* === S T A R T =========================================================== */
24 
25 #ifndef __SYNFIG_STUDIO_DOCKABLE_H
26 #define __SYNFIG_STUDIO_DOCKABLE_H
27 
28 /* === H E A D E R S ======================================================= */
29 
30 #include <gtkmm/stockid.h>
31 #include <gtkmm/button.h>
32 #include "dialogsettings.h"
33 #include <synfig/string.h>
34 #include <gtkmm/table.h>
35 #include <gtkmm/tooltip.h>
36 #include <gtkmm/label.h>
37 #include <gtkmm/frame.h>
38 #include <gtkmm/handlebox.h>
39 #include <gtkmm/box.h>
40 #include <gtkmm/scrolledwindow.h>
41 #include <gtkmm/toolbar.h>
42 #include <gtkmm/toolbutton.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 studio {
51 
52 class DockManager;
53 class DockBook;
54 
55 class Dockable : public Gtk::Table
56 {
57  friend class DockManager;
58  friend class DockBook;
59 
60 
61  sigc::signal<void> signal_stock_id_changed_;
62  sigc::connection prev_widget_delete_connection;
63 protected:
64 
65 // DialogSettings dialog_settings;
66 
67 
68 private:
69 
70  Gtk::Toolbar *toolbar_;
71 
72  synfig::String name_;
73  synfig::String local_name_;
74  Gtk::Frame frame_;
75  Gtk::Label title_label_;
76  //Gtk::HBox button_box_;
77  Gtk::HBox header_box_;
78 
79  //Gtk::HandleBox handle_box_;
80  Gtk::ScrolledWindow *scrolled_;
81  Gtk::Widget *prev_widget_;
82 
83  bool use_scrolled_;
84 
85  Gtk::StockID stock_id_;
86 
87  bool dnd_success_;
88 
89 public:
90 
91  void set_toolbar(Gtk::Toolbar& toolbar);
92 
93  void set_use_scrolled(bool x) { use_scrolled_=x; }
94 
95  Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" "));
96  ~Dockable();
97 
98  sigc::signal<void>& signal_stock_id_changed() { return signal_stock_id_changed_; }
99 
100  const synfig::String& get_name()const { return name_; }
101  const synfig::String& get_local_name()const { return local_name_; }
102 
103  const Gtk::StockID& get_stock_id()const { return stock_id_; }
104  void set_stock_id(Gtk::StockID x) { stock_id_=x; signal_stock_id_changed()(); }
105 
106  void set_local_name(const synfig::String&);
107 
108  void clear();
109 
110  //DialogSettings& settings() { return dialog_settings; }
111  //const DialogSettings& settings()const { return dialog_settings; }
112 
113  void add(Gtk::Widget& x);
114 
115  Gtk::ToolButton* add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip=synfig::String());
116 
117  virtual void present();
118 
119  void attach_dnd_to(Gtk::Widget& widget);
120 
121  bool clear_previous();
122  virtual Gtk::Widget* create_tab_label();
123 
124 private:
125 
126  void on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& selection_data, guint info, guint time);
127  void on_drag_end(const Glib::RefPtr<Gdk::DragContext>&context);
128  void on_drag_begin(const Glib::RefPtr<Gdk::DragContext>&context);
129  void on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time);
130 
131 }; // END of studio::Dockable
132 
133 }; // END of namespace studio
134 
135 /* === E N D =============================================================== */
136 
137 #endif