add more spacing
[personal-kdebase.git] / workspace / plasma / applets / kickoff / simpleapplet / simpleapplet.h
blob3706fab9d2052729d1cbafd911c052bb79706d62
1 /*
2 Copyright 2007 Robert Knight <robertknight@gmail.com>
3 Copyright 2008 Sebastian Sauer <mail@dipe.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef SIMPLEAPPLET_H
22 #define SIMPLEAPPLET_H
24 // Plasma
25 #include <Plasma/Applet>
27 class QAction;
29 /**
30 * The MenuLauncherApplet class implements an applet that provides the traditional
31 * aka classic KDE3 like KMenu application launcher using the Kickoff functionality.
33 class MenuLauncherApplet : public Plasma::Applet
35 Q_OBJECT
36 Q_ENUMS(ViewType)
37 Q_ENUMS(FormatType)
38 public:
40 /**
41 * The menu we like to display.
43 enum ViewType {
44 Combined = 0, ///< Standard Menu
45 Favorites, ///< Favorites Menu
46 Applications, ///< Applications Menu
47 Computer, ///< Computer Menu
48 RecentlyUsed, ///< Recently Used Menu
49 Bookmarks, ///< Bookmarks Menu
50 Leave ///< Leave Menu
53 /**
54 * How the text of the menuitems got formatted.
56 enum FormatType {
57 Name = 0, ///< Name only
58 Description, ///< Description only
59 NameDescription, ///< Name Description
60 DescriptionName, ///< Description (Name)
61 NameDashDescription ///< Name - Description
64 /**
65 * Constructor.
67 * \param parent The parent QObject.
68 * \param args The optional list of arguments.
70 MenuLauncherApplet(QObject *parent, const QVariantList &args);
72 /**
73 * Destructor.
75 virtual ~MenuLauncherApplet();
77 /**
78 * This method is called once the applet is loaded and added to a Corona.
79 **/
80 void init();
82 /**
83 * Called when any of the geometry constraints have been updated.
85 * @param constraints the type of constraints that were updated
87 void constraintsEvent(Plasma::Constraints constraints);
89 /**
90 * Returns a list of context-related QAction instances.
92 virtual QList<QAction*> contextualActions();
94 public Q_SLOTS:
95 /**
96 * Switch the menu style from the traditional aka classic KDE3 like
97 * KMenu to the new Kickoff menu.
99 void switchMenuStyle();
101 void startMenuEditor();
103 protected:
105 * Create a configuration dialog.
107 void createConfigurationInterface(KConfigDialog *parent);
109 private Q_SLOTS:
110 void configAccepted();
111 void toggleMenu(bool pressed);
112 void toggleMenu();
113 void actionTriggered(QAction *action);
115 private:
116 class Private;
117 Private * const d;
120 K_EXPORT_PLASMA_APPLET(menulauncher, MenuLauncherApplet)
122 #endif