1 /* ============================================================ 2 * QuiteRSS is a open-source cross-platform RSS/Atom news feeds reader 3 * Copyright (C) 2011-2020 QuiteRSS Team <quiterssteam@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 <https://www.gnu.org/licenses/>. 17 * ============================================================ */ 18 #ifndef TABBAR_H 19 #define TABBAR_H 20 21 #ifdef HAVE_QT5 22 #include <QtWidgets> 23 #else 24 #include <QtGui> 25 #endif 26 27 class TabBar : public QTabBar 28 { 29 Q_OBJECT 30 public: 31 explicit TabBar(QWidget *parent = 0); 32 33 enum CloseTabsState { 34 CloseTabIdle = 0, 35 CloseTabCurrentIndex, 36 CloseTabOtherIndex 37 }; 38 39 CloseTabsState closingTabState_; 40 41 public slots: 42 void slotCloseTab(); 43 void slotCloseOtherTabs(); 44 void slotCloseAllTab(); 45 void slotNextTab(); 46 void slotPrevTab(); 47 48 signals: 49 void closeTab(int index); 50 51 protected: 52 bool eventFilter(QObject *obj, QEvent *ev); 53 54 private slots: 55 void showContextMenuTabBar(const QPoint &pos); 56 57 private: 58 int indexClickedTab_; 59 bool tabFixed_; 60 61 }; 62 63 #endif // TABBAR_H 64