not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / applets / kickoff / ui / launcher.h
blob983ceecd9bc0f6d946cfb4852693373014b14dec
1 /*
2 Copyright 2007 Robert Knight <robertknight@gmail.com>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library 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 GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef LAUNCHER_H
21 #define LAUNCHER_H
23 // Qt
24 #include <QWidget>
26 // Plasma
27 #include <Plasma/Applet>
29 namespace Kickoff
32 /**
33 * The main window class for the Kickoff launcher. This class is responsible
34 * for creating the various tabs, views and models which make up the launcher's
35 * user interface.
37 class Launcher : public QWidget
39 Q_OBJECT
41 public:
42 /** Construct a new Launcher with the specified parent. */
43 explicit Launcher(QWidget *parent = 0);
44 /** Construct a new Launcher associated with the specified Plasma::Applet. */
45 explicit Launcher(Plasma::Applet *applet = 0);
46 ~Launcher();
48 /** Specifies whether the launcher should hide itself when an item is activated. */
49 void setAutoHide(bool autoHide);
50 bool autoHide() const;
52 /** Specifies whether hovering switches between tabs or if a click is required to switch the tabs. */
53 void setSwitchTabsOnHover(bool switchOnHover);
54 bool switchTabsOnHover() const;
56 /** Specifies the number of visible items used to determinate the visible height. */
57 void setVisibleItemCount(int count);
58 int visibleItemCount() const;
60 /** Specifies the plasma applet the launcher is working on. */
61 void setApplet(Plasma::Applet *applet);
63 /** Specifies the direction the launcher is popping up in relative to its icon */
64 void setLauncherOrigin(const Plasma::PopupPlacement placement, Plasma::Location location);
66 // reimplemented
67 virtual bool eventFilter(QObject *object, QEvent *event);
68 virtual QSize minimumSizeHint() const;
69 virtual QSize sizeHint() const;
71 /** Reset the launcher. This is called e.g. by the Kickoff-applet before shown to be sure
72 we don't display old searches and switch back to the favorite-view. */
73 void reset();
75 signals:
76 void aboutToHide();
77 void configNeedsSaving();
79 protected:
80 virtual void keyPressEvent(QKeyEvent *event);
81 virtual void showEvent(QShowEvent *event);
82 virtual void hideEvent(QHideEvent *event);
84 private Q_SLOTS:
85 void focusSearchView(const QString& query);
86 void showViewContextMenu(const QPoint& pos);
87 void focusFavoritesView();
88 void resultsAvailable();
89 void updateThemedPalette();
91 private:
92 void init();
94 class Private;
95 Private * const d;
100 #endif // LAUNCHER_H