• 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  TQString name() const { return _info.name(); }
80  TQString visibleName() const { return _info.visibleName(); }
84  int desktop() const { return _info.desktop(); }
85  TQString visibleNameWithState() const { return _info.visibleNameWithState(); }
86  TQString iconName() const;
87  TQString visibleIconName() const;
88  TQString className();
89  TQString classClass();
90 
95  TQValueList<WId> transients() const { return _transients; }
96 
102  TQPixmap pixmap() const { return _pixmap; }
103 
118  TQPixmap bestIcon( int size, bool &isStaticIcon );
119 
129  TQPixmap icon( int width, int height, bool allowResize = false );
130 
135  static bool idMatch(const TQString &, const TQString &);
136 
137  // state
138 
142  bool isMaximized() const;
143 
147  bool isIconified() const;
148 
152  bool isShaded() const;
153 
157  bool isActive() const;
158 
163  bool isOnTop() const;
164 
168  bool isOnCurrentDesktop() const;
169 
173  bool isOnAllDesktops() const;
174 
179  bool isAlwaysOnTop() const;
180 
187  bool isModified() const ;
188 
189  // internal
190 
191  //* @internal
192  void refresh(bool icon = false);
193  //* @internal
194  void addTransient( WId w ) { _transients.append( w ); }
195  //* @internal
196  void removeTransient( WId w ) { _transients.remove( w ); }
197  //* @internal
198  bool hasTransient( WId w ) const { return _transients.contains( w ); }
199  //* @internal
200  void setActive(bool a);
201 
202  // For thumbnails
203 
207  double thumbnailSize() const { return _thumbSize; }
208 
214  void setThumbnailSize( double size ) { _thumbSize = size; }
215 
220  bool hasThumbnail() const { return !_thumb.isNull(); }
221 
226  const TQPixmap &thumbnail() const { return _thumb; }
227 
228 public slots:
229  // actions
230 
234  void maximize();
235 
239  void restore();
240 
244  void iconify();
245 
249  void close();
250 
254  void raise();
255 
259  void lower();
260 
264  void activate();
265 
271  void activateRaiseOrIconify();
272 
276  void setAlwaysOnTop(bool);
277  void toggleAlwaysOnTop();
278 
283  void setShaded(bool);
284  void toggleShaded();
285 
289  void toDesktop(int);
290 
294  void toCurrentDesktop();
295 
301  void publishIconGeometry(TQRect);
302 
307  void updateThumbnail();
308 
309 signals:
313  void changed();
314 
318  void iconChanged();
319 
323  void activated();
324 
328  void deactivated();
329 
333  void thumbnailChanged();
334 
335 protected slots:
336  //* @internal
337  void generateThumbnail();
338 
339 private:
340  bool _active;
341  WId _win;
342  TQPixmap _pixmap;
343  KWin::WindowInfo _info;
344  TQValueList<WId> _transients;
345 
346  int _lastWidth;
347  int _lastHeight;
348  bool _lastResize;
349  TQPixmap _lastIcon;
350 
351  double _thumbSize;
352  TQPixmap _thumb;
353  TQPixmap _grab;
354 
355  class TaskPrivate *d;
356 };
357 
363 class Startup: public TQObject
364 {
365  TQ_OBJECT
366 
367  TQ_PROPERTY( TQString text READ text )
368  TQ_PROPERTY( TQString bin READ bin )
369  TQ_PROPERTY( TQString icon READ icon )
370 
371 public:
372  Startup( const TDEStartupInfoId& id, const TDEStartupInfoData& data, TQObject * parent,
373  const char *name = 0);
374  virtual ~Startup();
375 
379  TQString text() const { return _data.findName(); }
380 
384  TQString bin() const { return _data.bin(); }
385 
389  TQString icon() const { return _data.findIcon(); }
390  void update( const TDEStartupInfoData& data );
391  const TDEStartupInfoId& id() const { return _id; }
392 
393 signals:
397  void changed();
398 
399 private:
400  TDEStartupInfoId _id;
401  TDEStartupInfoData _data;
402  class StartupPrivate *d;
403 };
404 
405 typedef TQPtrList<Task> TaskList;
406 typedef TQPtrList<Startup> StartupList;
407 
408 
419 class TaskManager : public TQObject
420 {
421  TQ_OBJECT
422 
423  TQ_PROPERTY( int currentDesktop READ currentDesktop )
424  TQ_PROPERTY( int numberOfDesktops READ numberOfDesktops )
425 
426 public:
427  TaskManager( TQObject *parent = 0, const char *name = 0 );
428  virtual ~TaskManager();
429 
434  TaskList tasks() const { return _tasks; }
435 
440  StartupList startups() const { return _startups; }
441 
445  TQString desktopName(int n) const;
446 
450  int numberOfDesktops() const;
451 
455  int currentDesktop() const;
456 
460  bool isOnTop( const Task*);
461 signals:
465  void activeTaskChanged(Task*);
466 
470  void taskAdded(Task*);
471 
475  void taskRemoved(Task*);
476 
480  void startupAdded(Startup*);
481 
487  void startupRemoved(Startup*);
488 
492  void desktopChanged(int desktop);
493 
497  void windowChanged(WId);
498 
499 protected slots:
500  //* @internal
501  void windowAdded(WId);
502  //* @internal
503  void windowRemoved(WId);
504  //* @internal
505  void windowChanged(WId, unsigned int);
506 
507  //* @internal
508  void activeWindowChanged(WId);
509  //* @internal
510  void currentDesktopChanged(int);
511  //* @internal
512  void killStartup( const TDEStartupInfoId& );
513  //* @internal
514  void killStartup(Startup*);
515 
516  //* @internal
517  void gotNewStartup( const TDEStartupInfoId&, const TDEStartupInfoData& );
518  //* @internal
519  void gotStartupChange( const TDEStartupInfoId&, const TDEStartupInfoData& );
520  //* @internal
521  void gotRemoveStartup( const TDEStartupInfoId& );
522 
523 protected:
527  Task* findTask(WId w);
528  void configure_startup();
529 
530 private:
531  Task* _active;
532  TaskList _tasks;
533  TQValueList< WId > _skiptaskbar_windows;
534  StartupList _startups;
535  TDEStartupInfo* _startup_info;
536 
537  class TaskManagerPrivate *d;
538 };
539 
540 #endif
Startup
Represents a task which is in the process of starting.
Definition: taskmanager.h:364
Startup::text
TQString text() const
The name of the starting task (if known).
Definition: taskmanager.h:379
Startup::changed
void changed()
Indicates that this startup has changed in some way.
Startup::icon
TQString icon() const
The name of the icon to be used for the starting task.
Definition: taskmanager.h:389
Startup::bin
TQString bin() const
The name of the executable of the starting task.
Definition: taskmanager.h:384
TaskManager
A generic API for task managers.
Definition: taskmanager.h:420
TaskManager::numberOfDesktops
int numberOfDesktops() const
Returns the number of virtual desktops.
Definition: taskmanager.cpp:296
TaskManager::windowChanged
void windowChanged(WId)
Emitted when a window changes desktop.
TaskManager::findTask
Task * findTask(WId w)
Returns the task for a given WId, or 0 if there is no such task.
Definition: taskmanager.cpp:101
TaskManager::activeTaskChanged
void activeTaskChanged(Task *)
Emitted when the active window changed.
TaskManager::desktopName
TQString desktopName(int n) const
Returns the name of the nth desktop.
Definition: taskmanager.cpp:291
TaskManager::startups
StartupList startups() const
Returns a list of all current startups.
Definition: taskmanager.h:440
TaskManager::currentDesktop
int currentDesktop() const
Returns the number of the current desktop.
Definition: taskmanager.cpp:756
TaskManager::isOnTop
bool isOnTop(const Task *)
Returns true if the specified task is on top.
Definition: taskmanager.cpp:301
TaskManager::startupAdded
void startupAdded(Startup *)
Emitted when a new task is expected.
TaskManager::desktopChanged
void desktopChanged(int desktop)
Emitted when the current desktop changes.
TaskManager::startupRemoved
void startupRemoved(Startup *)
Emitted when a startup item should be removed.
TaskManager::tasks
TaskList tasks() const
Returns a list of all current tasks.
Definition: taskmanager.h:434
TaskManager::taskAdded
void taskAdded(Task *)
Emitted when a new task has started.
TaskManager::taskRemoved
void taskRemoved(Task *)
Emitted when a task has terminated.
Task
A dynamic interface to a task (main window).
Definition: taskmanager.h:50
Task::transients
TQValueList< WId > transients() const
A list of the window ids of all transient windows (dialogs) associated with this task.
Definition: taskmanager.h:95
Task::isActive
bool isActive() const
Returns true if the task's window is the active window.
Definition: taskmanager.cpp:411
Task::maximize
void maximize()
Maximise the main window of this task.
Definition: taskmanager.cpp:575
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:685
Task::isOnAllDesktops
bool isOnAllDesktops() const
Returns true if the task's window is on all virtual desktops.
Definition: taskmanager.cpp:406
Task::thumbnail
const TQPixmap & thumbnail() const
Returns the thumbnail for this task (or a null image if there is none).
Definition: taskmanager.h:226
Task::isShaded
bool isShaded() const
Returns true if the task's window is shaded.
Definition: taskmanager.cpp:396
Task::pixmap
TQPixmap pixmap() const
Returns a 16x16 (TDEIcon::Small) icon for the task.
Definition: taskmanager.h:102
Task::activate
void activate()
Activate the task's window.
Definition: taskmanager.cpp:615
Task::isModified
bool isModified() const
Returns true if the document the task is editing has been modified.
Definition: taskmanager.cpp:421
Task::lower
void lower()
Lower the task's window.
Definition: taskmanager.cpp:609
Task::iconChanged
void iconChanged()
Indicates that the icon for this task has changed.
Task::isIconified
bool isIconified() const
Returns true if the task's window is iconified.
Definition: taskmanager.cpp:386
Task::toDesktop
void toDesktop(int)
Moves the task's window to the specified virtual desktop.
Definition: taskmanager.cpp:633
Task::isAlwaysOnTop
bool isAlwaysOnTop() const
Returns true if the task's window will remain at the top of the stacking order.
Definition: taskmanager.cpp:391
Task::isOnCurrentDesktop
bool isOnCurrentDesktop() const
Returns true if the task's window is on the current virtual desktop.
Definition: taskmanager.cpp:401
Task::thumbnailChanged
void thumbnailChanged()
Indicates that the thumbnail for this task has changed.
Task::toCurrentDesktop
void toCurrentDesktop()
Moves the task's window to the current virtual desktop.
Definition: taskmanager.cpp:652
Task::activated
void activated()
Indicates that this task is now the active task.
Task::hasThumbnail
bool hasThumbnail() const
Returns true if this task has a thumbnail.
Definition: taskmanager.h:220
Task::activateRaiseOrIconify
void activateRaiseOrIconify()
Perform the action that is most appropriate for this task.
Definition: taskmanager.cpp:622
Task::changed
void changed()
Indicates that this task has changed in some way.
Task::restore
void restore()
Restore the main window of the task (if it was iconified).
Definition: taskmanager.cpp:584
Task::bestIcon
TQPixmap bestIcon(int size, bool &isStaticIcon)
Returns the best icon for any of the TDEIcon::StdSizes.
Definition: taskmanager.cpp:483
Task::desktop
int desktop() const
Returns the desktop on which this task's window resides.
Definition: taskmanager.h:84
Task::thumbnailSize
double thumbnailSize() const
Returns the current thumbnail size.
Definition: taskmanager.h:207
Task::iconify
void iconify()
Iconify the task.
Definition: taskmanager.cpp:592
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:464
Task::isOnTop
bool isOnTop() const
Returns true if the task's window is the topmost non-iconified, non-always-on-top window.
Definition: taskmanager.cpp:416
Task::setAlwaysOnTop
void setAlwaysOnTop(bool)
If true, the task's window will remain at the top of the stacking order.
Definition: taskmanager.cpp:657
Task::close
void close()
Activate the task's window.
Definition: taskmanager.cpp:597
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:560
Task::setShaded
void setShaded(bool)
If true then the task's window will be shaded.
Definition: taskmanager.cpp:671
Task::updateThumbnail
void updateThumbnail()
Tells the task to generate a new thumbnail.
Definition: taskmanager.cpp:696
Task::isMaximized
bool isMaximized() const
Returns true if the task's window is maximized.
Definition: taskmanager.cpp:381
Task::setThumbnailSize
void setThumbnailSize(double size)
Sets the size for the window thumbnail.
Definition: taskmanager.h:214
Task::deactivated
void deactivated()
Indicates that this task is no longer the active task.

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