File indexing completed on 2024-05-12 15:59:04

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Cyrille Berger <cberger@cberger.net>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef LIBKIS_DOCKWIDGETFACTORY_H
0008 #define LIBKIS_DOCKWIDGETFACTORY_H
0009 
0010 #include <QString>
0011 #include <KoDockFactoryBase.h>
0012 
0013 #include "kritalibkis_export.h"
0014 
0015 /**
0016  * @brief The DockWidgetFactoryBase class is the base class for plugins that want
0017  * to add a dock widget to every window. You do not need to implement this class
0018  * yourself, but create a DockWidget implementation and then add the DockWidgetFactory
0019  * to the Krita instance like this:
0020  *
0021  * @code
0022  * class HelloDocker(DockWidget):
0023  *   def __init__(self):
0024  *       super().__init__()
0025  *       label = QLabel("Hello", self)
0026  *       self.setWidget(label)
0027  *       self.label = label
0028  *
0029  * def canvasChanged(self, canvas):
0030  *       self.label.setText("Hellodocker: canvas changed");
0031  *
0032  * Application.addDockWidgetFactory(DockWidgetFactory("hello", DockWidgetFactoryBase.DockRight, HelloDocker))
0033  *
0034  * @endcode
0035  */
0036 class KRITALIBKIS_EXPORT DockWidgetFactoryBase : public KoDockFactoryBase
0037 {
0038 public:
0039     DockWidgetFactoryBase(const QString& _id, DockPosition _dockPosition);
0040     ~DockWidgetFactoryBase() override;
0041     QString id() const override;
0042     DockPosition defaultDockPosition() const override;
0043 private:
0044     QString m_id;
0045     DockPosition m_dockPosition;
0046 };
0047 
0048 #endif