~inkscape.dev/inkscape/trunk

« back to all changes in this revision

Viewing changes to src/ui/dialog/dialog.h

  • Committer: gustav_b
  • Date: 2007-08-29 21:27:07 UTC
  • Revision ID: gustav_b@users.sourceforge.net-20070829212707-xvg87a2oqejqioxv
Dockable dialogs patch applied 
(https://sourceforge.net/tracker/?func=detail&atid=604308&aid=1688508&group_id=93438)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * \brief Base class for dialogs in Inkscape.  This class provides certain
3
 
 *        common behaviors and styles wanted of all dialogs in the application.
 
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.
4
5
 *
5
6
 * Author:
6
7
 *   Bryce W. Harrington <bryce@bryceharrington.org>
 
8
 *   Gustav Broberg <broberg@kth.se>
7
9
 *
8
 
 * Copyright (C) 2004, 2005 Authors
 
10
 * Copyright (C) 2004--2007 Authors
9
11
 *
10
12
 * Released under GNU GPL.  Read the file 'COPYING' for more information.
11
13
 */
16
18
#include <gtkmm/dialog.h>
17
19
#include <gtkmm/tooltips.h>
18
20
 
 
21
#include "dock-behavior.h"
 
22
#include "floating-behavior.h"
 
23
 
19
24
namespace Inkscape { class Selection; }
20
25
class SPDesktop;
21
26
 
23
28
namespace UI {
24
29
namespace Dialog {
25
30
 
26
 
class Dialog : public Gtk::Dialog {
 
31
enum BehaviorType { FLOATING, DOCK };
 
32
 
 
33
class Dialog {
27
34
public:
28
 
    Dialog(BaseObjectType *gobj); // fixme: remove this
29
 
 
30
 
    Dialog(const char *prefs_path, int verb_num = 0, const char *apply_label = NULL);
 
35
 
 
36
    Dialog(const char *prefs_path = NULL, int verb_num = 0, const char *apply_label = NULL);
 
37
 
 
38
    Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_path = NULL, 
 
39
           int verb_num = 0, const char *apply_label = NULL);
31
40
 
32
41
    virtual ~Dialog();
33
42
 
37
46
    virtual void present();
38
47
 
39
48
    /** Hide and show dialogs */
40
 
    virtual void   onHideF12();
41
 
    virtual void   onShowF12();
42
 
 
 
49
    virtual void onHideF12();
 
50
    virtual void onShowF12();
 
51
 
 
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);
 
69
 
 
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();
 
74
 
 
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);
 
79
 
 
80
    bool           _user_hidden; // when it is closed by the user, to prevent repopping on f12
43
81
    bool           _hiddenF12;
44
 
    bool           _user_hidden; // when it is closed by the user, to prevent repopping on f12
45
82
 
46
83
    void           read_geometry();
47
84
    void           save_geometry();
48
85
 
49
 
    const char           *_prefs_path;
50
 
 
51
86
    bool retransientize_suppress; // when true, do not retransientize (prevents races when switching new windows too fast)
52
87
 
53
88
protected:
 
89
    const char    *_prefs_path;
 
90
    int            _verb_num;
 
91
    Glib::ustring  _title;
 
92
    const char    *_apply_label;
54
93
 
55
94
    /**
56
95
     * Tooltips object for all descendants to use
62
101
    virtual void   _apply();
63
102
    virtual void   _close();
64
103
 
65
 
    static bool windowKeyPress( GtkWidget *widget, GdkEventKey *event );
 
104
    static bool windowKeyPress(GdkEventKey *event);
66
105
 
67
106
    Inkscape::Selection*   _getSelection();
68
107
 
72
111
    sigc::connection _shutdown_connection;
73
112
 
74
113
private:
 
114
    Behavior::Behavior* _behavior;
 
115
 
75
116
    Dialog(); // no constructor without params
76
117
 
77
118
    Dialog(Dialog const &d);            // no copy
78
119
    Dialog& operator=(Dialog const &d); // no assign
 
120
 
 
121
    friend class Behavior::FloatingBehavior;
 
122
    friend class Behavior::DockBehavior;
79
123
};
80
124
 
81
125
} // namespace Dialog