add more spacing
[personal-kdebase.git] / workspace / plasma / applets / tasks / tasks.h
blob96539076df9b499c0e261c45439a8a2a9fc5480c
1 /***************************************************************************
2 * Copyright (C) 2007 by Robert Knight <robertknight@gmail.com> *
3 * Copyright (C) 2008 by Alexis Ménard <darktears31@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 ***************************************************************************/
21 #ifndef TASKS_H
22 #define TASKS_H
24 // Own
25 #include "ui_tasksConfig.h"
27 // Qt
28 #include <QTimer>
29 #include <QSize>
31 // KDE
32 #include <taskmanager/taskmanager.h>
33 #include <taskmanager/abstractgroupableitem.h>
34 #include <taskmanager/groupmanager.h>
35 #include <taskmanager/taskitem.h>
36 #include <taskmanager/startup.h>
37 #include <KDialog>
39 // Plasma
40 #include <Plasma/Applet>
42 class QGraphicsLinearLayout;
44 class KColorScheme;
46 namespace Plasma
48 class LayoutAnimator;
49 class FrameSvg;
50 } // namespace Plasma
52 class WindowTaskItem;
53 class TaskGroupItem;
54 class AbstractTaskItem;
56 using TaskManager::StartupPtr;
57 using TaskManager::TaskPtr;
58 using TaskManager::StartupPtr;
59 using TaskManager::GroupPtr;
60 using TaskManager::AbstractItemPtr;
61 using TaskManager::AbstractGroupableItem;
62 using TaskManager::GroupManager;
63 using TaskManager::TaskItem;
64 using TaskManager::TaskGroup;
66 /**
67 * An applet which provides a visual representation of running
68 * graphical tasks (ie. tasks that have some form of visual interface),
69 * and allows the user to perform various actions on those tasks such
70 * as bringing them to the foreground, sending them to the background
71 * or closing them.
73 class Tasks : public Plasma::Applet
75 Q_OBJECT
76 public:
77 /**
78 * Constructs a new tasks applet
79 * With the specified parent.
81 explicit Tasks(QObject *parent, const QVariantList &args = QVariantList());
82 ~Tasks();
84 void init();
86 void constraintsEvent(Plasma::Constraints constraints);
88 Plasma::FrameSvg *itemBackground();
89 KColorScheme *colorScheme();
91 qreal itemLeftMargin() { return m_leftMargin; }
92 qreal itemRightMargin() { return m_rightMargin; }
93 qreal itemTopMargin() { return m_topMargin; }
94 qreal itemBottomMargin() { return m_bottomMargin; }
95 void resizeItemBackground(const QSizeF &newSize);
97 TaskGroupItem* rootGroupItem();
99 TaskManager::GroupManager &groupManager() const;
101 Qt::KeyboardModifiers groupModifierKey() const;
103 bool showTooltip() const;
106 signals:
108 * emitted whenever we receive a constraintsEvent
110 void constraintsChanged(Plasma::Constraints);
112 void desktopChanged(int,int);
113 void settingsChanged();
115 protected slots:
116 void configAccepted();
117 void themeRefresh();
119 protected:
120 void createConfigurationInterface(KConfigDialog *parent);
121 QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
122 void adjustGroupingStrategy();
124 private slots:
126 * Somthing has changed in the tree of the GroupingStrategy
128 void reload();
129 //void groupRemoved(TaskGroup *item);
130 void changeSizeHint(Qt::SizeHint which);
131 void dialogGroupingChanged(int index);
133 private:
134 bool m_showTooltip;
135 Plasma::LayoutAnimator *m_animator;
136 QGraphicsLinearLayout *layout;
138 Ui::tasksConfig m_ui;
139 QTimer m_screenTimer;
141 Plasma::FrameSvg *m_taskItemBackground;
142 KColorScheme *m_colorScheme;
143 qreal m_leftMargin;
144 qreal m_topMargin;
145 qreal m_rightMargin;
146 qreal m_bottomMargin;
148 TaskGroupItem *m_rootGroupItem;
149 GroupManager *m_groupManager;
150 TaskManager::GroupManager::TaskGroupingStrategy m_groupingStrategy;
151 bool m_groupWhenFull;
152 Qt::KeyboardModifier m_groupModifierKey;
154 int m_currentDesktop;
158 #endif