Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_03 / synfig-studio / src / gtkmm / dockable.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file dockable.h
3 **      \brief Template Header
4 **
5 **      $Id: dockable.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
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_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/tooltips.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::Tooltips tooltips_;
75         Gtk::Frame frame_;
76         Gtk::Label title_label_;
77         //Gtk::HBox button_box_;
78         Gtk::HBox header_box_;
79         //Gtk::VBox vbox_;
80         
81         //Gtk::HandleBox handle_box_;
82         Gtk::ScrolledWindow *scrolled_;
83         Gtk::Widget *prev_widget_;
84
85         bool use_scrolled_;
86         
87         Gtk::StockID stock_id_;
88
89         DockBook* parent_;
90
91         bool dnd_success_;
92
93 public:
94         //Gtk::VBox* get_vbox() { return &vbox_; }
95
96         void set_toolbar(Gtk::Toolbar& toolbar);
97
98         void set_use_scrolled(bool x) { use_scrolled_=x; }
99         
100         Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" "));
101         ~Dockable();
102
103         sigc::signal<void>& signal_stock_id_changed() { return signal_stock_id_changed_; }
104
105         const synfig::String& get_name()const { return name_; }
106         const synfig::String& get_local_name()const { return local_name_; }
107
108         const Gtk::StockID& get_stock_id()const { return stock_id_; }
109         void set_stock_id(Gtk::StockID x) { stock_id_=x; signal_stock_id_changed()(); }
110         
111         void set_local_name(const synfig::String&);
112
113         void clear();
114         
115         Gtk::Tooltips& get_tooltips() { return tooltips_; }
116         
117         //DialogSettings& settings() { return dialog_settings; }
118         //const DialogSettings& settings()const { return dialog_settings; }
119         
120         void add(Gtk::Widget& x);
121         
122         Gtk::ToolButton* add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip=synfig::String());      
123         
124         void detach();
125
126         void present();
127         
128         void attach_dnd_to(Gtk::Widget& widget);
129
130         bool clear_previous();
131         virtual Gtk::Widget* create_tab_label();
132
133 private:
134         
135         void on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& selection_data, guint info, guint time);
136         void on_drag_end(const Glib::RefPtr<Gdk::DragContext>&context);
137         void on_drag_begin(const Glib::RefPtr<Gdk::DragContext>&context);
138         void on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time);
139
140 }; // END of studio::Dockable
141
142 }; // END of namespace studio
143
144 /* === E N D =============================================================== */
145
146 #endif