Plasma
corona.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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/plasma.h>
00028 #include <plasma/plasma_export.h>
00029
00030 class QGraphicsGridLayout;
00031 class QAction;
00032
00033 class KAction;
00034
00035 namespace Plasma
00036 {
00037
00038 class Containment;
00039 class CoronaPrivate;
00040
00046 class PLASMA_EXPORT Corona : public QGraphicsScene
00047 {
00048 Q_OBJECT
00049
00050
00051
00052 public:
00053 explicit Corona(QObject * parent = 0);
00054 ~Corona();
00055
00060 void setAppletMimeType(const QString &mimetype);
00061
00065 QString appletMimeType();
00066
00070 QList<Containment*> containments() const;
00071
00075 void clearContainments();
00076
00080 KSharedConfig::Ptr config() const;
00081
00094 Containment *addContainment(const QString &name, const QVariantList &args = QVariantList());
00095
00103 Containment *containmentForScreen(int screen, int desktop = -1) const;
00104
00111 void addOffscreenWidget(QGraphicsWidget *widget);
00112
00117 void removeOffscreenWidget(QGraphicsWidget *widget);
00118
00123 QList <QGraphicsWidget *> offscreenWidgets() const;
00124
00130 virtual int numScreens() const;
00131
00138 virtual QRect screenGeometry(int id) const;
00139
00148 virtual QRegion availableScreenRegion(int id) const;
00149
00157 QPoint popupPosition(const QGraphicsItem *item, const QSize &size);
00158
00165 QList<Plasma::Location> freeEdges(int screen) const;
00166
00170 QAction *action(QString name) const;
00171
00175 void addAction(QString name, QAction *action);
00176
00180 QList<QAction*> actions() const;
00181
00188 void enableAction(const QString &name, bool enable);
00189
00196 void updateShortcuts();
00197
00204 void addShortcuts(KActionCollection *newShortcuts);
00205
00213 KAction* addAction(QString name);
00214
00215 public Q_SLOTS:
00224 void initializeLayout(const QString &config = QString());
00225
00233 void loadLayout(const QString &config = QString());
00234
00239 void saveLayout(const QString &config = QString()) const;
00240
00244 ImmutabilityType immutability() const;
00245
00251 void setImmutability(const ImmutabilityType immutable);
00252
00257 void requestConfigSync();
00258
00266 void requireConfigSync();
00267
00268 Q_SIGNALS:
00273 void containmentAdded(Plasma::Containment *containment);
00274
00283 void screenOwnerChanged(int wasScreen, int isScreen, Plasma::Containment *containment);
00284
00291 void releaseVisualFocus();
00292
00296 void configSynced();
00297
00301 void availableScreenRegionChanged();
00302
00309 void immutabilityChanged(Plasma::ImmutabilityType immutability);
00310
00319 void shortcutsChanged();
00320
00321 protected:
00325 virtual void loadDefaultLayout();
00326
00341 Containment *addContainmentDelayed(const QString &name,
00342 const QVariantList &args = QVariantList());
00343
00344
00345 void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
00346 void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
00347 void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
00348
00349 private:
00350 CoronaPrivate *const d;
00351
00352 Q_PRIVATE_SLOT(d, void containmentDestroyed(QObject*))
00353 Q_PRIVATE_SLOT(d, void offscreenWidgetDestroyed(QObject *))
00354 Q_PRIVATE_SLOT(d, void syncConfig())
00355 Q_PRIVATE_SLOT(d, void toggleImmutability())
00356 Q_PRIVATE_SLOT(d, void showShortcutConfig())
00357
00358 friend class CoronaPrivate;
00359 };
00360
00361 }
00362
00363 #endif
00364