]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphintabbar.h
Output of licensedigger + manual cleanup afterwards.
[dolphin.git] / src / dolphintabbar.h
1 /*
2 * SPDX-FileCopyrightText: 2014 Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef DOLPHIN_TAB_BAR_H
8 #define DOLPHIN_TAB_BAR_H
9
10 #include <QTabBar>
11
12 class DolphinTabBar : public QTabBar
13 {
14 Q_OBJECT
15
16 public:
17 explicit DolphinTabBar(QWidget* parent);
18
19 signals:
20 void openNewActivatedTab(int index);
21 void tabDropEvent(int index, QDropEvent* event);
22 void tabDetachRequested(int index);
23
24 protected:
25 void dragEnterEvent(QDragEnterEvent* event) override;
26 void dragLeaveEvent(QDragLeaveEvent* event) override;
27 void dragMoveEvent(QDragMoveEvent* event) override;
28 void dropEvent(QDropEvent* event) override;
29 void mousePressEvent(QMouseEvent* event) override;
30 void mouseReleaseEvent(QMouseEvent* event) override;
31 void mouseDoubleClickEvent(QMouseEvent* event) override;
32
33 /**
34 * Opens a context menu for the tab on the \a event position.
35 */
36 void contextMenuEvent(QContextMenuEvent* event) override;
37
38 private slots:
39 void slotAutoActivationTimeout();
40
41 private:
42 /**
43 * If \a index is a valid index (>= 0), store the index and start the timer
44 * (if the interval >= 0 ms). If the index is not valid (< 0), stop the timer.
45 */
46 void updateAutoActivationTimer(const int index);
47
48 private:
49 QTimer* m_autoActivationTimer;
50 int m_autoActivationIndex;
51 int m_tabToBeClosedOnMiddleMouseButtonRelease;
52 };
53
54 #endif // DOLPHIN_TAB_BAR_H