Plasma

containment.h
1 /*
2  * Copyright 2007 by Aaron Seigo <[email protected]>
3  * Copyright 2008 by Ménard Alexis <[email protected]>
4  * Copyright (c) 2009 Chani Armitage <[email protected]>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Library General Public License as
8  * published by the Free Software Foundation; either version 2, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef PLASMA_CONTAINMENT_H
23 #define PLASMA_CONTAINMENT_H
24 
25 #include <KSharedConfig>
26 #include <plasma/applet.h>
27 
28 namespace Plasma
29 {
30 
31 class DataEngine;
32 class Package;
33 class Corona;
34 class ContainmentActions;
35 class ContainmentPrivate;
36 
58 class PLASMA_EXPORT Containment : public Applet
59 {
60  Q_OBJECT
61  Q_PROPERTY(QString wallpaper READ wallpaper WRITE setWallpaper NOTIFY wallpaperChanged)
62  Q_PROPERTY(bool isUiReady READ isUiReady NOTIFY uiReadyChanged)
63 
64 public:
72  explicit Containment(QObject *parent = nullptr,
73  const QString &serviceId = QString(),
74  uint containmentId = 0);
75 
86  Containment(QObject *parent, const QVariantList &args);
87 
88  ~Containment() override;
89 
93  void init() override;
94 
98  Plasma::Types::ContainmentType containmentType() const;
99 
103  Corona *corona() const;
104 
116  Applet *createApplet(const QString &name, const QVariantList &args = QVariantList());
117 
124  void addApplet(Applet *applet);
125 
129  QList<Applet *> applets() const;
130 
135  int screen() const;
136 
142  int lastScreen() const;
143 
148  void save(KConfigGroup &group) const override;
149 
154  void restore(KConfigGroup &group) override;
155 
161  void setWallpaper(const QString &pluginName);
162 
166  QString wallpaper() const;
167 
173  void setActivity(const QString &activityId);
174 
178  QString activity() const;
179 
187  void setContainmentActions(const QString &trigger, const QString &pluginName);
188 
193  QHash<QString, ContainmentActions *> &containmentActions();
194 
198  bool isUiReady() const;
199 
200 Q_SIGNALS:
208  void appletAdded(Plasma::Applet *applet);
209 
213  void appletRemoved(Plasma::Applet *applet);
214 
223  void appletCreated(Plasma::Applet *applet);
224 
228  void activityChanged(const QString &activity);
229 
237  void showAddWidgetsInterface(const QPointF &pos);
238 
245  void screenChanged(int newScreen);
246 
250  void configureRequested(Plasma::Applet *applet);
251 
255  void appletAlternativesRequested(Plasma::Applet *applet);
256 
260  void wallpaperChanged();
261 
266  void locationChanged(Plasma::Types::Location location);
267 
272  void formFactorChanged(Plasma::Types::FormFactor formFactor);
273 
278  void uiReadyChanged(bool uiReady);
279 
283  void containmentTypeChanged();
284 
285 public Q_SLOTS:
293  void setLocation(Plasma::Types::Location location);
294 
300  void setFormFactor(Plasma::Types::FormFactor formFactor);
301 
305  void setContainmentType(Plasma::Types::ContainmentType type);
306 
307  void reactToScreenChange();
308 
309 protected:
316  virtual void saveContents(KConfigGroup &group) const;
317 
324  virtual void restoreContents(KConfigGroup &group);
325 
326 private:
333  Containment(const KPluginMetaData &md, uint appletId);
334 
335  Q_PRIVATE_SLOT(d, void appletDeleted(Plasma::Applet *))
336  Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
337  Q_PRIVATE_SLOT(d, void checkStatus(Plasma::Types::ItemStatus))
338 
339  friend class Applet;
340  friend class AppletPrivate;
341  friend class CoronaPrivate;
342  friend class ContainmentPrivate;
343  friend class ContainmentActions;
344  ContainmentPrivate *const d;
345 };
346 
347 } // Plasma namespace
348 
349 #endif // multiple inclusion guard
The base ContainmentActions class.
ItemStatus
Status of an applet.
Definition: plasma.h:251
Namespace for everything in libplasma.
Definition: datamodel.cpp:27
The base Applet class.
Definition: applet.h:67
ContainmentType
This enumeration describes the type of the Containment.
Definition: plasma.h:97
QCA_EXPORT void init()
The base class for plugins that provide backgrounds and applet grouping containers.
Definition: containment.h:58
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition: plasma.h:139
FormFactor
The FormFactor enumeration describes how a Plasma::Applet should arrange itself.
Definition: plasma.h:72
A bookkeeping Scene for Plasma::Applets.
Definition: corona.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jul 9 2020 22:40:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.