2 * Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include <QGraphicsView>
24 #include <QGraphicsItem>
26 // pulls in definition for Window
27 #include <KSelectionWatcher>
30 #include <plasma/abstractrunner.h>
31 #include <plasma/svg.h>
32 #include <plasma/widgets/pushbutton.h>
33 #include <plasma/widgets/layoutitem.h>
34 #define KRUNNER_SIZE 350, 101
38 class QListWidgetItem
;
45 class CollapsibleWidget
;
51 class Interface
: public QGraphicsView
54 Q_CLASSINFO( "D-Bus Interface", "org.kde.krunner.Interface" )
57 explicit Interface( QWidget
* parent
= 0 );
61 // DBUS interface. if you change these methods, you MUST run:
62 // qdbuscpp2xml interface.h -o org.kde.krunner.Interface.xml
63 void display(const QString
& term
= QString());
67 void match( const QString
& term
);
68 void setWidgetPalettes();
71 void matchActivated( QListWidgetItem
* );
73 void showOptions(bool show
);
74 void setDefaultItem( QListWidgetItem
* );
79 void showEvent( QShowEvent
* e
);
80 void hideEvent( QHideEvent
* e
);
81 // void paintEvent( QPaintEvent* e );
82 void resizeEvent( QResizeEvent
* e
);
85 void resetInterface();
87 Plasma::Svg
* m_background
;
93 Plasma::AbstractRunner::List m_runners
;
95 // QVBoxLayout* m_layout;
96 // KTitleWidget* m_header;
97 KLineEdit
* m_searchTerm
;
98 // QListWidget* m_matchList;
99 // QLabel* m_optionsLabel;
100 // KPushButton* m_cancelButton;
101 // KPushButton* m_runButton;
102 // KPushButton* m_optionsButton;
103 // CollapsibleWidget* m_expander;
104 PushIcon
*m_toggleExpand
;
106 SearchMatch
* m_defaultMatch
;
107 QMap
<Plasma::AbstractRunner
*, SearchMatch
*> m_matches
;
108 QList
<SearchMatch
*> m_searchMatches
;
111 class GenericItem
: public QGraphicsItem
,
113 // public Plasma::LayoutItem
118 GenericItem(Plasma::Svg
*renderer
, Interface
*qgv
);
119 void paint(QPainter
*painter
,
120 const QStyleOptionGraphicsItem
*option
,
122 virtual QRectF
boundingRect() const;
123 void setElement(const QString
&);
126 Plasma::Svg
* m_background
;
133 // class BackgroundItem : public QGraphicsItem, public QObject
137 // BackgroundItem(Plasma::Svg *renderer);
138 // void paint(QPainter *painter,
139 // const QStyleOptionGraphicsItem *option,
141 // virtual QRectF boundingRect() const;
142 // void setType(const QString &type);
145 // Plasma::Svg* m_background;
151 // class ForegroundItem : public QGraphicsItem, public QObject
155 // BackgroundItem(Plasma::Svg *renderer);
156 // void paint(QPainter *painter,
157 // const QStyleOptionGraphicsItem *option,
159 // virtual QRectF boundingRect() const;
161 // Plasma::Svg *m_background;
166 class PushIcon
: public Plasma::PushButton
169 PushIcon(Interface
*qgv
) { m_qgv
= qgv
; }
170 virtual void paint(QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, QWidget
*widget
= 0);
171 virtual QRectF
boundingRect() const { return QRectF(0, 0, 22, 22); }
172 void setIcon(const QString
&icon
);