Plasma
corona.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2007 Aaron Seigo <aseigo@kde.org> 00003 * Copyright 2007 Matt Broadstone <mbroadst@gmail.com> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Library General Public License as 00007 * published by the Free Software Foundation; either version 2, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this program; if not, write to the 00017 * Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef PLASMA_CORONA_H 00022 #define PLASMA_CORONA_H 00023 00024 #include <QtGui/QGraphicsScene> 00025 00026 #include <plasma/applet.h> 00027 #include <plasma/containment.h> 00028 #include <plasma/plasma.h> 00029 #include <plasma/plasma_export.h> 00030 00031 class QGraphicsGridLayout; 00032 class QAction; 00033 00034 class KAction; 00035 00036 namespace Plasma 00037 { 00038 00039 class CoronaPrivate; 00040 class ContainmentActionsPluginsConfig; 00041 class AbstractDialogManager; 00042 00048 class PLASMA_EXPORT Corona : public QGraphicsScene 00049 { 00050 Q_OBJECT 00051 00052 //typedef QHash<QString, QList<Plasma::Applet*> > layouts; 00053 00054 public: 00055 explicit Corona(QObject * parent = 0); 00056 ~Corona(); 00057 00062 void setAppletMimeType(const QString &mimetype); 00063 00067 QString appletMimeType(); 00068 00073 QString defaultContainmentPlugin() const; 00074 00078 QList<Containment*> containments() const; 00079 00083 void clearContainments(); 00084 00088 KSharedConfig::Ptr config() const; 00089 00105 Containment *addContainment(const QString &name, const QVariantList &args = QVariantList()); 00106 00125 Containment *addContainmentDelayed(const QString &name, 00126 const QVariantList &args = QVariantList()); 00127 00135 Containment *containmentForScreen(int screen, int desktop = -1) const; 00136 00149 Containment *containmentForScreen(int screen, int desktop, 00150 const QString &defaultPluginIfNonExistent, 00151 const QVariantList &defaultArgs = QVariantList()); 00158 void addOffscreenWidget(QGraphicsWidget *widget); 00159 00164 void removeOffscreenWidget(QGraphicsWidget *widget); 00165 00170 QList <QGraphicsWidget *> offscreenWidgets() const; 00171 00177 virtual int numScreens() const; 00178 00185 virtual QRect screenGeometry(int id) const; 00186 00195 virtual QRegion availableScreenRegion(int id) const; 00196 00204 QPoint popupPosition(const QGraphicsItem *item, const QSize &size); 00205 00215 QPoint popupPosition(const QGraphicsItem *item, const QSize &size, Qt::AlignmentFlag alignment); 00216 00223 QList<Plasma::Location> freeEdges(int screen) const; 00224 00228 QAction *action(QString name) const; 00229 00233 void addAction(QString name, QAction *action); 00234 00238 QList<QAction*> actions() const; 00239 00246 void enableAction(const QString &name, bool enable); 00247 00254 void updateShortcuts(); 00255 00262 void addShortcuts(KActionCollection *newShortcuts); 00263 00271 KAction* addAction(QString name); 00272 00277 void setContainmentActionsDefaults(Containment::Type containmentType, const ContainmentActionsPluginsConfig &config); 00278 00283 ContainmentActionsPluginsConfig containmentActionsDefaults(Containment::Type containmentType); 00284 00290 void setDialogManager(AbstractDialogManager *manager); 00291 00297 AbstractDialogManager *dialogManager(); 00298 00309 #ifndef KDE_NO_DEPRECATED 00310 KDE_DEPRECATED QList<Plasma::Containment *> importLayout(const KConfigBase &config); 00311 #endif 00312 00320 QString preferredToolBoxPlugin(const Containment::Type type) const; 00321 00331 QList<Plasma::Containment *> importLayout(const KConfigGroup &config); 00332 00340 void exportLayout(KConfigGroup &config, QList<Containment*> containments); 00341 00342 public Q_SLOTS: 00351 void initializeLayout(const QString &config = QString()); 00352 00360 void loadLayout(const QString &config = QString()); 00361 00366 void saveLayout(const QString &config = QString()) const; 00367 00371 ImmutabilityType immutability() const; 00372 00378 void setImmutability(const ImmutabilityType immutable); 00379 00384 void requestConfigSync(); 00385 00393 void requireConfigSync(); 00394 00401 void layoutContainments(); 00402 00403 Q_SIGNALS: 00408 void containmentAdded(Plasma::Containment *containment); 00409 00418 void screenOwnerChanged(int wasScreen, int isScreen, Plasma::Containment *containment); 00419 00426 void releaseVisualFocus(); 00427 00431 void configSynced(); 00432 00436 void availableScreenRegionChanged(); 00437 00444 void immutabilityChanged(Plasma::ImmutabilityType immutability); 00445 00454 void shortcutsChanged(); 00455 00456 protected: 00460 virtual void loadDefaultLayout(); 00461 00469 void mapAnimation(Animator::Animation from, Animator::Animation to); 00470 00478 void mapAnimation(Animator::Animation from, const QString &to); 00479 00486 void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin); 00487 00492 void setDefaultContainmentPlugin(const QString &name); 00493 00494 //Reimplemented from QGraphicsScene 00495 void dragEnterEvent(QGraphicsSceneDragDropEvent *event); 00496 void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); 00497 void dragMoveEvent(QGraphicsSceneDragDropEvent *event); 00498 00499 private: 00500 CoronaPrivate *const d; 00501 00502 Q_PRIVATE_SLOT(d, void containmentDestroyed(QObject*)) 00503 Q_PRIVATE_SLOT(d, void offscreenWidgetDestroyed(QObject *)) 00504 Q_PRIVATE_SLOT(d, void syncConfig()) 00505 Q_PRIVATE_SLOT(d, void toggleImmutability()) 00506 Q_PRIVATE_SLOT(d, void showShortcutConfig()) 00507 00508 friend class CoronaPrivate; 00509 friend class View; 00510 }; 00511 00512 } // namespace Plasma 00513 00514 #endif 00515
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 20:51:35 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 20:51:35 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.