Code

fix compositing for premultiplication and non-alpha cases
[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 namespace Inkscape { class Selection; }
25 class SPDesktop;
27 namespace Inkscape {
28 namespace UI {
29 namespace Dialog {
31 enum BehaviorType { FLOATING, DOCK };
33 class Dialog {
34 public:
36     Dialog(const char *prefs_path = NULL, int verb_num = 0, const char *apply_label = NULL);
38     Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path = NULL, 
39            int verb_num = 0, const char *apply_label = NULL);
41     virtual ~Dialog();
43     virtual void onDesktopActivated (SPDesktop*);
44     virtual void onShutdown();
46     virtual void present();
48     /** Hide and show dialogs */
49     virtual void onHideF12();
50     virtual void onShowF12();
52     virtual operator Gtk::Widget&();
53     virtual GtkWidget *gobj();
54     virtual Gtk::VBox *get_vbox();
55     virtual void show();
56     virtual void hide();
57     virtual void show_all_children();
58     virtual void set_resizable(bool);
59     virtual void set_sensitive(bool sensitive=true);
60     virtual void set_default(Gtk::Widget&);
61     virtual void set_size_request(int, int);
62     virtual void size_request(Gtk::Requisition&);
63     virtual void get_position(int& x, int& y);
64     virtual void get_size(int& width, int& height);
65     virtual void resize(int width, int height);
66     virtual void move(int x, int y);
67     virtual void set_position(Gtk::WindowPosition position);
68     virtual void set_title(Glib::ustring title);
70     virtual void set_response_sensitive(int response_id, bool setting);
71     virtual Glib::SignalProxy0<void> signal_show();
72     virtual Glib::SignalProxy0<void> signal_hide();
73     virtual Glib::SignalProxy1<void, int> signal_response();
75     virtual Gtk::Button* add_button (const Glib::ustring& button_text, int response_id);
76     virtual Gtk::Button* add_button (const Gtk::StockID& stock_id, int response_id);
77     
78     virtual void set_default_response(int response_id);
80     bool           _user_hidden; // when it is closed by the user, to prevent repopping on f12
81     bool           _hiddenF12;
83     void           read_geometry();
84     void           save_geometry();
86     bool retransientize_suppress; // when true, do not retransientize (prevents races when switching new windows too fast)
88 protected:
89     const char    *_prefs_path;
90     int            _verb_num;
91     Glib::ustring  _title;
92     const char    *_apply_label;
94     /**
95      * Tooltips object for all descendants to use
96      */
97     Gtk::Tooltips tooltips;
99     virtual void   on_response(int response_id);
100     virtual bool   on_delete_event (GdkEventAny*);
101     virtual void   _apply();
102     virtual void   _close();
104     static bool windowKeyPress(GdkEventKey *event);
106     Inkscape::Selection*   _getSelection();
108     sigc::connection _desktop_activated_connection;
109     sigc::connection _dialogs_hidden_connection;
110     sigc::connection _dialogs_unhidden_connection;
111     sigc::connection _shutdown_connection;
113 private:
114     Behavior::Behavior* _behavior;
116     Dialog(); // no constructor without params
118     Dialog(Dialog const &d);            // no copy
119     Dialog& operator=(Dialog const &d); // no assign
121     friend class Behavior::FloatingBehavior;
122     friend class Behavior::DockBehavior;
123 };
125 } // namespace Dialog
126 } // namespace UI
127 } // namespace Inkscape
129 #endif //INKSCAPE_DIALOG_H
131 /*
132   Local Variables:
133   mode:c++
134   c-file-style:"stroustrup"
135   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
136   indent-tabs-mode:nil
137   fill-column:99
138   End:
139 */
140 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :