• 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  Q_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  Q_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  Q_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

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