22 #ifndef WORKSPACEEXPOSEWIDGET_H
23 #define WORKSPACEEXPOSEWIDGET_H
25 #include <QtGui/QGraphicsObject>
26 #include <QtGui/QGraphicsView>
27 #include <QtCore/QMap>
28 #include <QtGui/QPixmap>
29 #include <tulip/tulipconf.h>
31 class QAbstractAnimation;
36 class PreviewItem:
public QGraphicsObject {
39 static QPixmap* _closeButtonPixmap;
40 static QRect _closePixmapRect;
43 tlp::WorkspacePanel* _panel;
45 bool _closeButtonHovered;
47 int textHeight()
const;
49 explicit PreviewItem(
const QPixmap& pixmap, tlp::WorkspacePanel* panel, QGraphicsItem* parent = NULL);
50 QRectF boundingRect()
const;
51 void paint(QPainter*,
const QStyleOptionGraphicsItem*, QWidget*);
52 tlp::WorkspacePanel* panel()
const;
53 bool shouldClose(
const QPointF&);
55 void hoverEnterEvent(QGraphicsSceneHoverEvent*);
56 void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
57 void hoverMoveEvent(QGraphicsSceneHoverEvent*);
58 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
64 class TLP_QT_SCOPE WorkspaceExposeWidget :
public QGraphicsView {
67 QAbstractAnimation* _positionAnimation;
68 QList<PreviewItem*> _items;
69 PreviewItem* _selectedItem;
70 QGraphicsRectItem* _placeholderItem;
71 bool _switchToSingleMode;
73 int _currentPanelIndex;
75 void updatePositions(
bool resetScenePos=
true);
76 static const int MARGIN;
81 static QSize previewSize();
83 explicit WorkspaceExposeWidget(QWidget *parent = NULL);
84 int currentPanelIndex()
const;
85 QVector<WorkspacePanel*> panels()
const;
87 bool isSwitchToSingleMode()
const;
90 void setData(
const QVector<WorkspacePanel*>& panels,
int currentPanelIndex);
93 void exposeFinished();
96 void resizeEvent(QResizeEvent *event);
97 bool eventFilter(QObject *, QEvent *);
101 void updatePositionsAnimationFinished();
102 void resetSceneRect();
108 #endif // WORKSPACEEXPOSEWIDGET_H