1 /* BEGIN_COMMON_COPYRIGHT_HEADER
2  * (c)LGPL2+
3  *
4  * LXQt - a lightweight, Qt based, desktop toolset
5  * https://lxqt.org
6  *
7  * Copyright: 2011 Razor team
8  *            2014 LXQt team
9  * Authors:
10  *   Alexander Sokoloff <sokoloff.a@gmail.com>
11  *   Maciej Płaza <plaza.maciej@gmail.com>
12  *   Kuzma Shapran <kuzma.shapran@gmail.com>
13  *
14  * This program or library is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2.1 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Lesser General Public License for more details.
23 
24  * You should have received a copy of the GNU Lesser General
25  * Public License along with this library; if not, write to the
26  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27  * Boston, MA 02110-1301 USA
28  *
29  * END_COMMON_COPYRIGHT_HEADER */
30 
31 #ifndef LXQTTASKPOPUP_H
32 #define LXQTTASKPOPUP_H
33 
34 #include <QHash>
35 #include <QFrame>
36 #include <QLayout>
37 #include <QTimer>
38 #include <QEvent>
39 
40 #include "lxqttaskbutton.h"
41 #include "lxqttaskgroup.h"
42 #include "lxqttaskbar.h"
43 
44 class LXQtGroupPopup: public QFrame
45 {
46     Q_OBJECT
47 
48 public:
49     LXQtGroupPopup(LXQtTaskGroup *group);
50     ~LXQtGroupPopup();
51 
52     void hide(bool fast = false);
53     void show();
54 
55     // Layout
indexOf(LXQtTaskButton * button)56     int indexOf(LXQtTaskButton *button) { return layout()->indexOf(button); }
count()57     int count() { return layout()->count(); }
itemAt(int i)58     QLayoutItem * itemAt(int i) { return layout()->itemAt(i); }
spacing()59     int spacing() { return layout()->spacing(); }
addButton(LXQtTaskButton * button)60     void addButton(LXQtTaskButton* button) { layout()->addWidget(button); }
removeWidget(QWidget * button)61     void removeWidget(QWidget *button) { layout()->removeWidget(button); }
62 
63 protected:
64     void dragEnterEvent(QDragEnterEvent * event);
65     void dragLeaveEvent(QDragLeaveEvent *event);
66     void dropEvent(QDropEvent * event);
67     void leaveEvent(QEvent * event);
68     void enterEvent(QEvent * event);
69     void paintEvent(QPaintEvent * event);
70 
71     void closeTimerSlot();
72 
73 private:
74     LXQtTaskGroup *mGroup;
75     QTimer mCloseTimer;
76 };
77 
78 #endif // LXQTTASKPOPUP_H
79