plasma-framework/corona.h

100 lines
2.7 KiB
C
Raw Normal View History

/*
* Copyright (C) 2007 Matt Broadstone <mbroadst@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CORONA_H
#define CORONA_H
#include <QGraphicsScene>
#include "applet.h"
#include "plasma.h"
#include "plasma_export.h"
namespace Plasma
{
class Layout;
class Svg;
/**
* @short A QGraphicsScene for Plasma::Applets
*/
class PLASMA_EXPORT Corona : public QGraphicsScene
{
Q_OBJECT
//typedef QHash<QString, QList<Plasma::Applet*> > layouts;
public:
explicit Corona(QObject * parent = 0);
explicit Corona(const QRectF & sceneRect, QObject * parent = 0);
explicit Corona(qreal x, qreal y, qreal width, qreal height, QObject * parent = 0);
~Corona();
/**
* The location of the Corona. @see Plasma::Location
*/
Plasma::Location location() const;
/**
* Informs the Corona as to what position it is in. This is informational
* only, as the Corona doesn't change it's actual location. This is,
* however, passed on to Applets that may be managed by this Corona.
*
* @param location the new location of this Corona
*/
void setLocation(Location location);
/**
* The current form factor for this Corona. @see Plasma::FormFactor
**/
Plasma::FormFactor formFactor() const;
/**
* Sets the form factor for this Corona. This may cause changes in both
* the arrangement of Applets as well as the display choices of individual
* Applets.
*/
void setFormFactor(FormFactor formFactor);
public Q_SLOTS:
void addPlasmoid(const QString& name);
protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent* event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent* event);
void dragMoveEvent(QGraphicsSceneDragDropEvent* event);
void dropEvent(QGraphicsSceneDragDropEvent* event);
void contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent);
protected Q_SLOTS:
void launchExplorer(bool /*param*/);
private:
void init();
class Private;
Private * const d;
};
} // namespace Plasma
#endif