not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / applets / tasks / windowtaskitem.h
blob306609c7cc6015c69058cba19bc3fe8eb3dc7a43
1 /***************************************************************************
2 * Copyright (C) 2007 by Robert Knight <robertknight@gmail.com> *
3 * Copyright (C) 2008 by Alexis Ménard <darktears31@gmail.com> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
19 ***************************************************************************/
22 #ifndef WINDOWTASKITEM_H
23 #define WINDOWTASKITEM_H
25 #include "abstracttaskitem.h"
26 // Own
27 #include <taskmanager/taskmanager.h>
28 #include <taskmanager/taskitem.h>
30 /**
31 * A task item for a task which represents a window on the desktop.
33 class WindowTaskItem : public AbstractTaskItem
35 Q_OBJECT
37 public:
38 /** Constructs a new representation for a window task. */
39 WindowTaskItem(QGraphicsWidget *parent, Tasks *applet, const bool showTooltip);
41 /** Sets the window/startup represented by this task. */
42 void setTask(TaskManager::TaskItem* taskItem);
44 /** Returns the window represented by this task. */
45 TaskManager::TaskPtr windowTask() const;
47 /** Tells the window manager the minimized task's geometry. */
48 void publishIconGeometry() const;
50 // used by the group; for efficiency this avoids multiple calls to
51 // AbstractTaskItem::iconScreenGeometry
52 void publishIconGeometry(const QRect &rect) const;
54 virtual bool isWindowItem() const;
55 virtual bool isActive() const;
56 virtual void setAdditionalMimeData(QMimeData* mimeData);
58 signals:
59 /** Emitted when a window is selected for activation, minimization, iconification */
60 //void windowSelected(WindowTaskItem *); //what is it for?
62 public slots:
63 void activate();
64 void close();
66 protected:
67 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
68 void mousePressEvent(QGraphicsSceneMouseEvent *event);
69 void updateToolTip();
71 private slots:
72 void updateTask(::TaskManager::TaskChanges changes);
73 void gotTaskPointer();
75 private:
76 /** Sets the starting task represented by this item. */
77 void setStartupTask(TaskManager::TaskItem* task);
79 /** Sets the window represented by this task. */
80 void setWindowTask(TaskManager::TaskItem* taskItem);
82 TaskManager::TaskItem *m_task;
85 #endif