1
/*****************************************************************
3
Copyright (c) 2001 Matthias Elter <elter@kde.org>
4
Copyright (c) 2002 John Firebaugh <jfirebaugh@kde.org>
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:
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
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.
23
******************************************************************/
25
#ifndef __taskcontainer_h__
26
#define __taskcontainer_h__
30
#include <qtoolbutton.h>
32
#include "kickertip.h"
33
#include "taskmanager.h"
37
typedef QValueList<QPixmap*> PixmapList;
39
class TaskContainer : public QToolButton, public KickerTip::Client
44
typedef QValueList<TaskContainer*> List;
45
typedef QValueList<TaskContainer*>::iterator Iterator;
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();
52
void setArrowType( Qt::ArrowType at );
57
void remove(Task::Ptr);
58
void remove(Startup::Ptr);
60
bool contains(Task::Ptr);
61
bool contains(Startup::Ptr);
65
bool onCurrentDesktop();
73
virtual QSizePolicy sizePolicy () const;
75
void publishIconGeometry( QPoint );
76
void desktopChanged( int );
77
void windowChanged(Task::Ptr);
78
void settingsChanged();
79
bool eventFilter( QObject *o, QEvent *e );
81
int taskCount() const { return tasks.count(); }
82
int filteredTaskCount() const { return m_filteredTasks.count(); }
84
bool activateNextTask( bool forward, bool& forcenext );
86
void updateKickerTip(KickerTip::Data&);
91
void showMe(TaskContainer*);
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);
107
void performAction(int);
110
void updateFilteredTaskList();
113
void animationTimerFired();
114
void attentionTimerFired();
117
void setLastActivated();
118
void taskChanged(bool geometryChangeOnly);
120
void setPaintEventCompression();
123
void checkAttention(const Task::Ptr changed_task = NULL);
125
QTimer animationTimer;
126
QTimer dragSwitchTimer;
127
QTimer attentionTimer;
128
QTimer m_paintEventCompressionTimer;
135
Task::List m_filteredTasks;
136
Task::Ptr lastActivated;
138
Startup::Ptr m_startup;
141
bool discardNextMouseEvent;
142
bool aboutToActivate;
144
bool m_paintEventCompression;
145
enum { ATTENTION_BLINK_TIMEOUT = 4 };
146
QPoint m_dragStartPos;