• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libplasma

containment.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2007 by Aaron Seigo <aseigo@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License as
00006  *   published by the Free Software Foundation; either version 2, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #ifndef PLASMA_CONTAINMENT_H
00021 #define PLASMA_CONTAINMENT_H
00022 
00023 #include <QtGui/QGraphicsItem>
00024 #include <QtGui/QWidget>
00025 
00026 #include <kplugininfo.h>
00027 #include <ksharedconfig.h>
00028 #include <kgenericfactory.h>
00029 
00030 #include <plasma/applet.h>
00031 #include <plasma/phase.h>
00032 
00033 #include "widgets/icon.h"
00034 
00035 namespace Plasma
00036 {
00037 
00038 class AppletHandle;
00039 class DataEngine;
00040 class Package;
00041 class Corona;
00042 
00061 class PLASMA_EXPORT Containment : public Applet
00062 {
00063     Q_OBJECT
00064 
00065     public:
00066         typedef QList<Applet*> List;
00067         typedef QHash<QString, Applet*> Dict;
00068 
00069         enum Type { NoContainmentType = -1 ,
00070                     DesktopContainment = 0 ,
00071                     PanelContainment ,
00072                     CustomContainment 
00074                   };
00075 
00083         explicit Containment(QGraphicsItem* parent = 0,
00084                              const QString& serviceId = QString(),
00085                              uint containmentId = 0);
00086 
00097         Containment(QObject* parent, const QVariantList& args);
00098 
00099         ~Containment();
00100 
00104         void init();
00105 
00109         Type containmentType() const;
00110 
00114         void setContainmentType(Containment::Type type);
00115 
00122         FormFactor formFactor() const;
00123 
00129         Location location() const;
00130 
00147         static KPluginInfo::List knownContainments(const QString &category = QString(),
00148                                                    const QString &parentApp = QString());
00149 
00155         static KPluginInfo::List knownContainmentsForMimetype(const QString &mimetype);
00156 
00170         Applet* addApplet(const QString& name, const QVariantList& args = QVariantList(),
00171                           uint id = 0, const QRectF &geometry = QRectF(-1, -1, -1, -1),
00172                           bool delayedInit = false);
00173 
00177         Applet::List applets() const;
00178 
00182         void clearApplets();
00183 
00189         void addApplet(Applet *applet, const QPointF &pos = QPointF(-1, -1), bool dontInit = true);
00190 
00195         virtual int indexAt(const QPointF &pos) const;
00196 
00203         void setScreen(int screen);
00204 
00209         int screen() const;
00210 
00214         void saveConstraints(KConfigGroup* group) const;
00215 
00219         void loadConstraints(KConfigGroup* group);
00220 
00224         void emitLaunchActivated();
00225 
00235         Plasma::Widget * addToolBoxTool(const QString &toolName = QString(), const QString &iconName = QString(), const QString &iconText = QString());
00236 
00243         void enableToolBoxTool(const QString &toolname, bool enable);
00244 
00248         bool isToolboxToolEnabled(const QString &toolname) const;
00249 
00256         void containmentConstraintsUpdated(Plasma::Constraints constraints);
00257 
00261         void showToolbox();
00262 
00266         void hideToolbox();
00267 
00268     Q_SIGNALS:
00272         void appletAdded(Plasma::Applet* applet);
00273 
00277         void appletRemoved(Plasma::Applet* applet);
00278 
00282         void launchActivated();
00283 
00288         void zoomIn();
00289 
00294         void zoomOut();
00295 
00300         void showAddWidgets();
00301 
00302     public Q_SLOTS:
00310         void setLocation(Plasma::Location location);
00311 
00317         void setFormFactor(Plasma::FormFactor formFactor);
00318 
00322         Corona* corona() const;
00323 
00324     protected:
00325         void contextMenuEvent(QGraphicsSceneContextMenuEvent * event);
00326         void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
00327         void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
00328         bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
00329 
00330     protected Q_SLOTS:
00334         void appletDestroyed(QObject*);
00335         void appletAnimationComplete(QGraphicsItem *item, Plasma::Phase::Animation anim);
00336         void dropEvent(QGraphicsSceneDragDropEvent* event);
00337 
00338     private Q_SLOTS:
00339         void handleDisappeared(AppletHandle *handle);
00340         void destroyApplet();
00341 
00342     private:
00343         QRectF geometryForApplet(Applet *applet) const;
00344         bool regionIsEmpty(const QRectF &region, Applet *ignoredApplet=0) const;
00345         void prepareApplet(Applet *applet, bool delayInit);
00346 
00347         Q_DISABLE_COPY(Containment)
00348 
00349         class Private;
00350         Private* const d;
00351 };
00352 
00353 } // Plasma namespace
00354 
00355 
00356 #endif // multiple inclusion guard

libplasma

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

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
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