Warning, file /network/falkon/src/lib/tabwidget/tabbar.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #ifndef TABBAR_H
0019 #define TABBAR_H
0020 
0021 #include <QPointer>
0022 
0023 #include "combotabbar.h"
0024 #include "qzcommon.h"
0025 
0026 class BrowserWindow;
0027 class TabWidget;
0028 class WebTab;
0029 
0030 class FALKON_EXPORT TabBar : public ComboTabBar
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit TabBar(BrowserWindow* window, TabWidget* tabWidget);
0035 
0036     void loadSettings();
0037 
0038     TabWidget* tabWidget() const;
0039     void setVisible(bool visible) override;
0040     void setForceHidden(bool hidden);
0041 
0042     void setTabText(int index, const QString &text);
0043 
0044     void wheelEvent(QWheelEvent* event) override;
0045 
0046     void setIsRestoring(bool restoring);
0047     bool isRestoring();
0048 
0049 Q_SIGNALS:
0050     void moveAddTabButton(int posX);
0051 
0052 private Q_SLOTS:
0053     void currentTabChanged(int index);
0054     void overflowChanged(bool overflowed);
0055     void closeTabFromButton();
0056 
0057 private:
0058     inline bool validIndex(int index) const { return index >= 0 && index < count(); }
0059 
0060     void tabInserted(int index) override;
0061     void tabRemoved(int index) override;
0062 
0063     void hideCloseButton(int index);
0064     void showCloseButton(int index);
0065     void updatePinnedTabCloseButton(int index);
0066 
0067     void contextMenuEvent(QContextMenuEvent* event) override;
0068     void mouseDoubleClickEvent(QMouseEvent* event) override;
0069     void mousePressEvent(QMouseEvent* event) override;
0070     void mouseMoveEvent(QMouseEvent* event) override;
0071     void mouseReleaseEvent(QMouseEvent* event) override;
0072 
0073     void dragEnterEvent(QDragEnterEvent* event) override;
0074     void dragMoveEvent(QDragMoveEvent *event) override;
0075     void dragLeaveEvent(QDragLeaveEvent *event) override;
0076     void dropEvent(QDropEvent* event) override;
0077 
0078     QSize tabSizeHint(int index, bool fast) const override;
0079     int comboTabBarPixelMetric(ComboTabBar::SizeType sizeType) const override;
0080     WebTab* webTab(int index = -1) const;
0081 
0082     BrowserWindow* m_window;
0083     TabWidget* m_tabWidget;
0084 
0085     bool m_hideTabBarWithOneTab;
0086 
0087     int m_showCloseOnInactive;
0088 
0089     mutable int m_normalTabWidth;
0090     mutable int m_activeTabWidth;
0091 
0092     QPoint m_dragStartPosition;
0093 
0094     bool m_forceHidden;
0095     QPointer<WebTab> m_lastTab;
0096 
0097     bool m_isRestoring = false;
0098 };
0099 
0100 #endif // TABBAR_H