plasma-framework/desktoptoolbox_p.h
Aaron J. Seigo 2073330692 * remove unneeded members (like a copy of the icon)
* don't re-do math we've already done (progress var)
* go from disable dto enabled, after all that is exactly what's happening: when you mouse over it becomes active. now that the items don't overlap the icon this works out nicely; it also makes the toolbox less LOUD and in your face when not in use

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=758486
2008-01-08 00:41:53 +00:00

70 lines
1.9 KiB
C++

/*
* 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>
#include <KIcon>
#include "phase.h"
namespace Plasma
{
class Widget;
class DesktopToolbox : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
explicit DesktopToolbox(QGraphicsItem *parent = 0);
QRectF boundingRect() const;
QPainterPath shape() const;
void addTool(QGraphicsItem *tool, const QString &name);
void enableTool(const QString &tool, bool enabled);
bool isToolEnabled(const QString &tool) const;
QGraphicsItem* tool(const QString &tool) const;
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;
int m_size;
bool m_hidden;
bool m_showing;
Plasma::Phase::AnimId m_animId;
qreal m_animFrame;
};
} // Plasma namespace
#endif // multiple inclusion guard