~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy-backports

« back to all changes in this revision

Viewing changes to kicker/taskbar/taskbar.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-09-05 20:45:14 UTC
  • Revision ID: james.westby@ubuntu.com-20070905204514-632hhspl0nvrc84i
Tags: upstream-3.93.0
ImportĀ upstreamĀ versionĀ 3.93.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************
 
2
 
 
3
Copyright (c) 2001 Matthias Elter <elter@kde.org>
 
4
 
 
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:
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
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.
 
21
 
 
22
******************************************************************/
 
23
 
 
24
#ifndef __taskbar_h__
 
25
#define __taskbar_h__
 
26
 
 
27
#include <kpanelextension.h>
 
28
#include <taskmanager.h>
 
29
 
 
30
#include "taskcontainer.h"
 
31
#include "panner.h"
 
32
#include <QMouseEvent>
 
33
#include <QWheelEvent>
 
34
#include <QResizeEvent>
 
35
 
 
36
#define WINDOWLISTBUTTON_SIZE 15
 
37
#define BUTTON_MAX_WIDTH 200
 
38
#define BUTTON_MIN_WIDTH 20
 
39
 
 
40
class Startup;
 
41
class Task;
 
42
class KActionCollection;
 
43
class KShadowEngine;
 
44
class KWindowListMenu;
 
45
class SimpleButton;
 
46
class QBoxLayout;
 
47
 
 
48
class KDE_EXPORT TaskBar : public QWidget
 
49
{
 
50
    Q_OBJECT
 
51
 
 
52
public:
 
53
    TaskBar( QWidget *parent = 0 );
 
54
    ~TaskBar();
 
55
 
 
56
    QSize sizeHint() const;
 
57
    QSize sizeHint( Plasma::Position, QSize maxSize ) const;
 
58
 
 
59
    void setOrientation( Qt::Orientation );
 
60
    void setArrowType( Qt::ArrowType at );
 
61
 
 
62
    int containerCount() const;
 
63
    int taskCount() const;
 
64
    int showScreen() const;
 
65
 
 
66
    bool showIcon() const { return m_showIcon; }
 
67
    bool sortByDesktop() const { return m_sortByDesktop; }
 
68
    bool showAllWindows() const { return m_showAllWindows; }
 
69
 
 
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 );
 
74
    void preferences();
 
75
 
 
76
public Q_SLOTS:
 
77
    Q_SCRIPTABLE void configChanged();
 
78
    void configure();
 
79
    void showWindowListMenu();
 
80
    void windowListMenuAboutToHide();
 
81
    void reconnectWindowListButton();
 
82
 
 
83
Q_SIGNALS:
 
84
    void containerCountChanged();
 
85
 
 
86
protected Q_SLOTS:
 
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);
 
92
 
 
93
    void desktopChanged( int );
 
94
    void windowChanged(Task::TaskPtr);
 
95
    void windowChangedGeometry(Task::TaskPtr);
 
96
 
 
97
    void publishIconGeometry();
 
98
 
 
99
    void activateNextTask( bool forward );
 
100
    void slotActivateNextTask();
 
101
    void slotActivatePreviousTask();
 
102
    void slotSettingsChanged(int);
 
103
    void reLayout();
 
104
 
 
105
protected:
 
106
    void wheelEvent(QWheelEvent*);
 
107
    void resizeEvent( QResizeEvent* );
 
108
    bool idMatch( const QString& id1, const QString& id2 );
 
109
    TaskContainer::List filteredContainers();
 
110
 
 
111
private:
 
112
    void sortContainersByDesktop(TaskContainer::List& list);
 
113
 
 
114
    bool                        blocklayout;
 
115
    bool                        m_showAllWindows;
 
116
    // The screen to show, -1 for all screens
 
117
    int                         m_currentScreen;
 
118
    bool                        m_showOnlyCurrentScreen;
 
119
    bool                        m_sortByDesktop;
 
120
    bool                        m_showIcon;
 
121
    Qt::ArrowType               arrowType;
 
122
    TaskContainer::List         containers;
 
123
    TaskContainer::List         m_hiddenContainers;
 
124
    PixmapList                  frames;
 
125
    int                         maximumButtonsWithoutShrinking() const;
 
126
    bool                        shouldGroup() const;
 
127
    bool                        isGrouping;
 
128
    void                        reGroup();
 
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;
 
136
    Panner*                     m_container;
 
137
};
 
138
 
 
139
#endif