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

« back to all changes in this revision

Viewing changes to plasma/netbook/containments/sal/stripwidget.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 2009 by Artur Duque de Souza <morpheuz@gmail.com>
 
3
 *
 
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 version 2,
 
7
 *   or (at your option) any later version.
 
8
 *
 
9
 *   This program 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
 
12
 *   GNU General Public License for more details
 
13
 *
 
14
 *   You should have received a copy of the GNU Library General Public
 
15
 *   License along with this program; if not, write to the
 
16
 *   Free Software Foundation, Inc.,
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef STRIPWIDGET_H
 
21
#define STRIPWIDGET_H
 
22
 
 
23
 
 
24
#include <KConfigGroup>
 
25
#include <KService>
 
26
 
 
27
#include <QGraphicsLinearLayout>
 
28
#include <QGraphicsSceneResizeEvent>
 
29
#include <QGraphicsWidget>
 
30
 
 
31
 
 
32
#include <Plasma/RunnerContext>
 
33
 
 
34
#include "itemview.h"
 
35
 
 
36
namespace Plasma
 
37
{
 
38
    class IconWidget;
 
39
    class ToolButton;
 
40
}
 
41
 
 
42
class QTimer;
 
43
class IconActionCollection;
 
44
 
 
45
class FavouritesModel;
 
46
 
 
47
class StripWidget : public QGraphicsWidget
 
48
{
 
49
    Q_OBJECT
 
50
 
 
51
public:
 
52
    StripWidget(QGraphicsWidget *parent = 0);
 
53
    ~StripWidget();
 
54
 
 
55
    void save(KConfigGroup &cg);
 
56
    void restore(KConfigGroup &cg);
 
57
 
 
58
    void setIconSize(int iconSize);
 
59
    int iconSize() const;
 
60
 
 
61
    //TODO: geter and setter?
 
62
    void setImmutability(Plasma::ImmutabilityType immutability);
 
63
    void add(const QUrl &url);
 
64
 
 
65
protected:
 
66
    Plasma::IconWidget *createIcon(const QPointF &point);
 
67
    void focusInEvent(QFocusEvent *event);
 
68
    void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
 
69
    void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
 
70
    void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
 
71
    void dropEvent(QGraphicsSceneDragDropEvent *event);
 
72
 
 
73
private Q_SLOTS:
 
74
    void launchFavourite(const QModelIndex &index);
 
75
    void arrowsNeededChanged(ItemView::ScrollBarFlags flags);
 
76
    void goLeft();
 
77
    void goRight();
 
78
    void scrollTimeout();
 
79
    void reorderItem(const QModelIndex &index, const QPointF &point);
 
80
    void showDeleteTarget();
 
81
 
 
82
Q_SIGNALS:
 
83
    void saveNeeded();
 
84
 
 
85
private:
 
86
    Plasma::ToolButton *m_leftArrow;
 
87
    Plasma::ToolButton *m_rightArrow;
 
88
    QGraphicsLinearLayout *m_arrowsLayout;
 
89
 
 
90
    QHash<Plasma::IconWidget*, KService::Ptr> m_services;
 
91
    ItemView *m_itemView;
 
92
    Plasma::RunnerContext *m_context;
 
93
    QTimer *m_scrollTimer;
 
94
    Plasma::IconWidget *m_deleteTarget;
 
95
    IconActionCollection *m_iconActionCollection;
 
96
    int m_shownIcons;
 
97
    int m_offset;
 
98
    bool m_startupCompleted;
 
99
    FavouritesModel *m_favouritesModel;
 
100
};
 
101
 
 
102
#endif