File indexing completed on 2024-05-12 16:01:43

0001 /*
0002  *  SPDX-FileCopyrightText: 2013 Sven Langkamp <sven.langkamp@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 
0008 #ifndef KIS_VIEW_PLUGIN_H
0009 #define KIS_VIEW_PLUGIN_H
0010 
0011 #include <kritaui_export.h>
0012 #include <QObject>
0013 #include <QPointer>
0014 
0015 class KisOperation;
0016 class KisOperationUIFactory;
0017 class KisAction;
0018 class KisViewManager;
0019 
0020 /**
0021  *  KisActionPlugin is the base for plugins which add actions to the main window
0022  */
0023 class KRITAUI_EXPORT KisActionPlugin : public QObject
0024 {
0025     Q_OBJECT
0026 public:
0027     KisActionPlugin(QObject *parent = 0);
0028     ~KisActionPlugin() override;
0029 
0030 protected:
0031 
0032    /**
0033     *  Registers a KisAction to the UI and action manager.
0034     *  @param name - title of the action in the krita5.xmlgui file
0035     *  @param action the action that should be added
0036     */
0037     void addAction(const QString& name, KisAction *action);
0038 
0039     KisAction *createAction(const QString &name);
0040 
0041     void addUIFactory(KisOperationUIFactory *factory);
0042 
0043     void addOperation(KisOperation *operation);
0044 
0045     QPointer<KisViewManager> viewManager() const;
0046 
0047 private:
0048     QPointer<KisViewManager> m_viewManager;
0049 };
0050 
0051 #endif // KIS_VIEW_PLUGIN_H