2 * Copyright 2007 Aaron Seigo <aseigo@kde.org>
3 * Copyright 2007 Matt Broadstone <mbroadst@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include <QtGui/QGraphicsScene>
26 #include <plasma/applet.h>
27 #include <plasma/plasma.h>
28 #include <plasma/plasma_export.h>
36 * @short A QGraphicsScene for Plasma::Applets
38 class PLASMA_EXPORT Corona
: public QGraphicsScene
42 //typedef QHash<QString, QList<Plasma::Applet*> > layouts;
45 explicit Corona(QObject
* parent
= 0);
46 explicit Corona(const QRectF
& sceneRect
, QObject
* parent
= 0);
47 Corona(qreal x
, qreal y
, qreal width
, qreal height
, QObject
* parent
= 0);
51 * The applets and Corona surface are changeable or not
53 bool isImmutable() const;
56 * @return true if this Corona is immutable due to Kiosk settings
58 bool isKioskImmutable() const;
61 * A rect containing the maximum size a plasmoid on this corona should
64 QRectF
maxSizeHint() const;
67 * Sets the mimetype of Drag/Drop items. Default is
68 * text/x-plasmoidservicename
70 void setAppletMimeType(const QString
&mimetype
);
73 * The current mime type of Drag/Drop items.
75 QString
appletMimeType();
78 * Loads the default (system wide) layout for this user
80 virtual void loadDefaultSetup();
83 * Clear the Corona from all applets.
88 * Returns the the config file used to store the configuration for this Corona
90 KSharedConfig::Ptr
config() const;
93 * Updates all of the corona's containments with reguards to their tool box position..
95 void updateToolboxPositions();
99 * Load applet layout from a config file
101 * @param config the name of the config file to load from,
102 * or the default config file if QString()
104 void loadApplets(const QString
&config
= QString());
107 * Save applets to file
108 * @arg config the file to save to, or the default config file if QString()
110 void saveApplets(const QString
&config
= QString()) const;
113 * Called when there have been changes made to configuration that should be saved
114 * to disk at the next convenient moment
116 void scheduleConfigSync() const;
119 * Adds a Containment to the Corona
121 * @param name the plugin name for the containment, as given by
122 * KPluginInfo::pluginName(). If an empty string is passed in, the defalt
123 * containment plugin will be used (usually DesktopContainment). If the
124 * string literal "null" is passed in, then no plugin will be loaded and
125 * a simple Containment object will be created instead.
126 * @param args argument list to pass to the containment
127 * @param id to assign to this containment, or 0 to auto-assign it a new id
128 * @param geometry where to place the containment, or to auto-place it if an invalid
131 * @return a pointer to the containment on success, or 0 on failure
133 Containment
* addContainment(const QString
& name
, const QVariantList
& args
= QVariantList(),
134 uint id
= 0, bool delayInit
= false);
137 * Removes a given containment from the corona
139 void destroyContainment(Containment
*containment
);
142 * Returns the Containment, if any, for a given physical screen
144 * @param screen number of the physical screen to locate
146 Containment
* containmentForScreen(int screen
) const;
149 * Returns all containments on this Corona
151 QList
<Containment
*> containments() const;
154 * Sets if the applets are Immutable
156 void setImmutable(bool immutable_
);
160 * This signal indicates that a application launch was triggered
162 void launchActivated();
165 * This signal indicates that a new screen is being handled
166 * at runtime (e.g. after first creation)
168 * @param screen the xinerama number of the new screen
170 void newScreen(int screen
);
173 void dragEnterEvent(QGraphicsSceneDragDropEvent
* event
);
174 void dragLeaveEvent(QGraphicsSceneDragDropEvent
* event
);
175 void dragMoveEvent(QGraphicsSceneDragDropEvent
* event
);
176 //void contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent);
179 void containmentDestroyed(QObject
*);
180 void screenResized(int);
188 } // namespace Plasma