libtaskmanager
task.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 TASK_H
00026 #define TASK_H
00027
00028
00029 #include <QtGui/QDrag>
00030 #include <QtGui/QPixmap>
00031 #include <QtGui/QWidget>
00032
00033
00034 #include <ksharedptr.h>
00035 #include <kwindowsystem.h>
00036 #include <netwm.h>
00037
00038 namespace TaskManager
00039 {
00040
00041 typedef QList<WId> WindowList;
00042
00043 class Task;
00044 typedef KSharedPtr<Task> TaskPtr;
00045 typedef QVector<TaskPtr> TaskList;
00046 typedef QMap<WId, TaskPtr> TaskDict;
00047
00053 class KDE_EXPORT Task: public QObject, public KShared
00054 {
00055 Q_OBJECT
00056 Q_PROPERTY( QString visibleName READ visibleName )
00057 Q_PROPERTY( QString name READ name )
00058 Q_PROPERTY( QString className READ className )
00059 Q_PROPERTY( QString visibleNameWithState READ visibleNameWithState )
00060 Q_PROPERTY( QPixmap pixmap READ pixmap )
00061 Q_PROPERTY( bool maximized READ isMaximized )
00062 Q_PROPERTY( bool minimized READ isMinimized )
00063
00064 Q_PROPERTY( bool iconified READ isIconified )
00065 Q_PROPERTY( bool shaded READ isShaded WRITE setShaded )
00066 Q_PROPERTY( bool active READ isActive )
00067 Q_PROPERTY( bool onCurrentDesktop READ isOnCurrentDesktop )
00068 Q_PROPERTY( bool onAllDesktops READ isOnAllDesktops )
00069 Q_PROPERTY( bool alwaysOnTop READ isAlwaysOnTop WRITE setAlwaysOnTop )
00070 Q_PROPERTY( bool modified READ isModified )
00071 Q_PROPERTY( bool demandsAttention READ demandsAttention )
00072 Q_PROPERTY( int desktop READ desktop )
00073 Q_PROPERTY( double thumbnailSize READ thumbnailSize WRITE setThumbnailSize )
00074 Q_PROPERTY( bool hasThumbnail READ hasThumbnail )
00075 Q_PROPERTY( QPixmap thumbnail READ thumbnail )
00076
00077 public:
00078 Task(WId win, QObject *parent, const char *name = 0);
00079 virtual ~Task();
00080
00081 WId window() const;
00082 KWindowInfo info() const;
00083
00084 QString visibleName() const;
00085 QString visibleNameWithState() const;
00086 QString name() const;
00087 QString className();
00088 QString classClass();
00089
00094 WindowList transients() const;
00095
00101 QPixmap pixmap() const;
00102
00116 QPixmap bestIcon( int size, bool &isStaticIcon );
00117
00127 QPixmap icon( int width, int height, bool allowResize = false );
00128
00133 static bool idMatch(const QString &, const QString &);
00134
00135
00136
00140 bool isMaximized() const;
00141
00145 bool isMinimized() const;
00146
00151 bool isIconified() const;
00152
00156 bool isShaded() const;
00157
00161 bool isActive() const;
00162
00167 bool isOnTop() const;
00168
00172 bool isOnCurrentDesktop() const;
00173
00177 bool isOnAllDesktops() const;
00178
00183 bool isAlwaysOnTop() const;
00184
00189 bool isKeptBelowOthers() const;
00190
00194 bool isFullScreen() const;
00195
00202 bool isModified() const ;
00203
00207 int desktop() const;
00208
00212 bool demandsAttention() const;
00213
00214
00218 bool isOnScreen( int screen ) const;
00219
00223 bool showInTaskbar() const;
00224
00228 bool showInPager() const;
00229
00233 QRect geometry() const;
00234
00235
00236
00237
00238 void refresh(unsigned int dirty);
00239
00240 void refreshIcon();
00241
00242 void addTransient( WId w, const NETWinInfo& info );
00243
00244 void removeTransient( WId w );
00245
00246 bool hasTransient(WId w) const;
00247
00248 void updateDemandsAttentionState( WId w );
00249
00250 void setActive(bool a);
00251
00252
00253
00257 double thumbnailSize() const;
00258
00264 void setThumbnailSize( double size );
00265
00270 bool hasThumbnail() const;
00271
00276 QPixmap thumbnail() const;
00277
00278 QPixmap thumbnail(int maxDimension);
00279
00280 void updateWindowPixmap();
00281
00282 public Q_SLOTS:
00283
00284
00288 void setMaximized(bool);
00289 void toggleMaximized();
00290
00294 void restore();
00295
00299 void move();
00300
00304 void resize();
00305
00309 void setIconified(bool);
00310 void toggleIconified();
00311
00315 void close();
00316
00320 void raise();
00321
00325 void lower();
00326
00330 void activate();
00331
00337 void activateRaiseOrIconify();
00338
00342 void setAlwaysOnTop(bool);
00343 void toggleAlwaysOnTop();
00344
00348 void setKeptBelowOthers(bool);
00349 void toggleKeptBelowOthers();
00350
00354 void setFullScreen(bool);
00355 void toggleFullScreen();
00356
00361 void setShaded(bool);
00362 void toggleShaded();
00363
00367 void toDesktop(int);
00368
00372 void toCurrentDesktop();
00373
00379 void publishIconGeometry(QRect);
00380
00385 void updateThumbnail();
00386
00387 Q_SIGNALS:
00391 void changed();
00392
00396 void iconChanged();
00397
00401 void activated();
00402
00406 void deactivated();
00407
00411 void thumbnailChanged();
00412
00413 protected Q_SLOTS:
00414
00415 void generateThumbnail();
00416
00417 protected:
00418 void findWindowFrameId();
00419
00420 private:
00421 class Private;
00422 Private * const d;
00423 };
00424
00425
00431 class KDE_EXPORT TaskDrag : public QDrag
00432 {
00433 public:
00437 explicit TaskDrag(const TaskList& tasks, QWidget* source = 0);
00438 ~TaskDrag();
00439
00443 static bool canDecode( const QMimeData* e );
00444
00449 static TaskList decode( const QMimeData* e );
00450
00451 private:
00452 class Private;
00453 Private * const d;
00454 };
00455
00456 }
00457
00458
00459 #endif