~ubuntu-branches/ubuntu/lucid/kdebase/lucid

« back to all changes in this revision

Viewing changes to kicker/taskbar/taskcontainer.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-27 12:09:48 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20080527120948-dottsyd5rcwhzd36
Tags: 4:4.0.80-1ubuntu1
* Merge with Debian
 - remove 97_fix_target_link_libraries.diff
 - Add replaces/conflicts on -kde4 packages

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************
2
 
 
3
 
Copyright (c) 2001 Matthias Elter <elter@kde.org>
4
 
Copyright (c) 2002 John Firebaugh <jfirebaugh@kde.org>
5
 
 
6
 
Permission is hereby granted, free of charge, to any person obtaining a copy
7
 
of this software and associated documentation files (the "Software"), to deal
8
 
in the Software without restriction, including without limitation the rights
9
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 
copies of the Software, and to permit persons to whom the Software is
11
 
furnished to do so, subject to the following conditions:
12
 
 
13
 
The above copyright notice and this permission notice shall be included in
14
 
all copies or substantial portions of the Software.
15
 
 
16
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19
 
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20
 
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
 
 
23
 
******************************************************************/
24
 
 
25
 
#ifndef __taskcontainer_h__
26
 
#define __taskcontainer_h__
27
 
 
28
 
#include <qpixmap.h>
29
 
#include <qtimer.h>
30
 
#include <qtoolbutton.h>
31
 
 
32
 
#include "kickertip.h"
33
 
#include "taskmanager.h"
34
 
 
35
 
class TaskBar;
36
 
 
37
 
typedef QValueList<QPixmap*> PixmapList;
38
 
 
39
 
class TaskContainer : public QToolButton, public KickerTip::Client
40
 
{
41
 
    Q_OBJECT
42
 
 
43
 
public:
44
 
    typedef QValueList<TaskContainer*> List;
45
 
    typedef QValueList<TaskContainer*>::iterator Iterator;
46
 
 
47
 
    TaskContainer(Task::Ptr, TaskBar*, QWidget *parent = 0, const char *name = 0);
48
 
    TaskContainer(Startup::Ptr, PixmapList&, TaskBar*,
49
 
                  QWidget *parent = 0, const char *name = 0);
50
 
    virtual ~TaskContainer();
51
 
 
52
 
    void setArrowType( Qt::ArrowType at );
53
 
 
54
 
    void init();
55
 
 
56
 
    void add(Task::Ptr);
57
 
    void remove(Task::Ptr);
58
 
    void remove(Startup::Ptr);
59
 
 
60
 
    bool contains(Task::Ptr);
61
 
    bool contains(Startup::Ptr);
62
 
    bool contains(WId);
63
 
 
64
 
    bool isEmpty();
65
 
    bool onCurrentDesktop();
66
 
    bool isIconified();
67
 
    bool isOnScreen();
68
 
 
69
 
    QString id();
70
 
    int desktop();
71
 
    QString name();
72
 
 
73
 
    virtual QSizePolicy sizePolicy () const;
74
 
 
75
 
    void publishIconGeometry( QPoint );
76
 
    void desktopChanged( int );
77
 
    void windowChanged(Task::Ptr);
78
 
    void settingsChanged();
79
 
    bool eventFilter( QObject *o, QEvent *e );
80
 
 
81
 
    int taskCount() const { return tasks.count(); }
82
 
    int filteredTaskCount() const { return m_filteredTasks.count(); }
83
 
 
84
 
    bool activateNextTask( bool forward, bool& forcenext );
85
 
 
86
 
    void updateKickerTip(KickerTip::Data&);
87
 
 
88
 
    void finish();
89
 
 
90
 
signals:
91
 
    void showMe(TaskContainer*);
92
 
 
93
 
protected:
94
 
    void paintEvent(QPaintEvent*);
95
 
    void drawButton(QPainter*);
96
 
    void resizeEvent(QResizeEvent*);
97
 
    void mousePressEvent(QMouseEvent*);
98
 
    void mouseReleaseEvent(QMouseEvent*);
99
 
    void mouseMoveEvent(QMouseEvent*);
100
 
    void dragEnterEvent(QDragEnterEvent*);
101
 
    void dragLeaveEvent(QDragLeaveEvent*);
102
 
    void enterEvent(QEvent*);
103
 
    void leaveEvent(QEvent*);
104
 
    bool startDrag(const QPoint& pos);
105
 
    void stopTimers();
106
 
 
107
 
    void performAction(int);
108
 
    void popupMenu(int);
109
 
 
110
 
    void updateFilteredTaskList();
111
 
 
112
 
protected slots:
113
 
    void animationTimerFired();
114
 
    void attentionTimerFired();
115
 
    void dragSwitch();
116
 
    void iconChanged();
117
 
    void setLastActivated();
118
 
    void taskChanged(bool geometryChangeOnly);
119
 
    void showMe();
120
 
    void setPaintEventCompression();
121
 
 
122
 
private:
123
 
    void checkAttention(const Task::Ptr changed_task = NULL);
124
 
    QString                     sid;
125
 
    QTimer                      animationTimer;
126
 
    QTimer                      dragSwitchTimer;
127
 
    QTimer                      attentionTimer;
128
 
    QTimer                      m_paintEventCompressionTimer;
129
 
    int                         currentFrame;
130
 
    PixmapList                  frames;
131
 
    int                         attentionState;
132
 
    QRect                       iconRect;
133
 
    QPixmap                     animBg;
134
 
    Task::List                  tasks;
135
 
    Task::List                  m_filteredTasks;
136
 
    Task::Ptr                   lastActivated;
137
 
    QPopupMenu*                 m_menu;
138
 
    Startup::Ptr                m_startup;
139
 
    ArrowType                   arrowType;
140
 
    TaskBar*                    taskBar;
141
 
    bool                        discardNextMouseEvent;
142
 
    bool                        aboutToActivate;
143
 
    bool                        m_mouseOver;
144
 
    bool                        m_paintEventCompression;
145
 
    enum                        { ATTENTION_BLINK_TIMEOUT = 4 };
146
 
    QPoint                      m_dragStartPos;
147
 
};
148
 
 
149
 
#endif