summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/dialog-manager.h
blob: 5b22189c9c77449aea01f4e2fc039f50de9f989c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
 * @brief Object for managing a set of dialogs, including their signals and
 *        construction/caching/destruction of them.
 */
/* Author:
 *   Bryce W. Harrington <bryce@bryceharrington.org>
 *   Jon Phillips <jon@rejon.org>
 *
 * Copyright (C) 2004, 2005 Authors
 *
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#ifndef INKSCAPE_UI_DIALOG_MANAGER_H
#define INKSCAPE_UI_DIALOG_MANAGER_H

#include "dialog.h"
#include <map>

namespace Inkscape {
namespace UI {
namespace Dialog {

class DialogManager {
public:
    typedef Dialog *(*DialogFactory)();

    DialogManager();
    virtual ~DialogManager();

    static DialogManager &getInstance();

    // sigc::signal<void> show_dialogs;
    // sigc::signal<void> show_f12;
    // sigc::signal<void> hide_dialogs;
    // sigc::signal<void> hide_f12;
    // sigc::signal<void> transientize;

    /* generic dialog management start */
    typedef std::map<GQuark, DialogFactory> FactoryMap;
    typedef std::map<GQuark, Dialog*> DialogMap;

    void registerFactory(gchar const *name, DialogFactory factory);
    void registerFactory(GQuark name, DialogFactory factory);
    Dialog *getDialog(gchar const* dlgName); 
    Dialog *getDialog(GQuark dlgName); 
    void showDialog(gchar const *name, bool grabfocus=true);
    void showDialog(GQuark name, bool grabfocus=true);

protected:
    DialogManager(DialogManager const &d); // no copy
    DialogManager& operator=(DialogManager const &d); // no assign

    FactoryMap _factory_map; //< factories to create dialogs
    DialogMap _dialog_map; //< map of already created dialogs
};

} // namespace Dialog
} // namespace UI
} // namespace Inkscape

#endif //INKSCAPE_UI_DIALOG_MANAGER_H

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :