2
* Copyright 2009 Marco Martin <notmart@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library General Public License as
6
* published by the Free Software Foundation; either version 2, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include <QGraphicsWidget>
24
#include <QPropertyAnimation>
27
#include <plasma/abstracttoolbox.h>
28
#include <plasma/containment.h>
31
class QGraphicsLinearLayout;
42
class NetToolBox : public Plasma::AbstractToolBox
45
Q_PROPERTY(bool showing READ isShowing WRITE setShowing )
46
Q_PROPERTY(qreal highlight READ highlight WRITE setHighlight)
48
explicit NetToolBox(Plasma::Containment *parent = 0);
49
explicit NetToolBox(QObject *parent, const QVariantList &args);
52
bool isShowing() const;
53
void setShowing(const bool show);
56
* create a toolbox tool from the given action
57
* @p action the action to associate the tool with
59
void addTool(QAction *action);
61
* remove the tool associated with this action
63
void removeTool(QAction *action);
65
QRectF expandedGeometry() const;
67
void setLocation(Plasma::Location location);
68
Plasma::Location location() const;
70
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
75
void mousePressEvent(QGraphicsSceneMouseEvent *event);
76
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
77
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
78
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
79
bool eventFilter(QObject *watched, QEvent *event);
82
void containmentGeometryChanged();
83
void setHighlight(qreal progress);
85
void movementFinished();
86
void onMovement(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
89
void highlight(bool highlighting);
90
ToolContainer *m_toolContainer;
91
QGraphicsLinearLayout *m_toolContainerLayout;
92
QHash<QAction *, Plasma::IconWidget *> m_actionButtons;
93
Plasma::Containment *m_containment;
94
Plasma::Svg *m_background;
98
Plasma::Animation *slideAnim;
99
QPropertyAnimation *anim;
100
qreal m_animHighlightFrame;
103
Plasma::Location m_location;
104
int m_newToolsPosition;
107
K_EXPORT_PLASMA_TOOLBOX(nettoolbox, NetToolBox)