aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scxmleditor/plugin_interface/scxmluifactory.h
blob: b5369c391a0f1d3133bf09af13371729f27195b3 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include "mytypes.h"

#include <QObject>

namespace ScxmlEditor {

namespace PluginInterface {

class ISCEditor;
class ScxmlDocument;

class ScxmlUiFactory : public QObject
{
    Q_OBJECT

public:
    ScxmlUiFactory(QObject *parent = nullptr);
    ~ScxmlUiFactory() override;

    // Inform document changes
    void documentChanged(DocumentChangeType type, ScxmlDocument *doc);

    // Inform plugins to refresh
    void refresh();

    // Get registered objects
    QObject *object(const QString &type) const;

    // Register objects
    void unregisterObject(const QString &type, QObject *object);
    void registerObject(const QString &type, QObject *object);

    // Check is active
    bool isActive(const QString &type, const QObject *object) const;

private:
    void initPlugins();

    QVector<ISCEditor*> m_plugins;
    QMap<QString, QObject*> m_objects;
};

} // namespace PluginInterface
} // namespace ScxmlEditor