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

superkaramba

  • superkaramba
  • src
taskmanager.h
1 /*****************************************************************
2 
3 Copyright (c) 2000-2001 Matthias Elter <elter@kde.org>
4 Copyright (c) 2001 Richard Moore <rich@kde.org>
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 
23 ******************************************************************/
24 
25 #ifndef __taskmanager_h__
26 #define __taskmanager_h__
27 
28 #include <sys/types.h>
29 
30 #include <tqpoint.h>
31 #include <tqobject.h>
32 #include <tqvaluelist.h>
33 #include <tqptrlist.h>
34 #include <tqpixmap.h>
35 
36 #include <dcopobject.h>
37 #include <twin.h>
38 #include <tdestartupinfo.h>
39 #include "karambaapp.h"
40 
41 class TaskManager;
42 
49 class Task: public TQObject
50 {
51  TQ_OBJECT
52 
53  TQ_PROPERTY( TQString name READ name )
54  TQ_PROPERTY( TQString visibleName READ visibleName )
55  TQ_PROPERTY( TQString visibleNameWithState READ visibleNameWithState )
56  TQ_PROPERTY( TQString iconName READ iconName )
57  TQ_PROPERTY( TQString visibleIconName READ visibleIconName )
58  TQ_PROPERTY( TQPixmap pixmap READ pixmap )
59  TQ_PROPERTY( bool maximized READ isMaximized )
60  TQ_PROPERTY( bool iconified READ isIconified )
61  TQ_PROPERTY( bool shaded READ isShaded WRITE setShaded )
62  TQ_PROPERTY( bool active READ isActive )
63  TQ_PROPERTY( bool onCurrentDesktop READ isOnCurrentDesktop )
64  TQ_PROPERTY( bool onAllDesktops READ isOnAllDesktops )
65  TQ_PROPERTY( bool alwaysOnTop READ isAlwaysOnTop WRITE setAlwaysOnTop )
66  TQ_PROPERTY( bool modified READ isModified )
67  TQ_PROPERTY( int desktop READ desktop )
68  TQ_PROPERTY( double thumbnailSize READ thumbnailSize WRITE setThumbnailSize )
69  TQ_PROPERTY( bool hasThumbnail READ hasThumbnail )
70  TQ_PROPERTY( TQPixmap thumbnail READ thumbnail )
71 
72 public:
73  Task( WId win, TaskManager * parent, const char *name = 0 );
74  virtual ~Task();
75 
76  TaskManager* taskManager() const { return (TaskManager*) parent(); }
77 
78  WId window() const { return _win; }
79 #ifdef KDE_3_2
80  TQString name() const { return _info.name(); }
81  TQString visibleName() const { return _info.visibleName(); }
85  int desktop() const { return _info.desktop(); }
86 #else
87  TQString name() const { return _info.name; }
88  TQString visibleName() const { return _info.visibleName; }
92  int desktop() const { return _info.desktop; }
93 #endif
94  TQString visibleNameWithState() const { return _info.visibleNameWithState(); }
95  TQString iconName() const;
96  TQString visibleIconName() const;
97  TQString className();
98  TQString classClass();
99 
104  TQValueList<WId> transients() const { return _transients; }
105 
111  TQPixmap pixmap() const { return _pixmap; }
112 
127  TQPixmap bestIcon( int size, bool &isStaticIcon );
128 
138  TQPixmap icon( int width, int height, bool allowResize = false );
139 
144  static bool idMatch(const TQString &, const TQString &);
145 
146  // state
147 
151  bool isMaximized() const;
152 
156  bool isIconified() const;
157 
161  bool isShaded() const;
162 
166  bool isActive() const;
167 
172  bool isOnTop() const;
173 
177  bool isOnCurrentDesktop() const;
178 
182  bool isOnAllDesktops() const;
183 
188  bool isAlwaysOnTop() const;
189 
196  bool isModified() const ;
197 
198  // internal
199 
200  //* @internal
201  void refresh(bool icon = false);
202  //* @internal
203  void addTransient( WId w ) { _transients.append( w ); }
204  //* @internal
205  void removeTransient( WId w ) { _transients.remove( w ); }
206  //* @internal
207  bool hasTransient( WId w ) const { return _transients.contains( w ); }
208  //* @internal
209  void setActive(bool a);
210 
211  // For thumbnails
212 
216  double thumbnailSize() const { return _thumbSize; }
217 
223  void setThumbnailSize( double size ) { _thumbSize = size; }
224 
229  bool hasThumbnail() const { return !_thumb.isNull(); }
230 
235  const TQPixmap &thumbnail() const { return _thumb; }
236 
237 public slots:
238  // actions
239 
243  void maximize();
244 
248  void restore();
249 
253  void iconify();
254 
258  void close();
259 
263  void raise();
264 
268  void lower();
269 
273  void activate();
274 
280  void activateRaiseOrIconify();
281 
285  void setAlwaysOnTop(bool);
286  void toggleAlwaysOnTop();
287 
292  void setShaded(bool);
293  void toggleShaded();
294 
298  void toDesktop(int);
299 
303  void toCurrentDesktop();
304 
310  void publishIconGeometry(TQRect);
311 
316  void updateThumbnail();
317 
318 signals:
322  void changed();
323 
327  void iconChanged();
328 
332  void activated();
333 
337  void deactivated();
338 
342  void thumbnailChanged();
343 
344 protected slots:
345  //* @internal
346  void generateThumbnail();
347 
348 private:
349  bool _active;
350  WId _win;
351  TQPixmap _pixmap;
352 #ifdef KDE_3_2
353  KWin::WindowInfo _info;
354 #else
355  KWin::Info _info;
356 #endif
357  TQValueList<WId> _transients;
358 
359  int _lastWidth;
360  int _lastHeight;
361  bool _lastResize;
362  TQPixmap _lastIcon;
363 
364  double _thumbSize;
365  TQPixmap _thumb;
366  TQPixmap _grab;
367 
368  class TaskPrivate *d;
369 };
370 
376 class Startup: public TQObject
377 {
378  TQ_OBJECT
379 
380  TQ_PROPERTY( TQString text READ text )
381  TQ_PROPERTY( TQString bin READ bin )
382  TQ_PROPERTY( TQString icon READ icon )
383 
384 public:
385  Startup( const TDEStartupInfoId& id, const TDEStartupInfoData& data, TQObject * parent,
386  const char *name = 0);
387  virtual ~Startup();
388 
392  TQString text() const { return _data.findName(); }
393 
397  TQString bin() const { return _data.bin(); }
398 
402  TQString icon() const { return _data.findIcon(); }
403  void update( const TDEStartupInfoData& data );
404  const TDEStartupInfoId& id() const { return _id; }
405 
406 signals:
410  void changed();
411 
412 private:
413  TDEStartupInfoId _id;
414  TDEStartupInfoData _data;
415  class StartupPrivate *d;
416 };
417 
418 typedef TQPtrList<Task> TaskList;
419 typedef TQPtrList<Startup> StartupList;
420 
421 
432 class TaskManager : public TQObject
433 {
434  TQ_OBJECT
435 
436  TQ_PROPERTY( int currentDesktop READ currentDesktop )
437  TQ_PROPERTY( int numberOfDesktops READ numberOfDesktops )
438 
439 public:
440  TaskManager( TQObject *parent = 0, const char *name = 0 );
441  virtual ~TaskManager();
442 
447  TaskList tasks() const { return _tasks; }
448 
453  StartupList startups() const { return _startups; }
454 
458  TQString desktopName(int n) const;
459 
463  int numberOfDesktops() const;
464 
468  int currentDesktop() const;
469 
473  bool isOnTop( const Task*);
474 signals:
478  void activeTaskChanged(Task*);
479 
483  void taskAdded(Task*);
484 
488  void taskRemoved(Task*);
489 
493  void startupAdded(Startup*);
494 
500  void startupRemoved(Startup*);
501 
505  void desktopChanged(int desktop);
506 
510  void windowChanged(WId);
511 
512 protected slots:
513  //* @internal
514  void windowAdded(WId);
515  //* @internal
516  void windowRemoved(WId);
517  //* @internal
518  void windowChanged(WId, unsigned int);
519 
520  //* @internal
521  void activeWindowChanged(WId);
522  //* @internal
523  void currentDesktopChanged(int);
524  //* @internal
525  void killStartup( const TDEStartupInfoId& );
526  //* @internal
527  void killStartup(Startup*);
528 
529  //* @internal
530  void gotNewStartup( const TDEStartupInfoId&, const TDEStartupInfoData& );
531  //* @internal
532  void gotStartupChange( const TDEStartupInfoId&, const TDEStartupInfoData& );
533  //* @internal
534  void gotRemoveStartup( const TDEStartupInfoId& );
535 
536 protected:
540  Task* findTask(WId w);
541  void configure_startup();
542 
543 private:
544  Task* _active;
545  TaskList _tasks;
546  TQValueList< WId > _skiptaskbar_windows;
547  StartupList _startups;
548  TDEStartupInfo* _startup_info;
549 
550  class TaskManagerPrivate *d;
551 };
552 
553 #endif
Task::bestIcon
TQPixmap bestIcon(int size, bool &isStaticIcon)
Returns the best icon for any of the TDEIcon::StdSizes.
Definition: taskmanager.cpp:529
Task::setAlwaysOnTop
void setAlwaysOnTop(bool)
If true, the task&#39;s window will remain at the top of the stacking order.
Definition: taskmanager.cpp:723
Task::activateRaiseOrIconify
void activateRaiseOrIconify()
Perform the action that is most appropriate for this task.
Definition: taskmanager.cpp:676
Task::iconChanged
void iconChanged()
Indicates that the icon for this task has changed.
Task::changed
void changed()
Indicates that this task has changed in some way.
Task::thumbnailChanged
void thumbnailChanged()
Indicates that the thumbnail for this task has changed.
Task::maximize
void maximize()
Maximise the main window of this task.
Definition: taskmanager.cpp:621
Task::thumbnailSize
double thumbnailSize() const
Returns the current thumbnail size.
Definition: taskmanager.h:216
Task::transients
TQValueList< WId > transients() const
A list of the window ids of all transient windows (dialogs) associated with this task.
Definition: taskmanager.h:104
Task::activated
void activated()
Indicates that this task is now the active task.
Task::toDesktop
void toDesktop(int)
Moves the task&#39;s window to the specified virtual desktop.
Definition: taskmanager.cpp:687
Startup
Represents a task which is in the process of starting.
Definition: taskmanager.h:376
Task::isOnCurrentDesktop
bool isOnCurrentDesktop() const
Returns true if the task&#39;s window is on the current virtual desktop.
Definition: taskmanager.cpp:435
Task::isOnAllDesktops
bool isOnAllDesktops() const
Returns true if the task&#39;s window is on all virtual desktops.
Definition: taskmanager.cpp:444
Task::icon
TQPixmap icon(int width, int height, bool allowResize=false)
Tries to find an icon for the task with the specified size.
Definition: taskmanager.cpp:510
TaskManager
A generic API for task managers.
Definition: taskmanager.h:432
Task::isIconified
bool isIconified() const
Returns true if the task&#39;s window is iconified.
Definition: taskmanager.cpp:408
Task::thumbnail
const TQPixmap & thumbnail() const
Returns the thumbnail for this task (or a null image if there is none).
Definition: taskmanager.h:235
Task::isAlwaysOnTop
bool isAlwaysOnTop() const
Returns true if the task&#39;s window will remain at the top of the stacking order.
Definition: taskmanager.cpp:417
Task::isOnTop
bool isOnTop() const
Returns true if the task&#39;s window is the topmost non-iconified, non-always-on-top window...
Definition: taskmanager.cpp:458
Task::setShaded
void setShaded(bool)
If true then the task&#39;s window will be shaded.
Definition: taskmanager.cpp:737
Task::publishIconGeometry
void publishIconGeometry(TQRect)
This method informs the window manager of the location at which this task will be displayed when icon...
Definition: taskmanager.cpp:751
Task::isShaded
bool isShaded() const
Returns true if the task&#39;s window is shaded.
Definition: taskmanager.cpp:426
Task::desktop
int desktop() const
Returns the desktop on which this task&#39;s window resides.
Definition: taskmanager.h:92
Startup::icon
TQString icon() const
The name of the icon to be used for the starting task.
Definition: taskmanager.h:402
TaskManager::tasks
TaskList tasks() const
Returns a list of all current tasks.
Definition: taskmanager.h:447
Task::idMatch
static bool idMatch(const TQString &, const TQString &)
Returns true iff the windows with the specified ids should be grouped together in the task list...
Definition: taskmanager.cpp:606
Task::close
void close()
Activate the task&#39;s window.
Definition: taskmanager.cpp:651
Task::isModified
bool isModified() const
Returns true if the document the task is editing has been modified.
Definition: taskmanager.cpp:463
Task::hasThumbnail
bool hasThumbnail() const
Returns true if this task has a thumbnail.
Definition: taskmanager.h:229
TaskManager::startups
StartupList startups() const
Returns a list of all current startups.
Definition: taskmanager.h:453
Task::activate
void activate()
Activate the task&#39;s window.
Definition: taskmanager.cpp:669
Startup::bin
TQString bin() const
The name of the executable of the starting task.
Definition: taskmanager.h:397
Task::iconify
void iconify()
Iconify the task.
Definition: taskmanager.cpp:646
Task::updateThumbnail
void updateThumbnail()
Tells the task to generate a new thumbnail.
Definition: taskmanager.cpp:762
Startup::text
TQString text() const
The name of the starting task (if known).
Definition: taskmanager.h:392
Task::restore
void restore()
Restore the main window of the task (if it was iconified).
Definition: taskmanager.cpp:634
Task::deactivated
void deactivated()
Indicates that this task is no longer the active task.
Task::pixmap
TQPixmap pixmap() const
Returns a 16x16 (TDEIcon::Small) icon for the task.
Definition: taskmanager.h:111
Task::isActive
bool isActive() const
Returns true if the task&#39;s window is the active window.
Definition: taskmanager.cpp:453
Task::toCurrentDesktop
void toCurrentDesktop()
Moves the task&#39;s window to the current virtual desktop.
Definition: taskmanager.cpp:718
Task
A dynamic interface to a task (main window).
Definition: taskmanager.h:49
Task::setThumbnailSize
void setThumbnailSize(double size)
Sets the size for the window thumbnail.
Definition: taskmanager.h:223
Task::isMaximized
bool isMaximized() const
Returns true if the task&#39;s window is maximized.
Definition: taskmanager.cpp:399
Task::lower
void lower()
Lower the task&#39;s window.
Definition: taskmanager.cpp:663

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.8.13
This website is maintained by Timothy Pearson.