1 /**
2 * \brief A floating 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_FLOATING_BEHAVIOR_H
14 #define INKSCAPE_UI_DIALOG_FLOATING_BEHAVIOR_H
16 #include <gtkmm/dialog.h>
17 #include <glibmm/property.h>
18 #include "behavior.h"
20 namespace Inkscape {
21 namespace UI {
22 namespace Dialog {
23 namespace Behavior {
25 class FloatingBehavior : public Behavior {
27 public:
28 static Behavior *create(Dialog &dialog);
30 ~FloatingBehavior();
32 /** Gtk::Dialog methods */
33 operator Gtk::Widget &();
34 GtkWidget *gobj();
35 void present();
36 Gtk::VBox *get_vbox();
37 void show();
38 void hide();
39 void show_all_children();
40 void resize(int width, int height);
41 void move(int x, int y);
42 void set_position(Gtk::WindowPosition);
43 void set_size_request(int width, int height);
44 void size_request(Gtk::Requisition &requisition);
45 void get_position(int &x, int &y);
46 void get_size(int& width, int &height);
47 void set_title(Glib::ustring title);
48 void set_sensitive(bool sensitive);
50 /** Gtk::Dialog signal proxies */
51 Glib::SignalProxy0<void> signal_show();
52 Glib::SignalProxy0<void> signal_hide();
53 Glib::SignalProxy1<bool, GdkEventAny *> signal_delete_event();
55 /** Custom signal handlers */
56 void onHideF12();
57 void onShowF12();
58 void onDesktopActivated(SPDesktop *desktop);
59 void onShutdown();
61 private:
62 FloatingBehavior(Dialog& dialog);
64 Gtk::Dialog *_d; //< the actual dialog
66 #if GTK_VERSION_GE(2, 12)
67 void _focus_event (void);
68 bool _trans_timer (void);
70 Glib::PropertyProxy_ReadOnly<bool> _dialog_active; //< Variable proxy to track whether the dialog is the active window
71 int _steps; //< Number of steps for the timer to animate the transparent dialog
72 float _trans_focus; //< The percentage opacity when the dialog is focused
73 float _trans_blur; //< The percentage opactiy when the dialog is not focused
74 int _trans_time; //< The amount of time (in ms) for the dialog to change it's transparency
75 #endif
77 };
79 } // namespace Behavior
80 } // namespace Dialog
81 } // namespace UI
82 } // namespace Inkscape
84 #endif // INKSCAPE_UI_DIALOG_FLOATING_BEHAVIOR_H
86 /*
87 Local Variables:
88 mode:c++
89 c-file-style:"stroustrup"
90 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
91 indent-tabs-mode:nil
92 fill-column:99
93 End:
94 */
95 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :