File indexing completed on 2024-05-12 05:38:24

0001 /*
0002     SPDX-FileCopyrightText: 2009 Aaron Seigo <aseigo@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QJSValue>
0010 #include <QWeakPointer>
0011 
0012 #include "applet.h"
0013 
0014 namespace Plasma
0015 {
0016 class Containment;
0017 } // namespace Plasma
0018 
0019 class ShellCorona;
0020 
0021 namespace WorkspaceScripting
0022 {
0023 class ScriptEngine;
0024 
0025 class Containment : public Applet
0026 {
0027     Q_OBJECT
0028     /// FIXME: add NOTIFY
0029     Q_PROPERTY(QString version READ version)
0030     Q_PROPERTY(QStringList configKeys READ configKeys)
0031     Q_PROPERTY(QStringList configGroups READ configGroups)
0032     Q_PROPERTY(QStringList globalConfigKeys READ globalConfigKeys)
0033     Q_PROPERTY(QStringList globalConfigGroups READ globalConfigGroups)
0034     Q_PROPERTY(QStringList currentConfigGroup WRITE setCurrentConfigGroup READ currentConfigGroup)
0035     Q_PROPERTY(QString wallpaperPlugin READ wallpaperPlugin WRITE setWallpaperPlugin)
0036     Q_PROPERTY(QString wallpaperMode READ wallpaperMode WRITE setWallpaperMode)
0037     Q_PROPERTY(bool locked READ locked WRITE setLocked)
0038     Q_PROPERTY(QString type READ type)
0039     Q_PROPERTY(QString formFactor READ formFactor)
0040     Q_PROPERTY(QList<int> widgetIds READ widgetIds)
0041     Q_PROPERTY(int screen READ screen)
0042     Q_PROPERTY(int id READ id)
0043 
0044 public:
0045     explicit Containment(Plasma::Containment *containment, ScriptEngine *parent);
0046     ~Containment() override;
0047 
0048     uint id() const;
0049     QString type() const;
0050     QString formFactor() const;
0051     QList<int> widgetIds() const;
0052 
0053     int screen() const;
0054 
0055     Plasma::Applet *applet() const override;
0056     Plasma::Containment *containment() const;
0057 
0058     QString wallpaperPlugin() const;
0059     void setWallpaperPlugin(const QString &wallpaperPlugin);
0060     QString wallpaperMode() const;
0061     void setWallpaperMode(const QString &wallpaperMode);
0062 
0063     Q_INVOKABLE QJSValue widgetById(const QJSValue &paramId = QJSValue()) const;
0064     Q_INVOKABLE QJSValue
0065     addWidget(const QJSValue &v = QJSValue(), qreal x = -1, qreal y = -1, qreal w = -1, qreal h = -1, const QVariantList &args = QVariantList());
0066     Q_INVOKABLE QJSValue widgets(const QString &widgetType = QString()) const;
0067 
0068 public Q_SLOTS:
0069     void remove();
0070     void showConfigurationInterface();
0071 
0072 protected:
0073     ShellCorona *corona() const;
0074 
0075 private:
0076     class Private;
0077     Private *const d;
0078 };
0079 
0080 }