2
* Copyright (C) 2007-2008 Ryan P. Bitanga <ryan.bitanga@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, 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 General Public License
15
* 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 .
20
#ifndef QS_MATCHVIEW_H
21
#define QS_MATCHVIEW_H
36
* @short A class to visualize a set of items
38
* QsMatchView is composed of a title label, an item count label,
39
* a visualization box, and a popup completion box. The visualization
40
* box has three modes: scrolling icon, selected item, and text mode.
41
* The scrolling icon mode visualizes all items as a single horizontal
42
* row of icons. Scrolling is controlled by either the completion box
45
class QsMatchView : public QWidget
49
QsMatchView(QWidget *parent = 0);
53
* Removes all items from the scene
55
void clear(bool deleteItems = false);
57
* Removes items from the scene and places default find message
61
* Shows the loading animation
65
* Sets the list of items to be displayed on screen
66
* @param items The list of items to display
67
* @param popup Display the popup completion box
68
* @param append Append items to the current list instead of replacing it
70
void setItems(const QList<MatchItem*> &items, bool popup = true, bool append = false);
73
* Sets the item count text on the upper right hand corner
76
void setCountingActions(bool actions);
80
* Sets the title text on the upper left hand corner of the widget
82
void setTitle(const QString &title);
89
* Switches between Icon Parade and Selected Item modes
92
void scrollToItem(int index);
94
* Uses whole view to display selected item and hides all other matches
98
* Shows a scrolling list of icons for each match
102
* Paste the content of the clipboard to the lineedit
104
void pasteClipboard();
107
* Emitted when the user presser enter
109
void itemActivated(MatchItem *item);
111
* Emitted when the user changes selection through either the completion
112
* box or the scrolling icon view
114
void selectionChanged(MatchItem *item);
116
* Emitted when the internal query string changes
118
void textChanged(const QString &text);
121
* Sets the text in the bottom portion of the widget
122
* @param text Text to display
123
* @param color Color of the rectangle behind the text
125
void setDescriptionText(const QString &text, const QColor &color);
127
* Convenience method. Calls setDescriptionText(text, Plasma::Theme.color())
129
void setDescriptionText(const QString &text);
132
* Removes match items from scene but does not delete them
137
* Selects item at the specified index
139
void selectItem(int index);
141
* Highlights item and centers item when in scrolling icon mode
143
void focusItem(int index);
147
void setItemCount(int items);
149
void resizeEvent(QResizeEvent *e);
150
void focusInEvent(QFocusEvent *event);
151
void focusOutEvent(QFocusEvent *event);
152
void keyPressEvent(QKeyEvent *event);
155
* If there is already an animation and a new one should start, then the old
158
void finishAnimation();