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

« back to all changes in this revision

Viewing changes to plasma/generic/applets/notifications/ui/notificationstack.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
 *   notificationscroller.h                                                *
 
3
 *   Copyright (C) 2010 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 General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, 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 General Public License     *
 
16
 *   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 NOTIFICATIONSTACK_H
 
22
#define NOTIFICATIONSTACK_H
 
23
 
 
24
#include <QGraphicsWidget>
 
25
 
 
26
class QGraphicsLinearLayout;
 
27
class QTimer;
 
28
 
 
29
class NotificationWidget;
 
30
 
 
31
class Notification;
 
32
 
 
33
class NotificationStack : public QGraphicsWidget
 
34
{
 
35
    Q_OBJECT
 
36
 
 
37
public:
 
38
    NotificationStack(QGraphicsItem *parent = 0);
 
39
    ~NotificationStack();
 
40
 
 
41
    void addNotification(Notification *notification);
 
42
 
 
43
    //TODO:accessor
 
44
    void setCurrentNotification(Notification *notification);
 
45
 
 
46
    NotificationWidget *currentNotificationWidget() const;
 
47
 
 
48
protected:
 
49
    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
 
50
    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
 
51
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
 
52
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
53
    bool eventFilter(QObject *watched, QEvent *event);
 
54
 
 
55
public Q_SLOTS:
 
56
    void removeNotification(Notification *notification);
 
57
    void delayedRemoveNotification(Notification *notification);
 
58
 
 
59
private Q_SLOTS:
 
60
    void popNotification();
 
61
    void notificationChanged(Notification *notification);
 
62
 
 
63
Q_SIGNALS:
 
64
    void stackEmpty();
 
65
    void updateRequested();
 
66
    void hideRequested();
 
67
    void showRequested();
 
68
 
 
69
private:
 
70
    QList<Notification *> m_notifications;
 
71
    QList<Notification *> m_notificationsToRemove;
 
72
    QHash<Notification *, NotificationWidget *> m_notificationWidgets;
 
73
    QGraphicsLinearLayout *m_mainLayout;
 
74
    int m_size;
 
75
    bool m_underMouse;
 
76
    QWeakPointer<NotificationWidget> m_currentNotificationWidget;
 
77
    QTimer *m_delayedRemoveTimer;
 
78
    QTimer *m_canDismissTimer;
 
79
};
 
80
 
 
81
#endif