File indexing completed on 2024-06-09 05:27:26

0001 /*
0002     SPDX-FileCopyrightText: 2012 Marco Martin <mart@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef PLASMAQUICKCONTAINMENTVIEW_H
0008 #define PLASMAQUICKCONTAINMENTVIEW_H
0009 
0010 #include <kquickaddons/quickviewsharedengine.h>
0011 
0012 #include "plasma/corona.h"
0013 #include "plasma/containment.h"
0014 
0015 //
0016 //  W A R N I N G
0017 //  -------------
0018 //
0019 // This file is not part of the public Plasma API.  It exists purely as an
0020 // implementation detail.  This header file may change from version to
0021 // version without notice, or even be removed.
0022 //
0023 // We mean it.
0024 //
0025 
0026 namespace PlasmaQuick {
0027 
0028 class ContainmentViewPrivate;
0029 
0030 class ContainmentView : public KQuickAddons::QuickViewSharedEngine
0031 {
0032     Q_OBJECT
0033     Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged)
0034     Q_PROPERTY(Plasma::Types::FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
0035     Q_PROPERTY(QRectF screenGeometry READ screenGeometry NOTIFY screenGeometryChanged)
0036 
0037 public:
0038     /**
0039      * @param corona the corona of this view
0040      * @param parent the QWindow this ContainmentView is parented to
0041      **/
0042     explicit ContainmentView(Plasma::Corona *corona, QWindow *parent = 0);
0043     ~ContainmentView() override;
0044 
0045     /**
0046      * @return the corona of this view
0047      **/
0048     Plasma::Corona *corona() const;
0049 
0050     /**
0051      * @return the KConfigGroup of this view
0052      **/
0053     virtual KConfigGroup config() const;
0054 
0055     /**
0056      * sets the containment for this view
0057      * @param cont the containment of this view
0058      **/
0059     void setContainment(Plasma::Containment *cont);
0060 
0061     /**
0062      * @return the containment of this ContainmentView
0063      **/
0064     Plasma::Containment *containment() const;
0065 
0066     /**
0067      * @return the location of this ContainmentView
0068      **/
0069     Plasma::Types::Location location() const;
0070 
0071     /**
0072      * Sets the location of the ContainmentView
0073      * @param location the location of the ContainmentView
0074      **/
0075     void setLocation(Plasma::Types::Location location);
0076 
0077     /**
0078      * @return the formfactor of the ContainmentView
0079      **/
0080     Plasma::Types::FormFactor formFactor() const;
0081 
0082     /**
0083      * @return the screenGeometry of the ContainmentView
0084      **/
0085     QRectF screenGeometry();
0086 
0087 protected Q_SLOTS:
0088     /**
0089      * It will be called when the configuration is requested
0090      */
0091     virtual void showConfigurationInterface(Plasma::Applet *applet);
0092 
0093 Q_SIGNALS:
0094     /**
0095      * emitted when the location is changed
0096      **/
0097     void locationChanged(Plasma::Types::Location location);
0098 
0099     /**
0100      * emitted when the formfactor is changed
0101      **/
0102     void formFactorChanged(Plasma::Types::FormFactor formFactor);
0103 
0104     /**
0105      * emitted when the containment is changed
0106      **/
0107     void containmentChanged();
0108 
0109     /**
0110      * emitted when the screenGeometry is changed
0111      **/
0112     void screenGeometryChanged();
0113 
0114 private:
0115     ContainmentViewPrivate *const d;
0116     Q_PRIVATE_SLOT(d, void updateDestroyed(bool))
0117     friend class ContainmentViewPrivate;
0118 };
0119 
0120 }
0121 
0122 #endif // CONTAINMENTVIEW_H