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

« back to all changes in this revision

Viewing changes to plasma/netbook/containments/netpanel/panel.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 2007 by Alex Merry <alex.merry@kdemail.net>
 
3
*   Copyright 2008 by Alexis Ménard <darktears31@gmail.com>
 
4
*
 
5
*
 
6
*   This program is free software; you can redistribute it and/or modify
 
7
*   it under the terms of the GNU Library General Public License version 2,
 
8
*   or (at your option) any later version.
 
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 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
#ifndef PLASMA_PANEL_H
 
22
#define PLASMA_PANEL_H
 
23
 
 
24
#include <Plasma/Containment>
 
25
 
 
26
class QAction;
 
27
class QGraphicsLinearLayout;
 
28
class LinearAppletOverlay;
 
29
 
 
30
namespace Plasma
 
31
{
 
32
    class FrameSvg;
 
33
}
 
34
 
 
35
class Panel : public Plasma::Containment
 
36
{
 
37
    Q_OBJECT
 
38
    Q_PROPERTY(QString shadowPath READ shadowPath)
 
39
 
 
40
public:
 
41
    Panel(QObject *parent, const QVariantList &args);
 
42
    ~Panel();
 
43
    void init();
 
44
 
 
45
    void constraintsEvent(Plasma::Constraints constraints);
 
46
 
 
47
    void paintInterface(QPainter *painter,
 
48
                        const QStyleOptionGraphicsItem *option,
 
49
                        const QRect &contentsRect);
 
50
    void paintBackground(QPainter *painter, const QRect &contentsRect);
 
51
    QList<QAction *> contextualActions();
 
52
 
 
53
    QString shadowPath() {return "widgets/panel-background";}
 
54
 
 
55
protected:
 
56
    void saveState(KConfigGroup &config) const;
 
57
 
 
58
    void saveContents(KConfigGroup &group) const;
 
59
    void restore(KConfigGroup &group);
 
60
 
 
61
private Q_SLOTS:
 
62
    void toggleImmutability();
 
63
    void backgroundChanged();
 
64
    void layoutApplet(Plasma::Applet* applet, const QPointF &pos);
 
65
    void appletRemoved(Plasma::Applet* applet);
 
66
    void updateSize();
 
67
    void updateConfigurationMode(bool config);
 
68
    void overlayRequestedDrop(QGraphicsSceneDragDropEvent *event);
 
69
    void containmentAdded(Plasma::Containment *containment);
 
70
 
 
71
private:
 
72
    /**
 
73
     * update the formfactor based on the location
 
74
     */
 
75
    void setFormFactorFromLocation(Plasma::Location loc);
 
76
 
 
77
    /**
 
78
     * recalculate which borders to show
 
79
     */
 
80
    void updateBorders();
 
81
 
 
82
    Plasma::FrameSvg *m_background;
 
83
    QGraphicsLinearLayout *m_layout;
 
84
    LinearAppletOverlay *m_appletOverlay;
 
85
};
 
86
 
 
87
 
 
88
#endif // PLASMA_PANEL_H