2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
2017-08-25 17:11:29 +02:00
|
|
|
* Falkon - Qt web browser
|
2018-01-01 14:59:15 +01:00
|
|
|
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
|
2011-03-03 18:29:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2011-03-02 16:57:41 +01:00
|
|
|
#ifndef TABBAR_H
|
|
|
|
#define TABBAR_H
|
|
|
|
|
2013-11-26 14:14:36 +01:00
|
|
|
#include "combotabbar.h"
|
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-02-19 22:07:21 +01:00
|
|
|
class BrowserWindow;
|
2011-10-14 23:12:10 +02:00
|
|
|
class TabWidget;
|
2014-03-18 20:00:34 +01:00
|
|
|
class WebTab;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2017-08-25 17:11:29 +02:00
|
|
|
class FALKON_EXPORT TabBar : public ComboTabBar
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-02-19 22:07:21 +01:00
|
|
|
explicit TabBar(BrowserWindow* window, TabWidget* tabWidget);
|
2011-03-25 19:16:21 +01:00
|
|
|
|
|
|
|
void loadSettings();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-04-01 18:47:19 +02:00
|
|
|
TabWidget* tabWidget() const;
|
2011-10-24 17:46:45 +02:00
|
|
|
void setVisible(bool visible);
|
2015-10-18 15:56:12 +02:00
|
|
|
void setForceHidden(bool hidden);
|
2011-10-24 17:46:45 +02:00
|
|
|
|
2013-06-18 11:03:52 +02:00
|
|
|
void overrideTabTextColor(int index, QColor color);
|
|
|
|
void restoreTabTextColor(int index);
|
|
|
|
|
2014-03-18 20:00:34 +01:00
|
|
|
void setTabText(int index, const QString &text);
|
2012-09-03 22:40:52 +02:00
|
|
|
void updatePinnedTabCloseButton(int index);
|
|
|
|
|
2012-05-27 12:44:56 +02:00
|
|
|
void wheelEvent(QWheelEvent* event);
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
signals:
|
2011-10-23 14:44:18 +02:00
|
|
|
void moveAddTabButton(int posX);
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
private slots:
|
2012-04-09 14:09:40 +02:00
|
|
|
void currentTabChanged(int index);
|
2014-03-30 16:40:36 +02:00
|
|
|
void overflowChanged(bool overflowed);
|
2012-09-03 22:40:52 +02:00
|
|
|
void closeTabFromButton();
|
2011-03-25 19:16:21 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
private:
|
2012-09-03 22:40:52 +02:00
|
|
|
inline bool validIndex(int index) const { return index >= 0 && index < count(); }
|
|
|
|
|
2013-06-06 13:14:12 +02:00
|
|
|
void tabInserted(int index);
|
2012-09-05 19:57:36 +02:00
|
|
|
void tabRemoved(int index);
|
|
|
|
|
2012-09-03 22:40:52 +02:00
|
|
|
void hideCloseButton(int index);
|
|
|
|
void showCloseButton(int index);
|
|
|
|
|
2014-05-02 13:39:02 +02:00
|
|
|
void contextMenuEvent(QContextMenuEvent* event);
|
2012-03-05 13:16:34 +01:00
|
|
|
void mouseDoubleClickEvent(QMouseEvent* event);
|
2012-01-02 17:23:31 +01:00
|
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
void mouseMoveEvent(QMouseEvent* event);
|
2011-12-12 21:14:43 +01:00
|
|
|
void mouseReleaseEvent(QMouseEvent* event);
|
2012-03-05 13:16:34 +01:00
|
|
|
|
2012-03-05 11:30:18 +01:00
|
|
|
void dragEnterEvent(QDragEnterEvent* event);
|
2017-12-31 23:13:16 +01:00
|
|
|
void dragMoveEvent(QDragMoveEvent *event);
|
2018-01-01 14:59:15 +01:00
|
|
|
void dragLeaveEvent(QDragLeaveEvent *event);
|
2012-03-05 11:30:18 +01:00
|
|
|
void dropEvent(QDropEvent* event);
|
|
|
|
|
2013-11-26 14:14:36 +01:00
|
|
|
QSize tabSizeHint(int index, bool fast) const;
|
|
|
|
int comboTabBarPixelMetric(ComboTabBar::SizeType sizeType) const;
|
2014-03-18 20:00:34 +01:00
|
|
|
WebTab* webTab(int index = -1) const;
|
2011-10-23 14:44:18 +02:00
|
|
|
|
2014-02-19 22:07:21 +01:00
|
|
|
BrowserWindow* m_window;
|
2011-10-14 23:12:10 +02:00
|
|
|
TabWidget* m_tabWidget;
|
|
|
|
|
2013-06-06 13:14:12 +02:00
|
|
|
bool m_hideTabBarWithOneTab;
|
2014-02-23 14:54:22 +01:00
|
|
|
|
2014-02-23 14:49:32 +01:00
|
|
|
int m_showCloseOnInactive;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-04-21 22:19:35 +02:00
|
|
|
mutable int m_normalTabWidth;
|
2012-12-10 00:26:25 +01:00
|
|
|
mutable int m_activeTabWidth;
|
2011-12-29 21:50:03 +01:00
|
|
|
|
2013-06-18 11:03:52 +02:00
|
|
|
QColor m_originalTabTextColor;
|
2011-12-29 21:50:03 +01:00
|
|
|
QPoint m_dragStartPosition;
|
2015-10-18 15:56:12 +02:00
|
|
|
|
|
|
|
bool m_forceHidden;
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TABBAR_H
|