Code

moving trunk for module inkscape
[inkscape.git] / src / ui / dialog / dialog-manager.h
1 /**
2  * \brief Object for managing a set of dialogs, including their signals and
3  *        construction/caching/destruction of them.
4  *
5  * Author:
6  *   Bryce W. Harrington <bryce@bryceharrington.org>
7  *   Jon Phillips <jon@rejon.org>
8  *   
9  * Copyright (C) 2004, 2005 Authors
10  * 
11  * Released under GNU GPL.  Read the file 'COPYING' for more information.
12  */
14 #ifndef INKSCAPE_UI_DIALOG_MANAGER_H
15 #define INKSCAPE_UI_DIALOG_MANAGER_H
17 #include <glib/gquark.h>
18 #include "dialog.h"
19 #include <map>
21 namespace Inkscape {
22 namespace UI {
23 namespace Dialog {
25 class DialogManager {
26 public:
27     typedef Dialog *(*DialogFactory)();
29     DialogManager();
30     virtual ~DialogManager();
32     sigc::signal<void> show_dialogs;
33     sigc::signal<void> show_f12;
34     sigc::signal<void> hide_dialogs;
35     sigc::signal<void> hide_f12;
36     sigc::signal<void> transientize;
38     /* generic dialog management start */
39     typedef std::map<GQuark, DialogFactory> FactoryMap;
40     typedef std::map<GQuark, Dialog*> DialogMap;
42     void registerFactory(gchar const *name, DialogFactory factory);
43     void registerFactory(GQuark name, DialogFactory factory);
44     Dialog *getDialog(gchar const* dlgName); 
45     Dialog *getDialog(GQuark dlgName); 
46     void showDialog(gchar const *name);
47     void showDialog(GQuark name);
49 protected:
50     DialogManager(DialogManager const &d); // no copy
51     DialogManager& operator=(DialogManager const &d); // no assign
53     FactoryMap _factory_map; //< factories to create dialogs
54     DialogMap _dialog_map; //< map of already created dialogs
55 };
57 } // namespace Dialog
58 } // namespace UI
59 } // namespace Inkscape
61 #endif //INKSCAPE_UI_DIALOG_MANAGER_H
63 /*
64   Local Variables:
65   mode:c++
66   c-file-style:"stroustrup"
67   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
68   indent-tabs-mode:nil
69   fill-column:99
70   End:
71 */
72 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :