File indexing completed on 2024-07-14 15:45:22

0001 /*
0002  *  Copyright 2012 Marco Martin <mart@kde.org>
0003  *
0004  *  This program is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation; either version 2 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program; if not, write to the Free Software
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0017  */
0018 
0019 #ifndef PLASMAQUICKCONTAINMENTVIEW_H
0020 #define PLASMAQUICKCONTAINMENTVIEW_H
0021 
0022 #include <kquickaddons/quickviewsharedengine.h>
0023 
0024 #include "plasma/corona.h"
0025 #include "plasma/containment.h"
0026 
0027 //
0028 //  W A R N I N G
0029 //  -------------
0030 //
0031 // This file is not part of the public Plasma API.  It exists purely as an
0032 // implementation detail.  This header file may change from version to
0033 // version without notice, or even be removed.
0034 //
0035 // We mean it.
0036 //
0037 
0038 namespace PlasmaQuick {
0039 
0040 class ContainmentViewPrivate;
0041 
0042 class ContainmentView : public KQuickAddons::QuickViewSharedEngine
0043 {
0044     Q_OBJECT
0045     Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged)
0046     Q_PROPERTY(Plasma::Types::FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
0047     Q_PROPERTY(QRectF screenGeometry READ screenGeometry NOTIFY screenGeometryChanged)
0048 
0049 public:
0050     /**
0051      * @param corona the corona of this view
0052      * @param parent the QWindow this ContainmentView is parented to
0053      **/
0054     explicit ContainmentView(Plasma::Corona *corona, QWindow *parent = 0);
0055     ~ContainmentView() override;
0056 
0057     /**
0058      * @return the corona of this view
0059      **/
0060     Plasma::Corona *corona() const;
0061 
0062     /**
0063      * @return the KConfigGroup of this view
0064      **/
0065     virtual KConfigGroup config() const;
0066 
0067     /**
0068      * sets the containment for this view
0069      * @param cont the containment of this view
0070      **/
0071     void setContainment(Plasma::Containment *cont);
0072 
0073     /**
0074      * @return the containment of this ContainmentView
0075      **/
0076     Plasma::Containment *containment() const;
0077 
0078     /**
0079      * @return the location of this ContainmentView
0080      **/
0081     Plasma::Types::Location location() const;
0082 
0083     /**
0084      * Sets the location of the ContainmentView
0085      * @param location the location of the ContainmentView
0086      **/
0087     void setLocation(Plasma::Types::Location location);
0088 
0089     /**
0090      * @return the formfactor of the ContainmentView
0091      **/
0092     Plasma::Types::FormFactor formFactor() const;
0093 
0094     /**
0095      * @return the screenGeometry of the ContainmentView
0096      **/
0097     QRectF screenGeometry();
0098 
0099 protected Q_SLOTS:
0100     /**
0101      * It will be called when the configuration is requested
0102      */
0103     virtual void showConfigurationInterface(Plasma::Applet *applet);
0104 
0105 Q_SIGNALS:
0106     /**
0107      * emitted when the location is changed
0108      **/
0109     void locationChanged(Plasma::Types::Location location);
0110 
0111     /**
0112      * emitted when the formfactor is changed
0113      **/
0114     void formFactorChanged(Plasma::Types::FormFactor formFactor);
0115 
0116     /**
0117      * emitted when the containment is changed
0118      **/
0119     void containmentChanged();
0120 
0121     /**
0122      * emitted when the screenGeometry is changed
0123      **/
0124     void screenGeometryChanged();
0125 
0126 private:
0127     ContainmentViewPrivate *const d;
0128     Q_PRIVATE_SLOT(d, void updateDestroyed(bool))
0129     friend class ContainmentViewPrivate;
0130 };
0131 
0132 }
0133 
0134 #endif // CONTAINMENTVIEW_H