2007-11-19 02:19:12 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2007 by Aaron Seigo <aseigo@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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 PLASMA_DESKTOPTOOLBOX_H
|
|
|
|
#define PLASMA_DESKTOPTOOLBOX_H
|
|
|
|
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
#include <QObject>
|
2008-01-30 04:40:17 +01:00
|
|
|
#include <QTime>
|
2007-11-19 02:19:12 +01:00
|
|
|
|
|
|
|
#include <KIcon>
|
|
|
|
|
|
|
|
#include "phase.h"
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class Widget;
|
2008-01-10 22:05:56 +01:00
|
|
|
class EmptyGraphicsItem;
|
2007-11-19 02:19:12 +01:00
|
|
|
|
|
|
|
class DesktopToolbox : public QObject, public QGraphicsItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit DesktopToolbox(QGraphicsItem *parent = 0);
|
|
|
|
QRectF boundingRect() const;
|
|
|
|
QPainterPath shape() const;
|
|
|
|
|
2007-12-05 21:22:25 +01:00
|
|
|
void addTool(QGraphicsItem *tool, const QString &name);
|
|
|
|
void enableTool(const QString &tool, bool enabled);
|
2007-12-19 03:41:45 +01:00
|
|
|
bool isToolEnabled(const QString &tool) const;
|
|
|
|
QGraphicsItem* tool(const QString &tool) const;
|
2007-11-19 02:19:12 +01:00
|
|
|
|
2008-01-21 16:10:19 +01:00
|
|
|
void showToolbox();
|
|
|
|
void hideToolbox();
|
|
|
|
|
2007-11-19 02:19:12 +01:00
|
|
|
protected:
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
|
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
|
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void animate(qreal progress);
|
|
|
|
void toolMoved(QGraphicsItem*);
|
|
|
|
|
|
|
|
private:
|
|
|
|
KIcon m_icon;
|
2008-01-10 22:05:56 +01:00
|
|
|
EmptyGraphicsItem *m_toolBacker;
|
2008-01-30 04:40:17 +01:00
|
|
|
QTime m_stopwatch;
|
2008-01-08 06:04:11 +01:00
|
|
|
const int m_size;
|
2007-11-19 02:19:12 +01:00
|
|
|
bool m_hidden;
|
|
|
|
bool m_showing;
|
|
|
|
Plasma::Phase::AnimId m_animId;
|
2008-01-07 23:52:21 +01:00
|
|
|
qreal m_animFrame;
|
2007-11-19 02:19:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
#endif // multiple inclusion guard
|
|
|
|
|