1 /**
2 * \brief A dockable dialog implementation.
3 *
4 * Author:
5 * Gustav Broberg <broberg@kth.se>
6 *
7 * Copyright (C) 2007 Authors
8 *
9 * Released under GNU GPL. Read the file 'COPYING' for more information.
10 */
13 #ifndef INKSCAPE_UI_DIALOG_DOCK_BEHAVIOR_H
14 #define INKSCAPE_UI_DIALOG_DOCK_BEHAVIOR_H
16 #include <map>
18 #include <gtkmm/buttonbox.h>
19 #include <gtkmm/frame.h>
20 #include <gtkmm/paned.h>
22 #include "ui/widget/dock-item.h"
24 #include "libgdl/libgdl.h"
26 #include "behavior.h"
28 namespace Inkscape {
29 namespace UI {
30 namespace Dialog {
31 namespace Behavior {
33 class DockBehavior : public Behavior {
35 public:
36 static Behavior *create(Dialog& dialog);
38 ~DockBehavior();
40 /** Gtk::Dialog methods */
41 operator Gtk::Widget&();
42 GtkWidget *gobj();
43 void present();
44 Gtk::VBox *get_vbox();
45 void show();
46 void hide();
47 void show_all_children();
48 void resize(int width, int height);
49 void move(int x, int y);
50 void set_position(Gtk::WindowPosition);
51 void set_size_request(int width, int height);
52 void size_request(Gtk::Requisition& requisition);
53 void get_position(int& x, int& y);
54 void get_size(int& width, int& height);
55 void set_title(Glib::ustring title);
56 void set_sensitive(bool sensitive);
58 /** Gtk::Dialog signal proxies */
59 Glib::SignalProxy0<void> signal_show();
60 Glib::SignalProxy0<void> signal_hide();
61 Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event();
62 Glib::SignalProxy0<void> signal_drag_begin();
63 Glib::SignalProxy1<void, bool> signal_drag_end();
65 /** Custom signal handlers */
66 void onHideF12();
67 void onShowF12();
68 void onDesktopActivated(SPDesktop *desktop);
69 void onShutdown();
71 private:
72 Widget::DockItem _dock_item;
74 DockBehavior(Dialog& dialog);
76 /** Internal helpers */
77 Gtk::Paned *_getPaned(); //< gives the parent pane, if the dock item has one
78 void _requestHeight(int height); //< tries to resize the dock item to the requested hieght
80 /** Internal signal handlers */
81 void _onHide();
82 bool _onDeleteEvent(GdkEventAny *event);
83 void _onStateChanged(Widget::DockItem::State prev_state, Widget::DockItem::State new_state);
84 bool _onKeyPress(GdkEventKey *event);
86 sigc::connection _signal_hide_connection;
87 sigc::connection _signal_key_press_event_connection;
89 };
91 } // namespace Behavior
92 } // namespace Dialog
93 } // namespace UI
94 } // namespace Inkscape
96 #endif // INKSCAPE_UI_DIALOG_DOCK_BEHAVIOR_H
98 /*
99 Local Variables:
100 mode:c++
101 c-file-style:"stroustrup"
102 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
103 indent-tabs-mode:nil
104 fill-column:99
105 End:
106 */
107 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :