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

Plasma

containment.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2007 by Aaron Seigo <aseigo@kde.org>
00003  *   Copyright 2008 by Ménard Alexis <darktears31@gmail.com>
00004  *   Copyright (c) 2009 Chani Armitage <chani@kde.org>
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU Library General Public License as
00008  *   published by the Free Software Foundation; either version 2, or
00009  *   (at your option) any later version.
00010  *
00011  *   This program is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details
00015  *
00016  *   You should have received a copy of the GNU Library General Public
00017  *   License along with this program; if not, write to the
00018  *   Free Software Foundation, Inc.,
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020  */
00021 
00022 #ifndef PLASMA_CONTAINMENT_H
00023 #define PLASMA_CONTAINMENT_H
00024 
00025 #include <QtGui/QGraphicsItem>
00026 #include <QtGui/QWidget>
00027 #include <QtGui/QStyleOptionGraphicsItem>
00028 
00029 #include <kplugininfo.h>
00030 #include <ksharedconfig.h>
00031 #include <kgenericfactory.h>
00032 
00033 #include <plasma/applet.h>
00034 #include <plasma/animator.h>
00035 
00036 
00037 namespace Plasma
00038 {
00039 
00040 class AccessAppletJob;
00041 class AppletHandle;
00042 class DataEngine;
00043 class Package;
00044 class Corona;
00045 class View;
00046 class Wallpaper;
00047 class ContainmentActions;
00048 class ContainmentPrivate;
00049 class AbstractToolBox;
00050 
00072 class PLASMA_EXPORT Containment : public Applet
00073 {
00074     Q_OBJECT
00075 
00076     public:
00077         class PLASMA_EXPORT StyleOption : public QStyleOptionGraphicsItem
00078         {
00079             public:
00080                 explicit StyleOption();
00081                 explicit StyleOption(const StyleOption &other);
00082                 explicit StyleOption(const QStyleOptionGraphicsItem &other);
00083 
00084                 enum StyleOptionType {
00085                     Type = SO_CustomBase + 1
00086                 };
00087                 enum StyleOptionVersion {
00088                     Version = QStyleOptionGraphicsItem::Version + 1
00089                 };
00090 
00096                 Plasma::View *view;
00097         };
00098 
00099         enum Type {
00100             NoContainmentType = -1,  
00101             DesktopContainment = 0,  
00102             PanelContainment,        
00103             CustomContainment = 127, 
00105             CustomPanelContainment = 128 
00106         };
00107 
00115         explicit Containment(QGraphicsItem *parent = 0,
00116                              const QString &serviceId = QString(),
00117                              uint containmentId = 0);
00118 
00129         Containment(QObject *parent, const QVariantList &args);
00130 
00131         ~Containment();
00132 
00136         void init();
00137 
00141         Type containmentType() const;
00142 
00146         Corona *corona() const;
00147 
00164         static KPluginInfo::List listContainments(const QString &category = QString(),
00165                                                   const QString &parentApp = QString());
00166 
00186         static KPluginInfo::List listContainmentsOfType(const QString &type,
00187                                                         const QString &category = QString(),
00188                                                         const QString &parentApp = QString());
00189 
00193         static QStringList listContainmentTypes();
00194 
00200         static KPluginInfo::List listContainmentsForMimetype(const QString &mimetype);
00201 
00213         Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
00214                           const QRectF &geometry = QRectF(-1, -1, -1, -1));
00215 
00227         void addApplet(Applet *applet, const QPointF &pos = QPointF(-1, -1), bool dontInit = true);
00228 
00232         Applet::List applets() const;
00233 
00237         void clearApplets();
00238 
00246         void setScreen(int screen, int desktop = -1);
00247 
00252         int screen() const;
00253 
00259         int lastScreen() const;
00260 
00264         int desktop() const;
00265 
00271         int lastDesktop() const;
00272 
00277         void save(KConfigGroup &group) const;
00278 
00283         void restore(KConfigGroup &group);
00284 
00291         void enableAction(const QString &name, bool enable);
00292 
00296         void addToolBoxAction(QAction *action);
00297 
00301         void removeToolBoxAction(QAction *action);
00302 
00308         void setToolBoxOpen(bool open);
00309 
00314         bool isToolBoxOpen() const;
00315 
00319         void openToolBox();
00320 
00324         void closeToolBox();
00325 
00330         void addAssociatedWidget(QWidget *widget);
00331 
00336         void removeAssociatedWidget(QWidget *widget);
00337 
00341         bool drawWallpaper();
00342 
00351         void setWallpaper(const QString &pluginName, const QString &mode = QString());
00352 
00356         Plasma::Wallpaper *wallpaper() const;
00357 
00363         void setActivity(const QString &activity);
00364 
00368         QString activity() const;
00369 
00374         Context* context() const;
00375 
00380         void showContextMenu(const QPointF &containmentPos, const QPoint &screenPos);
00381 
00390         virtual void showDropZone(const QPoint pos);
00391 
00399         void setContainmentActions(const QString &trigger, const QString &pluginName);
00400 
00405         QStringList containmentActionsTriggers();
00406 
00411         QString containmentActions(const QString &trigger);
00412 
00417         KConfigGroup containmentActionsConfig();
00418 
00419 Q_SIGNALS:
00423         void appletAdded(Plasma::Applet *applet, const QPointF &pos);
00424 
00428         void appletRemoved(Plasma::Applet *applet);
00429 
00434         void zoomRequested(Plasma::Containment *containment, Plasma::ZoomDirection direction);
00435 
00439         void toolBoxToggled();
00440 
00445         void toolBoxVisibilityChanged(bool);
00446 
00451         void addSiblingContainment(Plasma::Containment *);
00452 
00460         void showAddWidgetsInterface(const QPointF &pos);
00461 
00470         void screenChanged(int wasScreen, int isScreen, Plasma::Containment *containment);
00471 
00475         void configureRequested(Plasma::Containment *containment);
00476 
00480         void contextChanged(Plasma::Context *context);
00481 
00482     public Q_SLOTS:
00490         void setLocation(Plasma::Location location);
00491 
00497         void setFormFactor(Plasma::FormFactor formFactor);
00498 
00502         void addSiblingContainment();
00503 
00507         void focusNextApplet();
00508 
00512         void focusPreviousApplet();
00513 
00519         void destroy();
00520 
00528         void destroy(bool confirm);
00529 
00534         void showConfigurationInterface();
00535 
00541         void configChanged();
00542 
00543     protected:
00547         void setContainmentType(Containment::Type type);
00548 
00552         void setDrawWallpaper(bool drawWallpaper);
00553 
00560         virtual void saveContents(KConfigGroup &group) const;
00561 
00568         virtual void restoreContents(KConfigGroup &group);
00569 
00570         void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00571         void mousePressEvent(QGraphicsSceneMouseEvent *event);
00572         void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00573         void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
00574         void keyPressEvent(QKeyEvent *event);
00575         void wheelEvent(QGraphicsSceneWheelEvent *event);
00576         bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
00577         QVariant itemChange(GraphicsItemChange change, const QVariant &value);
00578 
00583         void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
00584 
00589         void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
00590 
00595         void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
00596 
00601         void dropEvent(QGraphicsSceneDragDropEvent *event);
00602 
00607         void resizeEvent(QGraphicsSceneResizeEvent *event);
00608 
00612 #ifndef KDE_NO_DEPRECATED
00613         KDE_DEPRECATED const QGraphicsItem *toolBoxItem() const;
00614 #endif
00615 
00624         void setToolBox(AbstractToolBox *toolBox);
00625 
00630         AbstractToolBox *toolBox() const;
00631 
00632     private:
00641         Containment(const QString &packagePath, uint appletId, const QVariantList &args);
00642 
00643         Q_PRIVATE_SLOT(d, void appletDestroyed(Plasma::Applet*))
00644         Q_PRIVATE_SLOT(d, void appletAppearAnimationComplete())
00645         Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
00646         Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
00647         Q_PRIVATE_SLOT(d, void positionToolBox())
00648         Q_PRIVATE_SLOT(d, void requestConfiguration())
00649         Q_PRIVATE_SLOT(d, void updateToolBoxVisibility())
00650         Q_PRIVATE_SLOT(d, void showDropZoneDelayed())
00651         Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
00652         Q_PRIVATE_SLOT(d, void remoteAppletReady(Plasma::AccessAppletJob *))
00653         Q_PRIVATE_SLOT(d, void onContextChanged(Plasma::Context *con))
00657         Q_PRIVATE_SLOT(d, void mimeTypeRetrieved(KIO::Job *, const QString &))
00658         Q_PRIVATE_SLOT(d, void dropJobResult(KJob *))
00659 
00660         friend class Applet;
00661         friend class AppletPrivate;
00662         friend class CoronaPrivate;
00663         friend class ContainmentPrivate;
00664         friend class ContainmentActions;
00665         friend class PopupApplet;
00666         ContainmentPrivate *const d;
00667 };
00668 
00669 } // Plasma namespace
00670 
00671 #endif // multiple inclusion guard

Plasma

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal