Code

Added a Rename menu item to the popup for the filter list in the filter effects dialo...
[inkscape.git] / src / ui / dialog / dialog.h
1 /**
2  * \brief Base class for dialogs in Inkscape.  This class provides certain common behaviors and
3  *        styles wanted of all dialogs in the application.  Fundamental parts of the dialog's
4  *        behavior is controlled by a Dialog::Behavior subclass instance connected to the dialog.
5  *
6  * Author:
7  *   Bryce W. Harrington <bryce@bryceharrington.org>
8  *   Gustav Broberg <broberg@kth.se>
9  *
10  * Copyright (C) 2004--2007 Authors
11  *
12  * Released under GNU GPL.  Read the file 'COPYING' for more information.
13  */
15 #ifndef INKSCAPE_DIALOG_H
16 #define INKSCAPE_DIALOG_H
18 #include <gtkmm/dialog.h>
19 #include <gtkmm/tooltips.h>
21 #include "dock-behavior.h"
22 #include "floating-behavior.h"
24 class SPDesktop;
26 namespace Inkscape { 
27 class Selection; 
28 class Application; 
29 }
31 namespace Inkscape {
32 namespace UI {
33 namespace Dialog {
35 enum BehaviorType { FLOATING, DOCK };
37 void sp_retransientize(Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr);
38 gboolean sp_retransientize_again(gpointer dlgPtr);
39 void sp_dialog_shutdown(GtkObject *object, gpointer dlgPtr);
41 class Dialog {
43 public:
45     Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path = NULL, 
46            int verb_num = 0, const char *apply_label = NULL);
48     virtual ~Dialog();
50     virtual void onDesktopActivated (SPDesktop*);
51     virtual void onShutdown();
53     /** Hide and show dialogs */
54     virtual void onHideF12();
55     virtual void onShowF12();
57     virtual operator Gtk::Widget&();
58     virtual GtkWidget *gobj();
59     virtual void present();
60     virtual Gtk::VBox *get_vbox();
61     virtual void show();
62     virtual void hide();
63     virtual void show_all_children();
64     virtual void set_resizable(bool);
65     virtual void set_sensitive(bool sensitive=true);
66     virtual void set_default(Gtk::Widget&);
67     virtual void set_size_request(int, int);
68     virtual void size_request(Gtk::Requisition&);
69     virtual void get_position(int& x, int& y);
70     virtual void get_size(int& width, int& height);
71     virtual void resize(int width, int height);
72     virtual void move(int x, int y);
73     virtual void set_position(Gtk::WindowPosition position);
74     virtual void set_title(Glib::ustring title);
76     virtual void set_response_sensitive(int response_id, bool setting);
77     virtual Glib::SignalProxy0<void> signal_show();
78     virtual Glib::SignalProxy0<void> signal_hide();
79     virtual Glib::SignalProxy1<void, int> signal_response();
81     virtual Gtk::Button* add_button (const Glib::ustring& button_text, int response_id);
82     virtual Gtk::Button* add_button (const Gtk::StockID& stock_id, int response_id);
83     
84     virtual void set_default_response(int response_id);
86     bool           _user_hidden; // when it is closed by the user, to prevent repopping on f12
87     bool           _hiddenF12;
89     void           read_geometry();
90     void           save_geometry();
92     bool retransientize_suppress; // when true, do not retransientize (prevents races when switching new windows too fast)
94 protected:
95     const char    *_prefs_path;
96     int            _verb_num;
97     Glib::ustring  _title;
98     const char    *_apply_label;
100     /**
101      * Tooltips object for all descendants to use
102      */
103     Gtk::Tooltips tooltips;
105     virtual void   _onResponse(int response_id);
106     virtual bool   _onDeleteEvent (GdkEventAny*);
107     virtual bool   _onEvent(GdkEvent *event);
108     virtual bool   _onKeyPress(GdkEventKey *event);
110     virtual void   _apply();
111     virtual void   _close();
112     virtual void   _defocus();
114     Inkscape::Selection*   _getSelection();
116     sigc::connection _desktop_activated_connection;
117     sigc::connection _dialogs_hidden_connection;
118     sigc::connection _dialogs_unhidden_connection;
119     sigc::connection _shutdown_connection;
121 private:
122     Behavior::Behavior* _behavior;
124     Dialog(); // no constructor without params
126     Dialog(Dialog const &d);            // no copy
127     Dialog& operator=(Dialog const &d); // no assign
129     friend class Behavior::FloatingBehavior;
130     friend class Behavior::DockBehavior;
131 };
133 } // namespace Dialog
134 } // namespace UI
135 } // namespace Inkscape
137 #endif //INKSCAPE_DIALOG_H
139 /*
140   Local Variables:
141   mode:c++
142   c-file-style:"stroustrup"
143   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
144   indent-tabs-mode:nil
145   fill-column:99
146   End:
147 */
148 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :