1 /***************************************************************************
2 * Copyright 2007 by Enrico Ros <enrico.ros@gmail.com> *
3 * Copyright 2007 by Riccardo Iaconelli <ruphy@kde.org> *
4 * Copyright 2008 by Davide Bettio <davide.bettio@kdemail.net> *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
20 ***************************************************************************/
22 #ifndef __ResultItem_h__
23 #define __ResultItem_h__
25 #include <QtGui/QGraphicsWidget>
26 #include <QtGui/QIcon>
28 #include <Plasma/QueryMatch>
30 class QGraphicsLinearLayout
;
38 class ResultItemSignaller
: public QObject
43 ResultItemSignaller(QObject
*parent
= 0)
49 void startAnimations()
58 class ResultItem
: public QGraphicsWidget
63 ResultItem(const Plasma::QueryMatch
&match
, QGraphicsWidget
*parent
, Plasma::FrameSvg
*frame
);
65 void paint(QPainter
* painter
, const QStyleOptionGraphicsItem
* option
, QWidget
* widget
= 0);
66 void setMatch(const Plasma::QueryMatch
&match
);
71 QString
description() const;
74 Plasma::QueryMatch::Type
group() const;
75 qreal
priority() const;
76 bool isFavorite() const;
77 void setIndex(int index
);
79 void setRowStride(int stride
);
80 int rowStride() const;
82 void run(Plasma::RunnerManager
*manager
);
84 static bool compare(const ResultItem
*one
, const ResultItem
*other
);
85 bool operator<(const ResultItem
&other
) const;
87 static const int ITEM_SIZE
= 68;
88 static const int PADDING
= 2;
89 static const int MARGIN
= 3;
90 static const int TEXT_MARGIN
= 1;
91 static const int BOUNDING_WIDTH
= ITEM_SIZE
+ MARGIN
*2;
92 static const int BOUNDING_HEIGHT
= ITEM_SIZE
+ MARGIN
*3 + TEXT_MARGIN
*2;
95 void indexReleased(int index
);
96 void activated(ResultItem
*item
);
97 void hoverEnter(ResultItem
*item
);
98 void hoverLeave(ResultItem
*item
);
101 void hoverLeaveEvent(QGraphicsSceneHoverEvent
*e
);
102 void hoverEnterEvent(QGraphicsSceneHoverEvent
*e
);
103 void timerEvent(QTimerEvent
*e
);
104 void mouseReleaseEvent(QGraphicsSceneMouseEvent
*);
105 void focusInEvent(QFocusEvent
*event
);
106 void focusOutEvent(QFocusEvent
*event
);
107 void keyPressEvent(QKeyEvent
*event
);
108 QVariant
itemChange(GraphicsItemChange change
, const QVariant
&value
);
111 // must always call remove()
115 // Q_PRIVATE_SLOT(d, void animationComplete())
118 void slotTestTransp();
119 void animationComplete();
121 void becomeVisible();