Show webfinger if displayName is unknown for an author.
[larjonas-pumpa.git] / src / tabwidget.h
blob422c7c3340ec4088677f96b1490caa46b16dde4a
1 /*
2 Copyright 2013-2015 Mats Sjöberg
4 This file is part of the Pumpa programme.
6 Pumpa is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Pumpa is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Pumpa. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef TABWIDGET_H
21 #define TABWIDGET_H
23 #include <QSet>
24 #include <QWidget>
25 #include <QTabBar>
26 #include <QTabWidget>
27 #include <QSignalMapper>
28 #include <QKeyEvent>
30 class TabWidget : public QTabWidget {
31 Q_OBJECT
33 public:
34 TabWidget(QWidget* parent=0);
36 int addTab(QWidget* page, const QString& label, bool highlight=true,
37 bool closable=false);
39 bool closable(int index) const { return m_okToClose.contains(index); }
41 QWidget* closeCurrentTab();
43 public slots:
44 void highlightTab(int index=-1);
46 void deHighlightTab(int index=-1);
48 protected slots:
49 void closeTab(int index);
51 protected:
52 virtual void keyPressEvent(QKeyEvent* event);
54 void addHighlightConnection(QWidget* page, int index);
56 QSignalMapper* m_sMap;
57 QSet<int> m_okToClose;
60 #endif