• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeplasma-addons API Reference
  • KDE Home
  • Contact Us
 

GroupingDesktop

  • sources
  • kde-4.14
  • kdeplasma-addons
  • containments
  • groupingdesktop
  • lib
freehandle.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007 by Kevin Ottens <ervin@kde.org>
3  * Copyright 2009-2010 by Giulio Camuffo <giuliocamuffo@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 FREEHANDLE_P_H
22 #define FREEHANDLE_P_H
23 
24 #include <QtCore/QObject>
25 #include <QTimer>
26 #include <QWeakPointer>
27 #include <QPropertyAnimation>
28 
29 #include <Plasma/Animator>
30 #include <Plasma/Svg>
31 
32 #include "handle.h"
33 
34 
35 namespace Plasma
36 {
37  class Applet;
38  class FrameSvg;
39 }
40 
41 class AbstractGroup;
42 class GroupingContainment;
43 
44 class FreeHandle : public Handle
45 {
46  Q_OBJECT
47  Q_PROPERTY(qreal fadeAnimation READ fadeAnimation WRITE setFadeAnimation)
48  public:
49  enum FadeType {
50  FadeIn,
51  FadeOut
52  };
53 
54  FreeHandle(GroupingContainment *parent, Plasma::Applet *applet);
55  FreeHandle(GroupingContainment *parent, AbstractGroup *group);
56  virtual ~FreeHandle();
57 
58  QRectF boundingRect() const;
59  QPainterPath shape() const;
60  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
61  void startFading(FadeType anim, const QPointF &hoverPos, bool preserveSide = false);
62  void setHoverPos(const QPointF &hoverPos);
63 
64  protected:
65  void mousePressEvent(QGraphicsSceneMouseEvent *event);
66  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
67  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
68  void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
69  void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
70  void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
71  bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
72  bool sceneEvent(QEvent*);
73 
74  private Q_SLOTS:
75  void setFadeAnimation(qreal progress);
76  qreal fadeAnimation() const;
77  void widgetResized();
78  void hoverTimeout();
79  void leaveTimeout();
80  void emitDisappear();
81 
82  private:
83  static const int HANDLE_MARGIN = 3;
84 
85  void init();
86  void calculateSize();
87  ButtonType mapToButton(const QPointF &point) const;
88  void forceDisappear();
89  int minimumHeight();
90 
91  QRectF m_rect;
92  QRectF m_decorationRect;
93  QRectF m_totalRect;
94  ButtonType m_pressedButton;
95  int m_iconSize;
96  qreal m_opacity;
97  FadeType m_animType;
98  QWeakPointer<QPropertyAnimation> m_anim;
99  qreal m_angle;
100  QColor m_gradientColor;
101  QTimer *m_hoverTimer;
102  QTimer *m_leaveTimer;
103  QPixmap *m_backgroundBuffer;
104 
105  Plasma::Svg *m_configureIcons;
106  Plasma::FrameSvg *m_background;
107 
108  QPoint m_mousePos; //mousepos relative to applet
109  QPointF m_entryPos; //where the hover in event occurred
110  qreal m_zValue; //current zValue of the applet, so it can be restored after drag.
111  QRectF m_originalGeom;
112  QTransform m_originalTransform;
113 
114  // used for both resize and rotate
115  QPointF m_origWidgetCenter;
116  QPointF m_origWidgetSize;
117 
118  // used for resize
119  QPointF m_resizeStaticPoint;
120  QPointF m_resizeGrabPoint;
121  // used for rotate
122  qreal m_rotateAngleOffset; // applet angle minus cursor angle
123 
124  bool m_buttonsOnRight : 1;
125  bool m_pendingFade : 1;
126 };
127 
128 #endif // multiple inclusion guard
FreeHandle::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: freehandle.cpp:196
QTransform
QEvent
QWidget
FreeHandle::hoverEnterEvent
void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Definition: freehandle.cpp:826
FreeHandle::hoverLeaveEvent
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Definition: freehandle.cpp:846
FreeHandle::FreeHandle
FreeHandle(GroupingContainment *parent, Plasma::Applet *applet)
Definition: freehandle.cpp:58
FreeHandle::startFading
void startFading(FadeType anim, const QPointF &hoverPos, bool preserveSide=false)
Definition: freehandle.cpp:925
FreeHandle::hoverMoveEvent
void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Definition: freehandle.cpp:841
Handle::ButtonType
ButtonType
Definition: handle.h:46
QGraphicsItem
Handle
Definition: handle.h:41
QPoint
FreeHandle::mouseMoveEvent
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition: freehandle.cpp:625
QPointF
QObject::event
virtual bool event(QEvent *e)
Handle::applet
Plasma::Applet * applet() const
Definition: handle.cpp:85
handle.h
FreeHandle::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: freehandle.cpp:454
FreeHandle::FadeIn
Definition: freehandle.h:50
QTimer
Handle::group
AbstractGroup * group() const
Definition: handle.cpp:90
QGraphicsSceneMouseEvent
QPainter
FreeHandle::sceneEvent
bool sceneEvent(QEvent *)
Definition: freehandle.cpp:769
FreeHandle::setHoverPos
void setHoverPos(const QPointF &hoverPos)
Definition: freehandle.cpp:916
QColor
QGraphicsSceneHoverEvent
Handle::widget
QGraphicsWidget * widget() const
Definition: handle.cpp:80
QPixmap
FreeHandle::sceneEventFilter
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event)
Definition: freehandle.cpp:871
FreeHandle::FadeType
FadeType
Definition: freehandle.h:49
QPainterPath
GroupingContainment
The base Containment class.
Definition: groupingcontainment.h:38
QRectF
QWeakPointer< QPropertyAnimation >
QStyleOptionGraphicsItem
FreeHandle::boundingRect
QRectF boundingRect() const
Definition: freehandle.cpp:151
FreeHandle::~FreeHandle
virtual ~FreeHandle()
Definition: freehandle.cpp:84
FreeHandle
Definition: freehandle.h:44
AbstractGroup
The base Group class.
Definition: abstractgroup.h:43
QObject::parent
QObject * parent() const
FreeHandle::FadeOut
Definition: freehandle.h:51
FreeHandle::mouseReleaseEvent
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition: freehandle.cpp:516
FreeHandle::shape
QPainterPath shape() const
Definition: freehandle.cpp:156
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:39:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

GroupingDesktop

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

kdeplasma-addons API Reference

Skip menu "kdeplasma-addons API Reference"
  •     GroupingDesktop
  •   liblancelot

Search



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