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

superkaramba

  • superkaramba
  • src
taskmanager.h
1/*****************************************************************
2
3Copyright (c) 2000-2001 Matthias Elter <elter@kde.org>
4Copyright (c) 2001 Richard Moore <rich@kde.org>
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION 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
41class TaskManager;
42
49class 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
72public:
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
237public 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
318signals:
322 void changed();
323
327 void iconChanged();
328
332 void activated();
333
337 void deactivated();
338
342 void thumbnailChanged();
343
344protected slots:
345 //* @internal
346 void generateThumbnail();
347
348private:
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
376class 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
384public:
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
406signals:
410 void changed();
411
412private:
413 TDEStartupInfoId _id;
414 TDEStartupInfoData _data;
415 class StartupPrivate *d;
416};
417
418typedef TQPtrList<Task> TaskList;
419typedef TQPtrList<Startup> StartupList;
420
421
432class TaskManager : public TQObject
433{
434 TQ_OBJECT
435
436 TQ_PROPERTY( int currentDesktop READ currentDesktop )
437 TQ_PROPERTY( int numberOfDesktops READ numberOfDesktops )
438
439public:
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*);
474signals:
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
512protected 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
536protected:
540 Task* findTask(WId w);
541 void configure_startup();
542
543private:
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
Startup
Represents a task which is in the process of starting.
Definition: taskmanager.h:377
Startup::text
TQString text() const
The name of the starting task (if known).
Definition: taskmanager.h:392
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:402
Startup::bin
TQString bin() const
The name of the executable of the starting task.
Definition: taskmanager.h:397
TaskManager
A generic API for task managers.
Definition: taskmanager.h:433
TaskManager::numberOfDesktops
int numberOfDesktops() const
Returns the number of virtual desktops.
Definition: taskmanager.cpp:306
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:301
TaskManager::startups
StartupList startups() const
Returns a list of all current startups.
Definition: taskmanager.h:453
TaskManager::currentDesktop
int currentDesktop() const
Returns the number of the current desktop.
Definition: taskmanager.cpp:822
TaskManager::isOnTop
bool isOnTop(const Task *)
Returns true if the specified task is on top.
Definition: taskmanager.cpp:311
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:447
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::raise
void raise()
Raise the task's window.
Definition: taskmanager.cpp:657
Task::isActive
bool isActive() const
Returns true if the task's window is the active window.
Definition: taskmanager.cpp:453
Task::maximize
void maximize()
Maximise the main window of this task.
Definition: taskmanager.cpp:621
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::isOnAllDesktops
bool isOnAllDesktops() const
Returns true if the task's window is on all virtual desktops.
Definition: taskmanager.cpp:444
Task::isShaded
bool isShaded() const
Returns true if the task's window is shaded.
Definition: taskmanager.cpp:426
Task::pixmap
TQPixmap pixmap() const
Returns a 16x16 (TDEIcon::Small) icon for the task.
Definition: taskmanager.h:111
Task::activate
void activate()
Activate the task's window.
Definition: taskmanager.cpp:669
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::isModified
bool isModified() const
Returns true if the document the task is editing has been modified.
Definition: taskmanager.cpp:463
Task::lower
void lower()
Lower the task's window.
Definition: taskmanager.cpp:663
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:408
Task::toDesktop
void toDesktop(int)
Moves the task's window to the specified virtual desktop.
Definition: taskmanager.cpp:687
Task::isAlwaysOnTop
bool isAlwaysOnTop() const
Returns true if the task's window will remain at the top of the stacking order.
Definition: taskmanager.cpp:417
Task::isOnCurrentDesktop
bool isOnCurrentDesktop() const
Returns true if the task's window is on the current virtual desktop.
Definition: taskmanager.cpp:435
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:718
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:229
Task::activateRaiseOrIconify
void activateRaiseOrIconify()
Perform the action that is most appropriate for this task.
Definition: taskmanager.cpp:676
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::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:634
Task::bestIcon
TQPixmap bestIcon(int size, bool &isStaticIcon)
Returns the best icon for any of the TDEIcon::StdSizes.
Definition: taskmanager.cpp:529
Task::desktop
int desktop() const
Returns the desktop on which this task's window resides.
Definition: taskmanager.h:92
Task::thumbnailSize
double thumbnailSize() const
Returns the current thumbnail size.
Definition: taskmanager.h:216
Task::iconify
void iconify()
Iconify the task.
Definition: taskmanager.cpp:646
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
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:458
Task::setAlwaysOnTop
void setAlwaysOnTop(bool)
If true, the task's window will remain at the top of the stacking order.
Definition: taskmanager.cpp:723
Task::close
void close()
Activate the task's window.
Definition: taskmanager.cpp:651
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::setShaded
void setShaded(bool)
If true then the task's window will be shaded.
Definition: taskmanager.cpp:737
Task::updateThumbnail
void updateThumbnail()
Tells the task to generate a new thumbnail.
Definition: taskmanager.cpp:762
Task::isMaximized
bool isMaximized() const
Returns true if the task's window is maximized.
Definition: taskmanager.cpp:399
Task::setThumbnailSize
void setThumbnailSize(double size)
Sets the size for the window thumbnail.
Definition: taskmanager.h:223
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.4
This website is maintained by Timothy Pearson.