File indexing completed on 2024-05-12 17:10:23

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 "containment.h"
0013 
0014 class PanelView;
0015 class ShellCorona;
0016 
0017 namespace WorkspaceScripting
0018 {
0019 class Panel : public Containment
0020 {
0021     Q_OBJECT
0022     Q_PROPERTY(QStringList configKeys READ configKeys)
0023     Q_PROPERTY(QStringList configGroups READ configGroups)
0024     Q_PROPERTY(QStringList currentConfigGroup WRITE setCurrentConfigGroup READ currentConfigGroup)
0025     Q_PROPERTY(QStringList globalConfigKeys READ globalConfigKeys)
0026     Q_PROPERTY(QStringList globalConfigGroups READ globalConfigGroups)
0027 
0028     Q_PROPERTY(QString version READ version)
0029     Q_PROPERTY(QString type READ type)
0030     Q_PROPERTY(QString formFactor READ formFactor)
0031     Q_PROPERTY(QList<int> widgetIds READ widgetIds)
0032     Q_PROPERTY(int screen READ screen)
0033     Q_PROPERTY(QString location READ location WRITE setLocation)
0034     Q_PROPERTY(int id READ id)
0035 
0036     Q_PROPERTY(bool locked READ locked WRITE setLocked)
0037 
0038     // panel properties
0039     Q_PROPERTY(QString alignment READ alignment WRITE setAlignment)
0040     Q_PROPERTY(int offset READ offset WRITE setOffset)
0041     Q_PROPERTY(int length READ length WRITE setLength)
0042     Q_PROPERTY(int minimumLength READ minimumLength WRITE setMinimumLength)
0043     Q_PROPERTY(int maximumLength READ maximumLength WRITE setMaximumLength)
0044     Q_PROPERTY(int height READ height WRITE setHeight)
0045     Q_PROPERTY(QString hiding READ hiding WRITE setHiding)
0046 
0047 public:
0048     explicit Panel(Plasma::Containment *containment, ScriptEngine *parent);
0049     ~Panel() override;
0050 
0051     QString location() const;
0052     void setLocation(const QString &location);
0053 
0054     QString alignment() const;
0055     void setAlignment(const QString &alignment);
0056 
0057     int offset() const;
0058     void setOffset(int pixels);
0059 
0060     int length() const;
0061     void setLength(int pixels);
0062 
0063     int minimumLength() const;
0064     void setMinimumLength(int pixels);
0065 
0066     int maximumLength() const;
0067     void setMaximumLength(int pixels);
0068 
0069     int height() const;
0070     void setHeight(int height);
0071 
0072     QString hiding() const;
0073     void setHiding(const QString &mode);
0074 
0075 public Q_SLOTS:
0076     void remove()
0077     {
0078         Containment::remove();
0079     }
0080     void showConfigurationInterface()
0081     {
0082         Containment::showConfigurationInterface();
0083     }
0084 
0085 private:
0086     PanelView *panel() const;
0087     KConfigGroup panelConfig() const;
0088     KConfigGroup panelConfigDefaults() const;
0089 
0090     ShellCorona *m_corona;
0091 };
0092 
0093 }