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 static DialogManager &getInstance();
34 sigc::signal<void> show_dialogs;
35 sigc::signal<void> show_f12;
36 sigc::signal<void> hide_dialogs;
37 sigc::signal<void> hide_f12;
38 sigc::signal<void> transientize;
40 /* generic dialog management start */
41 typedef std::map<GQuark, DialogFactory> FactoryMap;
42 typedef std::map<GQuark, Dialog*> DialogMap;
44 void registerFactory(gchar const *name, DialogFactory factory);
45 void registerFactory(GQuark name, DialogFactory factory);
46 Dialog *getDialog(gchar const* dlgName);
47 Dialog *getDialog(GQuark dlgName);
48 void showDialog(gchar const *name);
49 void showDialog(GQuark name);
51 protected:
52 DialogManager(DialogManager const &d); // no copy
53 DialogManager& operator=(DialogManager const &d); // no assign
55 FactoryMap _factory_map; //< factories to create dialogs
56 DialogMap _dialog_map; //< map of already created dialogs
57 };
59 } // namespace Dialog
60 } // namespace UI
61 } // namespace Inkscape
63 #endif //INKSCAPE_UI_DIALOG_MANAGER_H
65 /*
66 Local Variables:
67 mode:c++
68 c-file-style:"stroustrup"
69 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
70 indent-tabs-mode:nil
71 fill-column:99
72 End:
73 */
74 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :