Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / libs / taskmanager / old / tasklmbmenu.h
blobcf43c23ecb565cc279b6b907d08ee3eb58fef8f9
1 /*****************************************************************
3 Copyright (c) 2001 Matthias Elter <elter@kde.org>
4 Copyright (c) 2002 John Firebaugh <jfirebaugh@kde.org>
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:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
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.
23 ******************************************************************/
25 #ifndef __tasklmbmenu_h__
26 #define __tasklmbmenu_h__
28 #include <QMenu>
29 #include <QTimer>
30 #include <QAction>
31 #include <QDragEnterEvent>
32 #include <QMouseEvent>
33 #include <QDragLeaveEvent>
34 #include <QDragMoveEvent>
35 #include <QList>
37 #include "taskmanager.h"
39 #ifdef __GNUC__
40 #warning "Need custom menu item support, which isn't there in Qt4!"
41 #endif
42 #if 0
43 class TaskMenuItem : public QCustomMenuItem
45 public:
46 TaskMenuItem(const QString &text,
47 bool active, bool minimized, bool attention);
48 ~TaskMenuItem();
50 void paint(QPainter*, const QColorGroup&, bool, bool, int, int, int, int);
51 QSize sizeHint();
52 void setAttentionState(bool state) { m_attentionState = state; }
54 private:
55 QString m_text;
56 bool m_isActive;
57 bool m_isMinimized;
58 bool m_demandsAttention;
59 bool m_attentionState;
61 #endif
63 typedef QAction TaskMenuItem;
66 /*****************************************************************************/
68 class KDE_EXPORT TaskLMBMenu : public QMenu
70 Q_OBJECT
72 public:
73 explicit TaskLMBMenu(const Task::List& list, QWidget *parent = 0, const char *name = 0);
75 protected Q_SLOTS:
76 void dragSwitch();
77 void attentionTimeout();
79 protected:
80 void dragEnterEvent(QDragEnterEvent*);
81 void dragLeaveEvent(QDragLeaveEvent*);
82 void dragMoveEvent(QDragMoveEvent*);
83 void mousePressEvent(QMouseEvent*);
84 void mouseMoveEvent(QMouseEvent*);
85 void mouseReleaseEvent(QMouseEvent*);
87 private:
88 void fillMenu();
90 Task::List m_tasks;
91 int m_lastDragId;
92 bool m_attentionState;
93 QTimer* m_attentionTimer;
94 QTimer* m_dragSwitchTimer;
95 QPoint m_dragStartPos;
96 QList<TaskMenuItem*> m_attentionMap;
99 #endif