• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • superkaramba
 

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 <twin.h>
00038 #include <tdestartupinfo.h>
00039 #include "karambaapp.h"
00040 
00041 class TaskManager;
00042 
00049 class Task: public TQObject
00050 {
00051     Q_OBJECT
00052   
00053     TQ_PROPERTY( TQString name READ name )
00054     TQ_PROPERTY( TQString visibleName READ visibleName )
00055     TQ_PROPERTY( TQString visibleNameWithState READ visibleNameWithState )
00056     TQ_PROPERTY( TQString iconName READ iconName )
00057     TQ_PROPERTY( TQString visibleIconName READ visibleIconName )
00058     TQ_PROPERTY( TQPixmap pixmap READ pixmap )
00059     TQ_PROPERTY( bool maximized READ isMaximized )
00060     TQ_PROPERTY( bool iconified READ isIconified )
00061     TQ_PROPERTY( bool shaded READ isShaded WRITE setShaded )
00062     TQ_PROPERTY( bool active READ isActive )
00063     TQ_PROPERTY( bool onCurrentDesktop READ isOnCurrentDesktop )
00064     TQ_PROPERTY( bool onAllDesktops READ isOnAllDesktops )
00065     TQ_PROPERTY( bool alwaysOnTop READ isAlwaysOnTop WRITE setAlwaysOnTop )
00066     TQ_PROPERTY( bool modified READ isModified )
00067     TQ_PROPERTY( int desktop READ desktop )
00068     TQ_PROPERTY( double thumbnailSize READ thumbnailSize WRITE setThumbnailSize )
00069     TQ_PROPERTY( bool hasThumbnail READ hasThumbnail )
00070     TQ_PROPERTY( TQPixmap thumbnail READ thumbnail )
00071 
00072 public:
00073     Task( WId win, TaskManager * parent, const char *name = 0 );
00074     virtual ~Task();
00075 
00076     TaskManager* taskManager() const { return (TaskManager*) parent(); }
00077 
00078     WId window() const { return _win; }
00079 #ifdef KDE_3_2
00080     TQString name() const { return _info.name(); }
00081     TQString visibleName() const { return _info.visibleName(); }
00085     int desktop() const { return _info.desktop(); }
00086 #else
00087     TQString name() const { return _info.name; }
00088     TQString visibleName() const { return _info.visibleName; }
00092     int desktop() const { return _info.desktop; }
00093 #endif
00094     TQString visibleNameWithState() const { return _info.visibleNameWithState(); }
00095     TQString iconName() const;
00096     TQString visibleIconName() const;
00097     TQString className();
00098     TQString classClass();
00099 
00104     TQValueList<WId> transients() const { return _transients; }
00105 
00111     TQPixmap pixmap() const { return _pixmap; }
00112 
00127     TQPixmap bestIcon( int size, bool &isStaticIcon );
00128 
00138     TQPixmap icon( int width, int height, bool allowResize = false );
00139 
00144     static bool idMatch(const TQString &, const TQString &);
00145 
00146     // state
00147 
00151     bool isMaximized() const;
00152 
00156     bool isIconified() const;
00157 
00161     bool isShaded() const;
00162 
00166     bool isActive() const;
00167 
00172     bool isOnTop() const;
00173 
00177     bool isOnCurrentDesktop() const;
00178 
00182     bool isOnAllDesktops() const;
00183 
00188     bool isAlwaysOnTop() const;
00189 
00196     bool isModified() const ;
00197 
00198     // internal
00199 
00200     //* @internal
00201     void refresh(bool icon = false);
00202     //* @internal
00203     void addTransient( WId w ) { _transients.append( w ); }
00204     //* @internal
00205     void removeTransient( WId w ) { _transients.remove( w ); }
00206     //* @internal
00207     bool hasTransient( WId w ) const { return _transients.contains( w ); }
00208     //* @internal
00209     void setActive(bool a);
00210 
00211     // For thumbnails
00212 
00216     double thumbnailSize() const { return _thumbSize; }
00217 
00223     void setThumbnailSize( double size ) { _thumbSize = size; }
00224 
00229     bool hasThumbnail() const { return !_thumb.isNull(); }
00230 
00235     const TQPixmap &thumbnail() const { return _thumb; }
00236 
00237 public slots:
00238     // actions
00239 
00243     void maximize();
00244 
00248     void restore();
00249 
00253     void iconify();
00254 
00258     void close();
00259 
00263     void raise();
00264 
00268     void lower();
00269 
00273     void activate();
00274 
00280     void activateRaiseOrIconify();
00281 
00285     void setAlwaysOnTop(bool);
00286     void toggleAlwaysOnTop();
00287 
00292     void setShaded(bool);
00293     void toggleShaded();
00294 
00298     void toDesktop(int);
00299 
00303     void toCurrentDesktop();
00304 
00310     void publishIconGeometry(TQRect);
00311 
00316     void updateThumbnail();
00317 
00318 signals:
00322     void changed();
00323 
00327     void iconChanged();
00328 
00332     void activated();
00333 
00337     void deactivated();
00338 
00342     void thumbnailChanged();
00343 
00344 protected slots:
00345     //* @internal
00346     void generateThumbnail();
00347 
00348 private:
00349     bool                _active;
00350     WId                 _win;
00351     TQPixmap             _pixmap;
00352 #ifdef KDE_3_2
00353     KWin::WindowInfo    _info;
00354 #else
00355     KWin::Info          _info;
00356 #endif
00357     TQValueList<WId>     _transients;
00358 
00359     int                 _lastWidth;
00360     int                 _lastHeight;
00361     bool                _lastResize;
00362     TQPixmap             _lastIcon;
00363 
00364     double _thumbSize;
00365     TQPixmap _thumb;
00366     TQPixmap _grab;
00367 
00368     class TaskPrivate *d;
00369 };
00370 
00376 class Startup: public TQObject
00377 {
00378     Q_OBJECT
00379   
00380     TQ_PROPERTY( TQString text READ text )
00381     TQ_PROPERTY( TQString bin READ bin )
00382     TQ_PROPERTY( TQString icon READ icon )
00383 
00384 public:
00385     Startup( const TDEStartupInfoId& id, const TDEStartupInfoData& data, TQObject * parent,
00386         const char *name = 0);
00387     virtual ~Startup();
00388 
00392     TQString text() const { return _data.findName(); }
00393 
00397     TQString bin() const { return _data.bin(); }
00398 
00402     TQString icon() const { return _data.findIcon(); }
00403     void update( const TDEStartupInfoData& data );
00404     const TDEStartupInfoId& id() const { return _id; }
00405 
00406 signals:
00410     void changed();
00411 
00412 private:
00413     TDEStartupInfoId _id;
00414     TDEStartupInfoData _data;
00415     class StartupPrivate *d;
00416 };
00417 
00418 typedef TQPtrList<Task> TaskList;
00419 typedef TQPtrList<Startup> StartupList;
00420 
00421 
00432 class TaskManager : public TQObject
00433 {
00434     Q_OBJECT
00435   
00436     TQ_PROPERTY( int currentDesktop READ currentDesktop )
00437     TQ_PROPERTY( int numberOfDesktops READ numberOfDesktops )
00438 
00439 public:
00440     TaskManager( TQObject *parent = 0, const char *name = 0 );
00441     virtual ~TaskManager();
00442 
00447     TaskList tasks() const { return _tasks; }
00448 
00453     StartupList startups() const { return _startups; }
00454 
00458     TQString desktopName(int n) const;
00459 
00463     int numberOfDesktops() const;
00464 
00468     int currentDesktop() const;
00469 
00473     bool isOnTop( const Task*);
00474 signals:
00478     void activeTaskChanged(Task*);
00479 
00483     void taskAdded(Task*);
00484 
00488     void taskRemoved(Task*);
00489 
00493     void startupAdded(Startup*);
00494 
00500     void startupRemoved(Startup*);
00501 
00505     void desktopChanged(int desktop);
00506 
00510     void windowChanged(WId);
00511 
00512 protected slots:
00513     //* @internal
00514     void windowAdded(WId);
00515     //* @internal
00516     void windowRemoved(WId);
00517     //* @internal
00518     void windowChanged(WId, unsigned int);
00519 
00520     //* @internal
00521     void activeWindowChanged(WId);
00522     //* @internal
00523     void currentDesktopChanged(int);
00524     //* @internal
00525     void killStartup( const TDEStartupInfoId& );
00526     //* @internal
00527     void killStartup(Startup*);
00528 
00529     //* @internal
00530     void gotNewStartup( const TDEStartupInfoId&, const TDEStartupInfoData& );
00531     //* @internal
00532     void gotStartupChange( const TDEStartupInfoId&, const TDEStartupInfoData& );
00533     //* @internal
00534     void gotRemoveStartup( const TDEStartupInfoId& );
00535 
00536 protected:
00540     Task* findTask(WId w);
00541     void configure_startup();
00542 
00543 private:
00544     Task*               _active;
00545     TaskList           _tasks;
00546     TQValueList< WId >   _skiptaskbar_windows;
00547     StartupList         _startups;
00548     TDEStartupInfo*       _startup_info;
00549 
00550     class TaskManagerPrivate *d;
00551 };
00552 
00553 #endif

superkaramba

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

superkaramba

Skip menu "superkaramba"
  • kcalc
  •   knumber
  • superkaramba
Generated for superkaramba by doxygen 1.6.3
This website is maintained by Timothy Pearson.