1 /**
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_response_sensitive(int response_id, bool setting) =0;
61 virtual void set_sensitive(bool sensitive) =0;
62 virtual Gtk::Button *add_button(const Glib::ustring& button_text, int response_id) =0;
63 virtual Gtk::Button *add_button(const Gtk::StockID& stock_id, int response_id) =0;
64 virtual void set_default_response(int response_id) =0;
66 /** Gtk::Dialog signal proxies */
67 virtual Glib::SignalProxy0<void> signal_show() =0;
68 virtual Glib::SignalProxy0<void> signal_hide() =0;
69 virtual Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event() =0;
70 virtual Glib::SignalProxy1<void, int> signal_response() =0;
72 /** Custom signal handlers */
73 virtual void onHideF12() =0;
74 virtual void onShowF12() =0;
75 virtual void onShutdown() =0;
76 virtual void onDesktopActivated(SPDesktop *desktop) =0;
78 protected:
79 Behavior(Dialog& dialog)
80 : _dialog (dialog)
81 { }
83 Dialog& _dialog; //< reference to the owner
85 private:
86 Behavior(); // no constructor without params
87 Behavior(const Behavior&); // no copy
88 Behavior& operator=(const Behavior&); // no assign
89 };
91 } // namespace Behavior
92 } // namespace Dialog
93 } // namespace UI
94 } // namespace Inkscape
97 #endif //INKSCAPE_UI_DIALOG_BEHAVIOR_H
99 /*
100 Local Variables:
101 mode:c++
102 c-file-style:"stroustrup"
103 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
104 indent-tabs-mode:nil
105 fill-column:99
106 End:
107 */
108 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :