1
/*****************************************************************
3
Copyright (c) 2001 Matthias Elter <elter@kde.org>
5
Permission is hereby granted, free of charge, to any person obtaining a copy
6
of this software and associated documentation files (the "Software"), to deal
7
in the Software without restriction, including without limitation the rights
8
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
copies of the Software, and to permit persons to whom the Software is
10
furnished to do so, subject to the following conditions:
12
The above copyright notice and this permission notice shall be included in
13
all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
******************************************************************/
27
#include <kpanelextension.h>
28
#include <taskmanager.h>
30
#include "taskcontainer.h"
32
#include <QMouseEvent>
33
#include <QWheelEvent>
34
#include <QResizeEvent>
36
#define WINDOWLISTBUTTON_SIZE 15
37
#define BUTTON_MAX_WIDTH 200
38
#define BUTTON_MIN_WIDTH 20
42
class KActionCollection;
44
class KWindowListMenu;
48
class KDE_EXPORT TaskBar : public QWidget
53
TaskBar( QWidget *parent = 0 );
56
QSize sizeHint() const;
57
QSize sizeHint( Plasma::Position, QSize maxSize ) const;
59
void setOrientation( Qt::Orientation );
60
void setArrowType( Qt::ArrowType at );
62
int containerCount() const;
63
int taskCount() const;
64
int showScreen() const;
66
bool showIcon() const { return m_showIcon; }
67
bool sortByDesktop() const { return m_sortByDesktop; }
68
bool showAllWindows() const { return m_showAllWindows; }
70
void drawShadowText(QPainter &p, QRect tr, int tf, const QString & str,
71
int len = -1, QRect* brect = 0);
72
void orientationChange( Qt::Orientation );
73
void popupDirectionChange( Plasma::Position );
77
Q_SCRIPTABLE void configChanged();
79
void showWindowListMenu();
80
void windowListMenuAboutToHide();
81
void reconnectWindowListButton();
84
void containerCountChanged();
87
void add(Task::TaskPtr);
88
void add(Startup::StartupPtr);
89
void showTaskContainer(TaskContainer*);
90
void remove(Task::TaskPtr task, TaskContainer *container = 0);
91
void remove(Startup::StartupPtr startup, TaskContainer *container = 0);
93
void desktopChanged( int );
94
void windowChanged(Task::TaskPtr);
95
void windowChangedGeometry(Task::TaskPtr);
97
void publishIconGeometry();
99
void activateNextTask( bool forward );
100
void slotActivateNextTask();
101
void slotActivatePreviousTask();
102
void slotSettingsChanged(int);
106
void wheelEvent(QWheelEvent*);
107
void resizeEvent( QResizeEvent* );
108
bool idMatch( const QString& id1, const QString& id2 );
109
TaskContainer::List filteredContainers();
112
void sortContainersByDesktop(TaskContainer::List& list);
115
bool m_showAllWindows;
116
// The screen to show, -1 for all screens
118
bool m_showOnlyCurrentScreen;
119
bool m_sortByDesktop;
121
Qt::ArrowType arrowType;
122
TaskContainer::List containers;
123
TaskContainer::List m_hiddenContainers;
125
int maximumButtonsWithoutShrinking() const;
126
bool shouldGroup() const;
129
KActionCollection* keys;
130
KShadowEngine* m_textShadowEngine;
131
Plasma::Position m_direction;
132
bool m_showWindowListButton;
133
QBoxLayout * m_layout;
134
SimpleButton * m_windowListButton;
135
KWindowListMenu * m_windowListMenu;