~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/plasmagenericshell/widgetsexplorer/widgetexplorer.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright (C) 2007 by Ivan Cukic <ivan.cukic+kde@gmail.com>
 
3
 *   Copyright (C) 2009 by Ana Cecília Martins <anaceciliamb@gmail.com>
 
4
 *
 
5
 *   This program is free software; you can redistribute it and/or modify
 
6
 *   it under the terms of the GNU Library/Lesser General Public License
 
7
 *   version 2, or (at your option) any later version, as published by the
 
8
 *   Free Software Foundation
 
9
 *
 
10
 *   This program 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
 
13
 *   GNU General Public License for more details
 
14
 *
 
15
 *   You should have received a copy of the GNU Library/Lesser General Public
 
16
 *   License along with this program; if not, write to the
 
17
 *   Free Software Foundation, Inc.,
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
 */
 
20
 
 
21
 
 
22
#ifndef WIDGETEXPLORER_H
 
23
#define WIDGETEXPLORER_H
 
24
 
 
25
#include <QtGui>
 
26
 
 
27
#include <KDE/KDialog>
 
28
 
 
29
#include <plasma/framesvg.h>
 
30
 
 
31
#include "plasmaappletitemmodel_p.h"
 
32
 
 
33
#include "plasmagenericshell_export.h"
 
34
 
 
35
namespace Plasma
 
36
{
 
37
 
 
38
class Corona;
 
39
class Containment;
 
40
class Applet;
 
41
class WidgetExplorerPrivate;
 
42
class WidgetExplorerPrivate;
 
43
 
 
44
class PLASMAGENERICSHELL_EXPORT WidgetExplorer : public QGraphicsWidget
 
45
{
 
46
 
 
47
    Q_OBJECT
 
48
 
 
49
public:
 
50
    explicit WidgetExplorer(Plasma::Location loc, QGraphicsItem *parent = 0);
 
51
    explicit WidgetExplorer(QGraphicsItem *parent = 0);
 
52
    ~WidgetExplorer();
 
53
 
 
54
    QString application();
 
55
 
 
56
    /**
 
57
     * Populates the widget list for the given application. This must be called
 
58
     * before the widget explorer will be usable as the widget list will remain
 
59
     * empty up to that point.
 
60
     *
 
61
     * @arg application the application which the widgets should be loaded for.
 
62
     */
 
63
    void populateWidgetList(const QString &application = QString());
 
64
 
 
65
    /**
 
66
     * Changes the current default containment to add applets to
 
67
     *
 
68
     * @arg containment the new default
 
69
     */
 
70
    void setContainment(Plasma::Containment *containment);
 
71
 
 
72
    /**
 
73
     * @return the current default containment to add applets to
 
74
     */
 
75
    Containment *containment() const;
 
76
    /**
 
77
     * @return the current corona this widget is added to
 
78
     */
 
79
    Plasma::Corona *corona() const;
 
80
 
 
81
    /**
 
82
     * Set the location of the widget explorer
 
83
     *
 
84
     * @arg the new location
 
85
     */
 
86
    void setLocation(const Plasma::Location loc);
 
87
 
 
88
    /**
 
89
     * @return the location of the widget explorer
 
90
     */
 
91
    Plasma::Location location() const;
 
92
 
 
93
    /**
 
94
     * Sets the icon size for the widget explorer
 
95
     */
 
96
    void setIconSize(int size);
 
97
 
 
98
    /**
 
99
     * @return the icon size of the wiget explorer
 
100
     */
 
101
    int iconSize() const;
 
102
 
 
103
Q_SIGNALS:
 
104
    void locationChanged(Plasma::Location loc);
 
105
    void closeClicked();
 
106
 
 
107
public Q_SLOTS:
 
108
    /**
 
109
     * Adds currently selected applets
 
110
     */
 
111
    void addApplet();
 
112
 
 
113
    /**
 
114
     * Adds applet
 
115
     */
 
116
    void addApplet(PlasmaAppletItem *appletItem);
 
117
 
 
118
protected Q_SLOTS:
 
119
    void immutabilityChanged(Plasma::ImmutabilityType);
 
120
 
 
121
protected:
 
122
    void keyPressEvent(QKeyEvent *e);
 
123
    bool event(QEvent *e);
 
124
    void focusInEvent(QFocusEvent * event);
 
125
 
 
126
private:
 
127
    Q_PRIVATE_SLOT(d, void appletAdded(Plasma::Applet*))
 
128
    Q_PRIVATE_SLOT(d, void appletRemoved(Plasma::Applet*))
 
129
    Q_PRIVATE_SLOT(d, void containmentDestroyed())
 
130
 
 
131
    WidgetExplorerPrivate * const d;
 
132
};
 
133
 
 
134
} // namespace Plasma
 
135
 
 
136
#endif // WIDGETEXPLORER_H