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

Plasma

  • plasma
corona.h
Go to the documentation of this file.
1/*
2 * Copyright 2007 Aaron Seigo <aseigo@kde.org>
3 * Copyright 2007 Matt Broadstone <mbroadst@gmail.com>
4 *
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.
9 *
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
14 *
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.
19 */
20
21#ifndef PLASMA_CORONA_H
22#define PLASMA_CORONA_H
23
24#include <QtGui/QGraphicsScene>
25
26#include <plasma/applet.h>
27#include <plasma/containment.h>
28#include <plasma/plasma.h>
29#include <plasma/plasma_export.h>
30
31class QGraphicsGridLayout;
32class QAction;
33
34class KAction;
35
36namespace Plasma
37{
38
39class CoronaPrivate;
40class ContainmentActionsPluginsConfig;
41class AbstractDialogManager;
42
48class PLASMA_EXPORT Corona : public QGraphicsScene
49{
50 Q_OBJECT
51
52//typedef QHash<QString, QList<Plasma::Applet*> > layouts;
53
54public:
55 explicit Corona(QObject * parent = 0);
56 ~Corona();
57
62 void setAppletMimeType(const QString &mimetype);
63
67 QString appletMimeType();
68
73 QString defaultContainmentPlugin() const;
74
78 QList<Containment*> containments() const;
79
83 void clearContainments();
84
88 KSharedConfig::Ptr config() const;
89
105 Containment *addContainment(const QString &name, const QVariantList &args = QVariantList());
106
125 Containment *addContainmentDelayed(const QString &name,
126 const QVariantList &args = QVariantList());
127
135 Containment *containmentForScreen(int screen, int desktop = -1) const;
136
149 Containment *containmentForScreen(int screen, int desktop,
150 const QString &defaultPluginIfNonExistent,
151 const QVariantList &defaultArgs = QVariantList());
158 void addOffscreenWidget(QGraphicsWidget *widget);
159
164 void removeOffscreenWidget(QGraphicsWidget *widget);
165
170 QList <QGraphicsWidget *> offscreenWidgets() const;
171
177 virtual int numScreens() const;
178
185 virtual QRect screenGeometry(int id) const;
186
195 virtual QRegion availableScreenRegion(int id) const;
196
204 QPoint popupPosition(const QGraphicsItem *item, const QSize &size);
205
215 QPoint popupPosition(const QGraphicsItem *item, const QSize &size, Qt::AlignmentFlag alignment);
216
223 QList<Plasma::Location> freeEdges(int screen) const;
224
228 QAction *action(QString name) const;
229
233 void addAction(QString name, QAction *action);
234
238 QList<QAction*> actions() const;
239
246 void enableAction(const QString &name, bool enable);
247
254 void updateShortcuts();
255
262 void addShortcuts(KActionCollection *newShortcuts);
263
271 KAction* addAction(QString name);
272
277 void setContainmentActionsDefaults(Containment::Type containmentType, const ContainmentActionsPluginsConfig &config);
278
283 ContainmentActionsPluginsConfig containmentActionsDefaults(Containment::Type containmentType);
284
290 void setDialogManager(AbstractDialogManager *manager);
291
297 AbstractDialogManager *dialogManager();
298
309#ifndef KDE_NO_DEPRECATED
310 KDE_DEPRECATED QList<Plasma::Containment *> importLayout(const KConfigBase &config);
311#endif
312
320 QString preferredToolBoxPlugin(const Containment::Type type) const;
321
331 QList<Plasma::Containment *> importLayout(const KConfigGroup &config);
332
340 void exportLayout(KConfigGroup &config, QList<Containment*> containments);
341
342public Q_SLOTS:
351 void initializeLayout(const QString &config = QString());
352
360 void loadLayout(const QString &config = QString());
361
366 void saveLayout(const QString &config = QString()) const;
367
371 ImmutabilityType immutability() const;
372
378 void setImmutability(const ImmutabilityType immutable);
379
384 void requestConfigSync();
385
393 void requireConfigSync();
394
401 void layoutContainments();
402
403Q_SIGNALS:
408 void containmentAdded(Plasma::Containment *containment);
409
418 void screenOwnerChanged(int wasScreen, int isScreen, Plasma::Containment *containment);
419
426 void releaseVisualFocus();
427
431 void configSynced();
432
436 void availableScreenRegionChanged();
437
444 void immutabilityChanged(Plasma::ImmutabilityType immutability);
445
454 void shortcutsChanged();
455
456protected:
460 virtual void loadDefaultLayout();
461
469 void mapAnimation(Animator::Animation from, Animator::Animation to);
470
478 void mapAnimation(Animator::Animation from, const QString &to);
479
486 void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin);
487
492 void setDefaultContainmentPlugin(const QString &name);
493
494 //Reimplemented from QGraphicsScene
495 void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
496 void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
497 void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
498
499private:
500 CoronaPrivate *const d;
501
502 Q_PRIVATE_SLOT(d, void containmentDestroyed(QObject*))
503 Q_PRIVATE_SLOT(d, void offscreenWidgetDestroyed(QObject *))
504 Q_PRIVATE_SLOT(d, void syncConfig())
505 Q_PRIVATE_SLOT(d, void toggleImmutability())
506 Q_PRIVATE_SLOT(d, void showShortcutConfig())
507
508 friend class CoronaPrivate;
509 friend class View;
510};
511
512} // namespace Plasma
513
514#endif
515
applet.h
Plasma::AbstractDialogManager
The AbstractDialogManager class shows the dialogs shown by applets and the rest of the shell.
Definition abstractdialogmanager.h:44
Plasma::Animator::Animation
Animation
Definition animator.h:55
Plasma::ContainmentActionsPluginsConfig
A class that holds a map of triggers to plugin names.
Definition containmentactionspluginsconfig.h:42
Plasma::Containment
The base class for plugins that provide backgrounds and applet grouping containers.
Definition containment.h:73
Plasma::Containment::Type
Type
Definition containment.h:99
Plasma::Corona::setDialogManager
void setDialogManager(AbstractDialogManager *manager)
Definition corona.cpp:786
Plasma::Corona::numScreens
virtual int numScreens() const
Returns the number of screens available to plasma.
Definition corona.cpp:440
Plasma::Corona::View
friend class View
Definition corona.h:509
Plasma::Corona::setContainmentActionsDefaults
void setContainmentActionsDefaults(Containment::Type containmentType, const ContainmentActionsPluginsConfig &config)
Definition corona.cpp:776
Plasma::Corona::action
QAction * action(QString name) const
Returns the QAction with the given name from our collection.
Definition corona.cpp:720
Plasma::Corona::releaseVisualFocus
void releaseVisualFocus()
This signal indicates that an application launch, window creation or window focus event was triggered...
Plasma::Corona::offscreenWidgets
QList< QGraphicsWidget * > offscreenWidgets() const
Definition corona.cpp:426
Plasma::Corona::immutabilityChanged
void immutabilityChanged(Plasma::ImmutabilityType immutability)
emitted when immutability changes.
Plasma::Corona::loadDefaultLayout
virtual void loadDefaultLayout()
Loads the default (system wide) layout for this user.
Definition corona.cpp:632
Plasma::Corona::containmentAdded
void containmentAdded(Plasma::Containment *containment)
This signal indicates a new containment has been added to the Corona.
Plasma::Corona::layoutContainments
void layoutContainments()
Definition corona.cpp:206
Plasma::Corona::configSynced
void configSynced()
This signal indicates that the configuration file was flushed to disc.
Plasma::Corona::updateShortcuts
void updateShortcuts()
Definition corona.cpp:749
Plasma::Corona::requestConfigSync
void requestConfigSync()
Schedules a flush-to-disk synchronization of the configuration state at the next convenient moment.
Definition corona.cpp:156
Plasma::Corona::setAppletMimeType
void setAppletMimeType(const QString &mimetype)
Sets the mimetype of Drag/Drop items.
Definition corona.cpp:86
Plasma::Corona::preferredToolBoxPlugin
QString preferredToolBoxPlugin(const Containment::Type type) const
Returns the name of the preferred plugin to be used as containment toolboxes.
Definition corona.cpp:642
Plasma::Corona::setImmutability
void setImmutability(const ImmutabilityType immutable)
Sets the immutability type for this Corona (not immutable, user immutable or system immutable)
Definition corona.cpp:667
Plasma::Corona::initializeLayout
void initializeLayout(const QString &config=QString())
Initializes the layout from a config file.
Definition corona.cpp:179
Plasma::Corona::dragMoveEvent
void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
Definition corona.cpp:657
Plasma::Corona::addContainment
Containment * addContainment(const QString &name, const QVariantList &args=QVariantList())
Adds a Containment to the Corona.
Definition corona.cpp:349
Plasma::Corona::exportLayout
void exportLayout(KConfigGroup &config, QList< Containment * > containments)
Exports a set of containments to a config file.
Definition corona.cpp:123
Plasma::Corona::clearContainments
void clearContainments()
Clear the Corona from all applets.
Definition corona.cpp:333
Plasma::Corona::removeOffscreenWidget
void removeOffscreenWidget(QGraphicsWidget *widget)
Removes a widget from the topleft quadrant in the scene.
Definition corona.cpp:414
Plasma::Corona::loadLayout
void loadLayout(const QString &config=QString())
Load applet layout from a config file.
Definition corona.cpp:272
Plasma::Corona::setPreferredToolBoxPlugin
void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin)
Definition corona.cpp:636
Plasma::Corona::dragLeaveEvent
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
Definition corona.cpp:652
Plasma::Corona::popupPosition
QPoint popupPosition(const QGraphicsItem *item, const QSize &size)
Recommended position for a popup window like a menu or a tooltip given its size.
Definition corona.cpp:463
Plasma::Corona::screenOwnerChanged
void screenOwnerChanged(int wasScreen, int isScreen, Plasma::Containment *containment)
This signal indicates that a containment has been newly associated (or dissociated) with a physical s...
Plasma::Corona::availableScreenRegion
virtual QRegion availableScreenRegion(int id) const
Returns the available region for a given screen.
Definition corona.cpp:458
Plasma::Corona::containments
QList< Containment * > containments() const
Definition corona.cpp:328
Plasma::Corona::addContainmentDelayed
Containment * addContainmentDelayed(const QString &name, const QVariantList &args=QVariantList())
Loads a containment with delayed initialization, primarily useful for implementations of loadDefaultL...
Definition corona.cpp:358
Plasma::Corona::addAction
void addAction(QString name, QAction *action)
Adds the action to our collection under the given name.
Definition corona.cpp:725
Plasma::Corona::mapAnimation
void mapAnimation(Animator::Animation from, Animator::Animation to)
Maps a stock animation to one of the semantic animations.
Definition corona.cpp:367
Plasma::Corona::immutability
ImmutabilityType immutability() const
Definition corona.cpp:662
Plasma::Corona::actions
QList< QAction * > actions() const
Returns all the actions in our collection.
Definition corona.cpp:735
Plasma::Corona::importLayout
QList< Plasma::Containment * > importLayout(const KConfigBase &config)
Imports an applet layout from a config file.
Definition corona.cpp:290
Plasma::Corona::config
KSharedConfig::Ptr config() const
Returns the config file used to store the configuration for this Corona.
Definition corona.cpp:340
Plasma::Corona::Corona
Corona(QObject *parent=0)
Definition corona.cpp:64
Plasma::Corona::setDefaultContainmentPlugin
void setDefaultContainmentPlugin(const QString &name)
Sets the default containment plugin to try and load.
Definition corona.cpp:96
Plasma::Corona::shortcutsChanged
void shortcutsChanged()
Plasma::Corona::requireConfigSync
void requireConfigSync()
Schedules a time sensitive flush-to-disk synchronization of the configuration state.
Definition corona.cpp:174
Plasma::Corona::appletMimeType
QString appletMimeType()
The current mime type of Drag/Drop items.
Definition corona.cpp:91
Plasma::Corona::screenGeometry
virtual QRect screenGeometry(int id) const
Returns the geometry of a given screen.
Definition corona.cpp:445
Plasma::Corona::addShortcuts
void addShortcuts(KActionCollection *newShortcuts)
Definition corona.cpp:768
Plasma::Corona::defaultContainmentPlugin
QString defaultContainmentPlugin() const
Definition corona.cpp:105
Plasma::Corona::dialogManager
AbstractDialogManager * dialogManager()
Definition corona.cpp:791
Plasma::Corona::CoronaPrivate
friend class CoronaPrivate
Definition corona.h:508
Plasma::Corona::containmentActionsDefaults
ContainmentActionsPluginsConfig containmentActionsDefaults(Containment::Type containmentType)
Definition corona.cpp:781
Plasma::Corona::enableAction
void enableAction(const QString &name, bool enable)
convenience function - enables or disables an action by name
Definition corona.cpp:740
Plasma::Corona::availableScreenRegionChanged
void availableScreenRegionChanged()
This signal inicates that a change in available screen goemetry occurred.
Plasma::Corona::freeEdges
QList< Plasma::Location > freeEdges(int screen) const
This method is useful in order to retrieve the list of available screen edges for panel type containm...
Definition corona.cpp:704
Plasma::Corona::containmentForScreen
Containment * containmentForScreen(int screen, int desktop=-1) const
Returns the Containment, if any, for a given physical screen and desktop.
Definition corona.cpp:296
Plasma::Corona::addOffscreenWidget
void addOffscreenWidget(QGraphicsWidget *widget)
Adds a widget in the topleft quadrant in the scene.
Definition corona.cpp:377
Plasma::Corona::dragEnterEvent
void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
Definition corona.cpp:647
Plasma::Corona::saveLayout
void saveLayout(const QString &config=QString()) const
Save applets layout to file.
Definition corona.cpp:110
QGraphicsScene
QGraphicsWidget
QObject
containment.h
Plasma
Namespace for everything in libplasma.
Definition abstractdialogmanager.cpp:25
Plasma::ImmutabilityType
ImmutabilityType
Defines the immutability of items like applets, corona and containments they can be free to modify,...
Definition plasma.h:197
Plasma::type
static QScriptValue type(QScriptContext *ctx, QScriptEngine *eng)
Definition easingcurve.cpp:63
plasma.h
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.14.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal