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

« back to all changes in this revision

Viewing changes to plasma/desktop/shell/toolbox/internaltoolbox_p.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 Aaron Seigo <aseigo@kde.org>
 
3
 *   Copyright 2008 by Marco Martin <notmart@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 General Public License as
 
7
 *   published by the Free Software Foundation; either version 2, or
 
8
 *   (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_INTERNALTOOLBOX_P_H
 
22
#define PLASMA_INTERNALTOOLBOX_P_H
 
23
 
 
24
#include <QGraphicsWidget>
 
25
 
 
26
#include <Plasma/Plasma>
 
27
#include <Plasma/Containment>
 
28
#include <Plasma/AbstractToolBox>
 
29
 
 
30
class QAction;
 
31
 
 
32
class KConfigGroup;
 
33
 
 
34
 
 
35
 
 
36
class IconWidget;
 
37
class InternalToolBoxPrivate;
 
38
 
 
39
class InternalToolBox : public Plasma::AbstractToolBox
 
40
{
 
41
    Q_OBJECT
 
42
    Q_INTERFACES(QGraphicsItem)
 
43
public:
 
44
    enum Corner {
 
45
        Top = 0,
 
46
        TopRight,
 
47
        TopLeft,
 
48
        Left,
 
49
        Right,
 
50
        Bottom,
 
51
        BottomRight,
 
52
        BottomLeft
 
53
    };
 
54
 
 
55
    explicit InternalToolBox(Plasma::Containment *parent);
 
56
    explicit InternalToolBox(QObject *parent = 0, const QVariantList &args = QVariantList());
 
57
    ~InternalToolBox();
 
58
 
 
59
    /**
 
60
     * create a toolbox tool from the given action
 
61
     * @p action the action to associate hte tool with
 
62
     */
 
63
    void addTool(QAction *action);
 
64
    /**
 
65
     * remove the tool associated with this action
 
66
     */
 
67
    void removeTool(QAction *action);
 
68
    bool isEmpty() const;
 
69
    int size() const;
 
70
    void setSize(const int newSize);
 
71
    QSize iconSize() const;
 
72
    void  setIconSize(const QSize newSize);
 
73
    bool isShowing() const;
 
74
    void setShowing(const bool show);
 
75
 
 
76
    virtual QGraphicsWidget *toolParent();
 
77
 
 
78
    virtual void setCorner(const Corner corner);
 
79
    virtual Corner corner() const;
 
80
 
 
81
    bool isMovable() const;
 
82
    void setIsMovable(bool movable);
 
83
 
 
84
    virtual QSize fullWidth() const;
 
85
    virtual QSize fullHeight() const;
 
86
    virtual QSize cornerSize() const;
 
87
    virtual void updateToolBox() {}
 
88
 
 
89
    void setIconic(bool iconic);
 
90
    bool iconic() const;
 
91
 
 
92
    virtual void showToolBox() = 0;
 
93
    virtual void hideToolBox() = 0;
 
94
 
 
95
    QList<QAction *> actions() const;
 
96
 
 
97
public Q_SLOTS:
 
98
    void save(KConfigGroup &cg) const;
 
99
    void restore(const KConfigGroup &containmentGroup);
 
100
    void reposition();
 
101
 
 
102
protected:
 
103
    Plasma::Containment *containment();
 
104
    QPoint toolPosition(int toolHeight);
 
105
 
 
106
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
 
107
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
 
108
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
109
 
 
110
protected Q_SLOTS:
 
111
    virtual void toolTriggered(bool);
 
112
    void actionDestroyed(QObject *object);
 
113
    void immutabilityChanged(Plasma::ImmutabilityType immutability);
 
114
 
 
115
private:
 
116
    InternalToolBoxPrivate *d;
 
117
};
 
118
 
 
119
 
 
120
 
 
121
#endif // PLASMA_INTERNALTOOLBOX_P_H
 
122