• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • sources
  • kde-4.12
  • kdelibs
  • plasma
containment.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007 by Aaron Seigo <aseigo@kde.org>
3  * Copyright 2008 by Ménard Alexis <darktears31@gmail.com>
4  * Copyright (c) 2009 Chani Armitage <chani@kde.org>
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 <QtGui/QGraphicsItem>
26 #include <QtGui/QWidget>
27 #include <QtGui/QStyleOptionGraphicsItem>
28 
29 #include <kplugininfo.h>
30 #include <ksharedconfig.h>
31 #include <kgenericfactory.h>
32 
33 #include <plasma/applet.h>
34 #include <plasma/animator.h>
35 
36 
37 namespace Plasma
38 {
39 
40 class AccessAppletJob;
41 class AppletHandle;
42 class DataEngine;
43 class Package;
44 class Corona;
45 class View;
46 class Wallpaper;
47 class ContainmentActions;
48 class ContainmentPrivate;
49 class AbstractToolBox;
50 
72 class PLASMA_EXPORT Containment : public Applet
73 {
74  Q_OBJECT
75 
76  public:
77  class PLASMA_EXPORT StyleOption : public QStyleOptionGraphicsItem
78  {
79  public:
80  explicit StyleOption();
81  explicit StyleOption(const StyleOption &other);
82  explicit StyleOption(const QStyleOptionGraphicsItem &other);
83 
84  enum StyleOptionType {
85  Type = SO_CustomBase + 1
86  };
87  enum StyleOptionVersion {
88  Version = QStyleOptionGraphicsItem::Version + 1
89  };
90 
96  Plasma::View *view;
97  };
98 
99  enum Type {
100  NoContainmentType = -1,
101  DesktopContainment = 0,
102  PanelContainment,
103  CustomContainment = 127,
105  CustomPanelContainment = 128
106  };
107 
115  explicit Containment(QGraphicsItem *parent = 0,
116  const QString &serviceId = QString(),
117  uint containmentId = 0);
118 
129  Containment(QObject *parent, const QVariantList &args);
130 
131  ~Containment();
132 
136  void init();
137 
141  Type containmentType() const;
142 
146  Corona *corona() const;
147 
164  static KPluginInfo::List listContainments(const QString &category = QString(),
165  const QString &parentApp = QString());
166 
186  static KPluginInfo::List listContainmentsOfType(const QString &type,
187  const QString &category = QString(),
188  const QString &parentApp = QString());
189 
193  static QStringList listContainmentTypes();
194 
200  static KPluginInfo::List listContainmentsForMimetype(const QString &mimetype);
201 
213  Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
214  const QRectF &geometry = QRectF(-1, -1, -1, -1));
215 
227  void addApplet(Applet *applet, const QPointF &pos = QPointF(-1, -1), bool dontInit = true);
228 
232  Applet::List applets() const;
233 
237  void clearApplets();
238 
246  void setScreen(int screen, int desktop = -1);
247 
252  int screen() const;
253 
259  int lastScreen() const;
260 
264  int desktop() const;
265 
271  int lastDesktop() const;
272 
277  void save(KConfigGroup &group) const;
278 
283  void restore(KConfigGroup &group);
284 
291  void enableAction(const QString &name, bool enable);
292 
296  void addToolBoxAction(QAction *action);
297 
301  void removeToolBoxAction(QAction *action);
302 
308  void setToolBoxOpen(bool open);
309 
314  bool isToolBoxOpen() const;
315 
319  void openToolBox();
320 
324  void closeToolBox();
325 
330  void addAssociatedWidget(QWidget *widget);
331 
336  void removeAssociatedWidget(QWidget *widget);
337 
341  bool drawWallpaper();
342 
351  void setWallpaper(const QString &pluginName, const QString &mode = QString());
352 
356  Plasma::Wallpaper *wallpaper() const;
357 
363  void setActivity(const QString &activity);
364 
368  QString activity() const;
369 
374  Context* context() const;
375 
380  void showContextMenu(const QPointF &containmentPos, const QPoint &screenPos);
381 
390  virtual void showDropZone(const QPoint pos);
391 
399  void setContainmentActions(const QString &trigger, const QString &pluginName);
400 
405  QStringList containmentActionsTriggers();
406 
411  QString containmentActions(const QString &trigger);
412 
417  KConfigGroup containmentActionsConfig();
418 
419 Q_SIGNALS:
423  void appletAdded(Plasma::Applet *applet, const QPointF &pos);
424 
428  void appletRemoved(Plasma::Applet *applet);
429 
434  void zoomRequested(Plasma::Containment *containment, Plasma::ZoomDirection direction);
435 
439  void toolBoxToggled();
440 
445  void toolBoxVisibilityChanged(bool);
446 
451  void addSiblingContainment(Plasma::Containment *);
452 
460  void showAddWidgetsInterface(const QPointF &pos);
461 
470  void screenChanged(int wasScreen, int isScreen, Plasma::Containment *containment);
471 
475  void configureRequested(Plasma::Containment *containment);
476 
480  void contextChanged(Plasma::Context *context);
481 
482  public Q_SLOTS:
490  void setLocation(Plasma::Location location);
491 
497  void setFormFactor(Plasma::FormFactor formFactor);
498 
502  void addSiblingContainment();
503 
507  void focusNextApplet();
508 
512  void focusPreviousApplet();
513 
519  void destroy();
520 
528  void destroy(bool confirm);
529 
534  void showConfigurationInterface();
535 
541  void configChanged();
542 
543  protected:
544  //FIXME plasma2: those should be public to allow scripted containments access them
548  void setContainmentType(Containment::Type type);
549 
553  void setDrawWallpaper(bool drawWallpaper);
554 
561  virtual void saveContents(KConfigGroup &group) const;
562 
569  virtual void restoreContents(KConfigGroup &group);
570 
571  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
572  void mousePressEvent(QGraphicsSceneMouseEvent *event);
573  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
574  void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
575  void keyPressEvent(QKeyEvent *event);
576  void wheelEvent(QGraphicsSceneWheelEvent *event);
577  bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
578  QVariant itemChange(GraphicsItemChange change, const QVariant &value);
579 
584  void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
585 
590  void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
591 
596  void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
597 
602  void dropEvent(QGraphicsSceneDragDropEvent *event);
603 
608  void resizeEvent(QGraphicsSceneResizeEvent *event);
609 
613 #ifndef KDE_NO_DEPRECATED
614  KDE_DEPRECATED const QGraphicsItem *toolBoxItem() const;
615 #endif
616 
625  void setToolBox(AbstractToolBox *toolBox);
626 
631  AbstractToolBox *toolBox() const;
632 
633  private:
642  Containment(const QString &packagePath, uint appletId, const QVariantList &args);
643 
644  Q_PRIVATE_SLOT(d, void appletDestroyed(Plasma::Applet*))
645  Q_PRIVATE_SLOT(d, void appletAppearAnimationComplete())
646  Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
647  Q_PRIVATE_SLOT(d, void positionToolBox())
648  Q_PRIVATE_SLOT(d, void requestConfiguration())
649  Q_PRIVATE_SLOT(d, void updateToolBoxVisibility())
650  Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
651  Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
652  Q_PRIVATE_SLOT(d, void remoteAppletReady(Plasma::AccessAppletJob *))
653  Q_PRIVATE_SLOT(d, void onContextChanged(Plasma::Context *con))
657  Q_PRIVATE_SLOT(d, void mimeTypeRetrieved(KIO::Job *, const QString &))
658  Q_PRIVATE_SLOT(d, void dropJobResult(KJob *))
659 
660  friend class Applet;
661  friend class AppletPrivate;
662  friend class AppletScript;
663  friend class CoronaPrivate;
664  friend class ContainmentPrivate;
665  friend class ContainmentActions;
666  friend class PopupApplet;
667  friend class View;
668  ContainmentPrivate *const d;
669 };
670 
671 } // Plasma namespace
672 
673 #endif // multiple inclusion guard
Plasma::ContainmentActions
The base ContainmentActions class.
Definition: containmentactions.h:55
Plasma::Containment::StyleOption::StyleOptionType
StyleOptionType
Definition: containment.h:84
QWidget
Plasma::Containment::PanelContainment
A desktop panel.
Definition: containment.h:102
Plasma::Context
Definition: context.h:33
QObject
Plasma::Containment::StyleOption::view
Plasma::View * view
The View, if any, that this containment is currently being rendered into.
Definition: containment.h:96
Plasma::Containment::StyleOption
Definition: containment.h:77
Plasma::Applet
The base Applet class.
Definition: applet.h:77
Plasma::ZoomDirection
ZoomDirection
The direction of a zoom action.
Definition: plasma.h:99
Plasma::View
A QGraphicsView for a single Containment.
Definition: view.h:47
Plasma::Location
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition: plasma.h:108
Plasma::PopupApplet
Allows applets to automatically 'collapse' into an icon when put in an panel, and is a convenient bas...
Definition: popupapplet.h:52
applet.h
Plasma::AccessAppletJob
This class is used for asynchronously accessing an applet published on a remote system.
Definition: accessappletjob.h:42
Plasma::FormFactor
FormFactor
The FormFactor enumeration describes how a Plasma::Applet should arrange itself.
Definition: plasma.h:64
Plasma::AppletScript
Provides a restricted interface for scripted applets.
Definition: appletscript.h:51
Plasma::AbstractToolBox
Definition: abstracttoolbox.h:40
Plasma::Containment::StyleOption::StyleOptionVersion
StyleOptionVersion
Definition: containment.h:87
Plasma::Applet::List
QList< Applet * > List
Definition: applet.h:97
Plasma::type
static QScriptValue type(QScriptContext *ctx, QScriptEngine *eng)
Definition: easingcurve.cpp:63
Plasma::Containment
The base class for plugins that provide backgrounds and applet grouping containers.
Definition: containment.h:72
Plasma::ItemStatus
ItemStatus
Status of an applet.
Definition: plasma.h:256
animator.h
Plasma::Containment::Type
Type
Definition: containment.h:99
QStyleOptionGraphicsItem
KJob
Plasma::Wallpaper
The base Wallpaper class.
Definition: wallpaper.h:56
Plasma::Corona
A QGraphicsScene for Plasma::Applets.
Definition: corona.h:48
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal