• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • @topname@
  • Sitemap
  • Contact Us
 

superkaramba

taskmanager.h

00001 /*****************************************************************
00002 
00003 Copyright (c) 2000-2001 Matthias Elter <elter@kde.org>
00004 Copyright (c) 2001 Richard Moore <rich@kde.org>
00005 
00006 Permission is hereby granted, free of charge, to any person obtaining a copy
00007 of this software and associated documentation files (the "Software"), to deal
00008 in the Software without restriction, including without limitation the rights
00009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00010 copies of the Software, and to permit persons to whom the Software is
00011 furnished to do so, subject to the following conditions:
00012 
00013 The above copyright notice and this permission notice shall be included in
00014 all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00019 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00020 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00021 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00022 
00023 ******************************************************************/
00024 
00025 #ifndef __taskmanager_h__
00026 #define __taskmanager_h__
00027 
00028 #include <sys/types.h>
00029 
00030 #include <tqpoint.h>
00031 #include <tqobject.h>
00032 #include <tqvaluelist.h>
00033 #include <tqptrlist.h>
00034 #include <tqpixmap.h>
00035 
00036 #include <dcopobject.h>
00037 #include <kwin.h>
00038 #include <kstartupinfo.h>
00039 #include "karambaapp.h"
00040 
00041 class TaskManager;
00042 
00049 class Task: public QObject
00050 {
00051     Q_OBJECT
00052     Q_PROPERTY( TQString name READ name )
00053     Q_PROPERTY( TQString visibleName READ visibleName )
00054     Q_PROPERTY( TQString visibleNameWithState READ visibleNameWithState )
00055     Q_PROPERTY( TQString iconName READ iconName )
00056     Q_PROPERTY( TQString visibleIconName READ visibleIconName )
00057     Q_PROPERTY( TQPixmap pixmap READ pixmap )
00058     Q_PROPERTY( bool maximized READ isMaximized )
00059     Q_PROPERTY( bool iconified READ isIconified )
00060     Q_PROPERTY( bool shaded READ isShaded WRITE setShaded )
00061     Q_PROPERTY( bool active READ isActive )
00062     Q_PROPERTY( bool onCurrentDesktop READ isOnCurrentDesktop )
00063     Q_PROPERTY( bool onAllDesktops READ isOnAllDesktops )
00064     Q_PROPERTY( bool alwaysOnTop READ isAlwaysOnTop WRITE setAlwaysOnTop )
00065     Q_PROPERTY( bool modified READ isModified )
00066     Q_PROPERTY( int desktop READ desktop )
00067     Q_PROPERTY( double thumbnailSize READ thumbnailSize WRITE setThumbnailSize )
00068     Q_PROPERTY( bool hasThumbnail READ hasThumbnail )
00069     Q_PROPERTY( TQPixmap thumbnail READ thumbnail )
00070 
00071 public:
00072     Task( WId win, TaskManager * parent, const char *name = 0 );
00073     virtual ~Task();
00074 
00075     TaskManager* taskManager() const { return (TaskManager*) parent(); }
00076 
00077     WId window() const { return _win; }
00078 #ifdef KDE_3_2
00079     TQString name() const { return _info.name(); }
00080     TQString visibleName() const { return _info.visibleName(); }
00084     int desktop() const { return _info.desktop(); }
00085 #else
00086     TQString name() const { return _info.name; }
00087     TQString visibleName() const { return _info.visibleName; }
00091     int desktop() const { return _info.desktop; }
00092 #endif
00093     TQString visibleNameWithState() const { return _info.visibleNameWithState(); }
00094     TQString iconName() const;
00095     TQString visibleIconName() const;
00096     TQString className();
00097     TQString classClass();
00098 
00103     TQValueList<WId> transients() const { return _transients; }
00104 
00110     TQPixmap pixmap() const { return _pixmap; }
00111 
00126     TQPixmap bestIcon( int size, bool &isStaticIcon );
00127 
00137     TQPixmap icon( int width, int height, bool allowResize = false );
00138 
00143     static bool idMatch(const TQString &, const TQString &);
00144 
00145     // state
00146 
00150     bool isMaximized() const;
00151 
00155     bool isIconified() const;
00156 
00160     bool isShaded() const;
00161 
00165     bool isActive() const;
00166 
00171     bool isOnTop() const;
00172 
00176     bool isOnCurrentDesktop() const;
00177 
00181     bool isOnAllDesktops() const;
00182 
00187     bool isAlwaysOnTop() const;
00188 
00195     bool isModified() const ;
00196 
00197     // internal
00198 
00199     //* @internal
00200     void refresh(bool icon = false);
00201     //* @internal
00202     void addTransient( WId w ) { _transients.append( w ); }
00203     //* @internal
00204     void removeTransient( WId w ) { _transients.remove( w ); }
00205     //* @internal
00206     bool hasTransient( WId w ) const { return _transients.contains( w ); }
00207     //* @internal
00208     void setActive(bool a);
00209 
00210     // For thumbnails
00211 
00215     double thumbnailSize() const { return _thumbSize; }
00216 
00222     void setThumbnailSize( double size ) { _thumbSize = size; }
00223 
00228     bool hasThumbnail() const { return !_thumb.isNull(); }
00229 
00234     const TQPixmap &thumbnail() const { return _thumb; }
00235 
00236 public slots:
00237     // actions
00238 
00242     void maximize();
00243 
00247     void restore();
00248 
00252     void iconify();
00253 
00257     void close();
00258 
00262     void raise();
00263 
00267     void lower();
00268 
00272     void activate();
00273 
00279     void activateRaiseOrIconify();
00280 
00284     void setAlwaysOnTop(bool);
00285     void toggleAlwaysOnTop();
00286 
00291     void setShaded(bool);
00292     void toggleShaded();
00293 
00297     void toDesktop(int);
00298 
00302     void toCurrentDesktop();
00303 
00309     void publishIconGeometry(TQRect);
00310 
00315     void updateThumbnail();
00316 
00317 signals:
00321     void changed();
00322 
00326     void iconChanged();
00327 
00331     void activated();
00332 
00336     void deactivated();
00337 
00341     void thumbnailChanged();
00342 
00343 protected slots:
00344     //* @internal
00345     void generateThumbnail();
00346 
00347 private:
00348     bool                _active;
00349     WId                 _win;
00350     TQPixmap             _pixmap;
00351 #ifdef KDE_3_2
00352     KWin::WindowInfo    _info;
00353 #else
00354     KWin::Info          _info;
00355 #endif
00356     TQValueList<WId>     _transients;
00357 
00358     int                 _lastWidth;
00359     int                 _lastHeight;
00360     bool                _lastResize;
00361     TQPixmap             _lastIcon;
00362 
00363     double _thumbSize;
00364     TQPixmap _thumb;
00365     TQPixmap _grab;
00366 
00367     class TaskPrivate *d;
00368 };
00369 
00375 class Startup: public QObject
00376 {
00377     Q_OBJECT
00378     Q_PROPERTY( TQString text READ text )
00379     Q_PROPERTY( TQString bin READ bin )
00380     Q_PROPERTY( TQString icon READ icon )
00381 
00382 public:
00383     Startup( const KStartupInfoId& id, const KStartupInfoData& data, TQObject * parent,
00384         const char *name = 0);
00385     virtual ~Startup();
00386 
00390     TQString text() const { return _data.findName(); }
00391 
00395     TQString bin() const { return _data.bin(); }
00396 
00400     TQString icon() const { return _data.findIcon(); }
00401     void update( const KStartupInfoData& data );
00402     const KStartupInfoId& id() const { return _id; }
00403 
00404 signals:
00408     void changed();
00409 
00410 private:
00411     KStartupInfoId _id;
00412     KStartupInfoData _data;
00413     class StartupPrivate *d;
00414 };
00415 
00416 typedef TQPtrList<Task> TaskList;
00417 typedef TQPtrList<Startup> StartupList;
00418 
00419 
00430 class TaskManager : public QObject
00431 {
00432     Q_OBJECT
00433     Q_PROPERTY( int currentDesktop READ currentDesktop )
00434     Q_PROPERTY( int numberOfDesktops READ numberOfDesktops )
00435 
00436 public:
00437     TaskManager( TQObject *parent = 0, const char *name = 0 );
00438     virtual ~TaskManager();
00439 
00444     TaskList tasks() const { return _tasks; }
00445 
00450     StartupList startups() const { return _startups; }
00451 
00455     TQString desktopName(int n) const;
00456 
00460     int numberOfDesktops() const;
00461 
00465     int currentDesktop() const;
00466 
00470     bool isOnTop( const Task*);
00471 signals:
00475     void activeTaskChanged(Task*);
00476 
00480     void taskAdded(Task*);
00481 
00485     void taskRemoved(Task*);
00486 
00490     void startupAdded(Startup*);
00491 
00497     void startupRemoved(Startup*);
00498 
00502     void desktopChanged(int desktop);
00503 
00507     void windowChanged(WId);
00508 
00509 protected slots:
00510     //* @internal
00511     void windowAdded(WId);
00512     //* @internal
00513     void windowRemoved(WId);
00514     //* @internal
00515     void windowChanged(WId, unsigned int);
00516 
00517     //* @internal
00518     void activeWindowChanged(WId);
00519     //* @internal
00520     void currentDesktopChanged(int);
00521     //* @internal
00522     void killStartup( const KStartupInfoId& );
00523     //* @internal
00524     void killStartup(Startup*);
00525 
00526     //* @internal
00527     void gotNewStartup( const KStartupInfoId&, const KStartupInfoData& );
00528     //* @internal
00529     void gotStartupChange( const KStartupInfoId&, const KStartupInfoData& );
00530     //* @internal
00531     void gotRemoveStartup( const KStartupInfoId& );
00532 
00533 protected:
00537     Task* findTask(WId w);
00538     void configure_startup();
00539 
00540 private:
00541     Task*               _active;
00542     TaskList           _tasks;
00543     TQValueList< WId >   _skiptaskbar_windows;
00544     StartupList         _startups;
00545     KStartupInfo*       _startup_info;
00546 
00547     class TaskManagerPrivate *d;
00548 };
00549 
00550 #endif

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

@topname@

Skip menu "@topname@"
  • kcalc
  •   knumber
  • superkaramba
Generated for @topname@ by doxygen 1.5.6
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal