libtaskmanager
taskmanager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef TASKMANAGER_H
00026 #define TASKMANAGER_H
00027
00028 #include <QtCore/QHash>
00029 #include <QtCore/QSet>
00030 #include <QtCore/QVector>
00031
00032 #include <KDE/KSharedPtr>
00033 #include <KDE/KWindowSystem>
00034
00035 class QUuid;
00036
00037 namespace TaskManager
00038 {
00039 typedef QSet<WId> WindowList;
00040
00041 class Task;
00042 typedef KSharedPtr<Task> TaskPtr;
00043 typedef QVector<TaskPtr> TaskList;
00044 typedef QHash<WId, TaskPtr> TaskDict;
00045
00046 class Startup;
00047 typedef KSharedPtr<Startup> StartupPtr;
00048 typedef QVector<StartupPtr> StartupList;
00049
00050 enum TaskChange { TaskUnchanged = 0,
00051 NameChanged = 1,
00052 StateChanged = 2,
00053 DesktopChanged = 32,
00054 GeometryChanged = 64,
00055 WindowTypeChanged = 128,
00056 ActionsChanged = 256,
00057 TransientsChanged = 512,
00058 IconChanged = 1024,
00059 ColorChanged = 2048,
00060 EverythingChanged = 0xffff
00061 };
00062 Q_DECLARE_FLAGS(TaskChanges, TaskChange)
00063 }
00064
00065
00066 #include <taskmanager/startup.h>
00067 #include <taskmanager/task.h>
00068 #include <taskmanager/taskmanager_export.h>
00069
00070 namespace TaskManager
00071 {
00072
00081 class TASKMANAGER_EXPORT TaskManager : public QObject
00082 {
00083 Q_OBJECT
00084 Q_PROPERTY( int currentDesktop READ currentDesktop )
00085 Q_PROPERTY( int numberOfDesktops READ numberOfDesktops )
00086
00087 public:
00088 static TaskManager* self();
00089
00090 TaskManager();
00091 ~TaskManager();
00092
00096 TaskPtr findTask(WId w);
00097
00101 TaskPtr findTask(int desktop, const QPoint& p);
00102
00106 TaskDict tasks() const;
00107
00111 StartupList startups() const;
00112
00116 QString desktopName(int n) const;
00117
00121 int numberOfDesktops() const;
00122
00126 int currentDesktop() const;
00127
00131 bool isOnTop(const Task*) const;
00132
00138 void setTrackGeometry(bool track, const QUuid &token);
00139
00143 bool trackGeometry() const;
00144
00148 static bool isOnScreen(int screen, const WId wid);
00149
00150 Q_SIGNALS:
00154 void taskAdded(TaskPtr);
00155
00159 void taskRemoved(TaskPtr);
00160
00164 void startupAdded(StartupPtr);
00165
00171 void startupRemoved(StartupPtr);
00172
00176 void desktopChanged(int desktop);
00177
00181 void windowChanged(TaskPtr task, ::TaskManager::TaskChanges change);
00182
00183 protected Q_SLOTS:
00184
00185 void windowAdded(WId);
00186
00187 void windowRemoved(WId);
00188
00189 void windowChanged(WId, unsigned int);
00190
00191
00192 void activeWindowChanged(WId);
00193
00194 void currentDesktopChanged(int);
00195
00196 void killStartup( const KStartupInfoId& );
00197
00198 void killStartup(StartupPtr);
00199
00200
00201 void gotNewStartup( const KStartupInfoId&, const KStartupInfoData& );
00202
00203 void gotStartupChange( const KStartupInfoId&, const KStartupInfoData& );
00204
00205
00206 void taskChanged(::TaskManager::TaskChanges changes);
00207
00208 protected:
00209 void configureStartup();
00210
00211 private:
00212 class Private;
00213 Private * const d;
00214 };
00215
00216 }
00217
00218 Q_DECLARE_OPERATORS_FOR_FLAGS(TaskManager::TaskChanges)
00219
00220 #endif