1 /** @file
2 * @brief Dialog behavior interface
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 */
12 #ifndef INKSCAPE_UI_DIALOG_BEHAVIOR_H
13 #define INKSCAPE_UI_DIALOG_BEHAVIOR_H
15 #include <gtkmm/button.h>
16 #include <gtkmm/box.h>
18 class SPDesktop;
20 namespace Inkscape {
21 namespace UI {
22 namespace Dialog {
24 class Dialog;
26 namespace Behavior {
28 class Behavior;
30 typedef Behavior *(*BehaviorFactory)(Dialog &dialog);
32 template <typename T>
33 Behavior *create(Dialog &dialog)
34 {
35 return T::create(dialog);
36 }
39 class Behavior {
41 public:
42 virtual ~Behavior() { }
44 /** Gtk::Dialog methods */
45 virtual operator Gtk::Widget&() =0;
46 virtual GtkWidget *gobj() =0;
47 virtual void present() =0;
48 virtual Gtk::VBox *get_vbox() =0;
49 virtual void show() =0;
50 virtual void hide() =0;
51 virtual void show_all_children() =0;
52 virtual void resize(int width, int height) =0;
53 virtual void move(int x, int y) =0;
54 virtual void set_position(Gtk::WindowPosition) =0;
55 virtual void set_size_request(int width, int height) =0;
56 virtual void size_request(Gtk::Requisition &requisition) =0;
57 virtual void get_position(int &x, int &y) =0;
58 virtual void get_size(int &width, int &height) =0;
59 virtual void set_title(Glib::ustring title) =0;
60 virtual void set_sensitive(bool sensitive) =0;
62 /** Gtk::Dialog signal proxies */
63 virtual Glib::SignalProxy0<void> signal_show() =0;
64 virtual Glib::SignalProxy0<void> signal_hide() =0;
65 virtual Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event() =0;
67 /** Custom signal handlers */
68 virtual void onHideF12() =0;
69 virtual void onShowF12() =0;
70 virtual void onShutdown() =0;
71 virtual void onDesktopActivated(SPDesktop *desktop) =0;
73 protected:
74 Behavior(Dialog &dialog)
75 : _dialog (dialog)
76 { }
78 Dialog& _dialog; //< reference to the owner
80 private:
81 Behavior(); // no constructor without params
82 Behavior(const Behavior &); // no copy
83 Behavior &operator=(const Behavior &); // no assign
84 };
86 } // namespace Behavior
87 } // namespace Dialog
88 } // namespace UI
89 } // namespace Inkscape
92 #endif //INKSCAPE_UI_DIALOG_BEHAVIOR_H
94 /*
95 Local Variables:
96 mode:c++
97 c-file-style:"stroustrup"
98 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
99 indent-tabs-mode:nil
100 fill-column:99
101 End:
102 */
103 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :