Falkon Develop
Cross-platform Qt-based web browser
tabbar.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2018 David Rosca <nowrep@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 3 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, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef TABBAR_H
19#define TABBAR_H
20
21#include <QPointer>
22
23#include "combotabbar.h"
24#include "qzcommon.h"
25
26class BrowserWindow;
27class TabWidget;
28class WebTab;
29
31{
32 Q_OBJECT
33public:
34 explicit TabBar(BrowserWindow* window, TabWidget* tabWidget);
35
36 void loadSettings();
37
38 TabWidget* tabWidget() const;
39 void setVisible(bool visible) override;
40 void setForceHidden(bool hidden);
41
42 void setTabText(int index, const QString &text);
43
44 void wheelEvent(QWheelEvent* event) override;
45
46 void setIsRestoring(bool restoring);
47 bool isRestoring();
48
49Q_SIGNALS:
50 void moveAddTabButton(int posX);
51
52private Q_SLOTS:
53 void currentTabChanged(int index);
54 void overflowChanged(bool overflowed);
55 void closeTabFromButton();
56
57private:
58 inline bool validIndex(int index) const { return index >= 0 && index < count(); }
59
60 void tabInserted(int index) override;
61 void tabRemoved(int index) override;
62
63 void hideCloseButton(int index);
64 void showCloseButton(int index);
65 void updatePinnedTabCloseButton(int index);
66
67 void contextMenuEvent(QContextMenuEvent* event) override;
68 void mouseDoubleClickEvent(QMouseEvent* event) override;
69 void mousePressEvent(QMouseEvent* event) override;
70 void mouseMoveEvent(QMouseEvent* event) override;
71 void mouseReleaseEvent(QMouseEvent* event) override;
72
73 void dragEnterEvent(QDragEnterEvent* event) override;
74 void dragMoveEvent(QDragMoveEvent *event) override;
75 void dragLeaveEvent(QDragLeaveEvent *event) override;
76 void dropEvent(QDropEvent* event) override;
77
78 QSize tabSizeHint(int index, bool fast) const override;
79 int comboTabBarPixelMetric(ComboTabBar::SizeType sizeType) const override;
80 WebTab* webTab(int index = -1) const;
81
82 BrowserWindow* m_window;
83 TabWidget* m_tabWidget;
84
85 bool m_hideTabBarWithOneTab;
86
87 int m_showCloseOnInactive;
88
89 mutable int m_normalTabWidth;
90 mutable int m_activeTabWidth;
91
92 QPoint m_dragStartPosition;
93
94 bool m_forceHidden;
95 QPointer<WebTab> m_lastTab;
96
97 bool m_isRestoring = false;
98};
99
100#endif // TABBAR_H
bool validIndex(int index) const
virtual int comboTabBarPixelMetric(SizeType sizeType) const
virtual void tabRemoved(int index)
virtual void tabInserted(int index)
virtual QSize tabSizeHint(int index, bool fast=false) const
void setTabText(int index, const QString &text)
void wheelEvent(QWheelEvent *event) override
Definition: tabbar.h:31
void moveAddTabButton(int posX)
Definition: webtab.h:40
#define FALKON_EXPORT
Definition: qzcommon.h:28