22 #ifndef WORKSPACEEXPOSEWIDGET_H
23 #define WORKSPACEEXPOSEWIDGET_H
25 #include <QGraphicsObject>
26 #include <QGraphicsView>
28 #include <tulip/tulipconf.h>
30 class QAbstractAnimation;
35 class PreviewItem:
public QGraphicsObject {
38 static QPixmap* _closeButtonPixmap;
39 static QRect _closePixmapRect;
42 WorkspacePanel* _panel;
44 bool _closeButtonHovered;
46 int textHeight()
const;
48 explicit PreviewItem(
const QPixmap& pixmap, WorkspacePanel* panel, QGraphicsItem* parent = NULL);
49 QRectF boundingRect()
const;
50 void paint(QPainter*,
const QStyleOptionGraphicsItem*, QWidget*);
51 WorkspacePanel* panel()
const;
52 bool shouldClose(
const QPointF&);
54 void hoverEnterEvent(QGraphicsSceneHoverEvent*);
55 void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
56 void hoverMoveEvent(QGraphicsSceneHoverEvent*);
57 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
63 class TLP_QT_SCOPE WorkspaceExposeWidget :
public QGraphicsView {
66 QAbstractAnimation* _positionAnimation;
67 QList<PreviewItem*> _items;
68 PreviewItem* _selectedItem;
69 QGraphicsRectItem* _placeholderItem;
70 bool _switchToSingleMode;
72 int _currentPanelIndex;
74 void updatePositions(
bool resetScenePos=
true);
75 static const int MARGIN;
80 static QSize previewSize();
82 explicit WorkspaceExposeWidget(QWidget *parent = NULL);
83 int currentPanelIndex()
const;
84 QVector<WorkspacePanel*> panels()
const;
86 bool isSwitchToSingleMode()
const;
89 void setData(
const QVector<WorkspacePanel*>& panels,
int currentPanelIndex);
92 void exposeFinished();
95 void resizeEvent(QResizeEvent *event);
96 bool eventFilter(QObject *, QEvent *);
100 void updatePositionsAnimationFinished();
101 void resetSceneRect();
107 #endif // WORKSPACEEXPOSEWIDGET_H