xref: /glogg/src/tabbedcrawlerwidget.h (revision 4006f1be24514f0a91d23b4b75207a1bd5461297) !
1093a1bf6SNicolas Bonnefon /*
2093a1bf6SNicolas Bonnefon  * Copyright (C) 2014 Nicolas Bonnefon and other contributors
3093a1bf6SNicolas Bonnefon  *
4093a1bf6SNicolas Bonnefon  * This file is part of glogg.
5093a1bf6SNicolas Bonnefon  *
6093a1bf6SNicolas Bonnefon  * glogg is free software: you can redistribute it and/or modify
7093a1bf6SNicolas Bonnefon  * it under the terms of the GNU General Public License as published by
8093a1bf6SNicolas Bonnefon  * the Free Software Foundation, either version 3 of the License, or
9093a1bf6SNicolas Bonnefon  * (at your option) any later version.
10093a1bf6SNicolas Bonnefon  *
11093a1bf6SNicolas Bonnefon  * glogg is distributed in the hope that it will be useful,
12093a1bf6SNicolas Bonnefon  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13093a1bf6SNicolas Bonnefon  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14093a1bf6SNicolas Bonnefon  * GNU General Public License for more details.
15093a1bf6SNicolas Bonnefon  *
16093a1bf6SNicolas Bonnefon  * You should have received a copy of the GNU General Public License
17093a1bf6SNicolas Bonnefon  * along with glogg.  If not, see <http://www.gnu.org/licenses/>.
18093a1bf6SNicolas Bonnefon  */
19093a1bf6SNicolas Bonnefon 
20093a1bf6SNicolas Bonnefon #ifndef TABBEDCRAWLERWIDGET_H
21093a1bf6SNicolas Bonnefon #define TABBEDCRAWLERWIDGET_H
22093a1bf6SNicolas Bonnefon 
23093a1bf6SNicolas Bonnefon #include <QTabWidget>
24093a1bf6SNicolas Bonnefon #include <QTabBar>
25093a1bf6SNicolas Bonnefon 
26093a1bf6SNicolas Bonnefon // This class represents glogg's main widget, a tabbed
27093a1bf6SNicolas Bonnefon // group of CrawlerWidgets.
28093a1bf6SNicolas Bonnefon // This is a very slightly customised QTabWidget, with
29333b2889SNicolas Bonnefon // a particular style.
30093a1bf6SNicolas Bonnefon class TabbedCrawlerWidget : public QTabWidget
31093a1bf6SNicolas Bonnefon {
32093a1bf6SNicolas Bonnefon   Q_OBJECT
33093a1bf6SNicolas Bonnefon     public:
34*4006f1beSNicolas Bonnefon       enum class DataStatus {
35*4006f1beSNicolas Bonnefon           OLD_DATA,
36*4006f1beSNicolas Bonnefon           NEW_DATA,
37*4006f1beSNicolas Bonnefon           NEW_FILTERED_DATA
38*4006f1beSNicolas Bonnefon       };
39*4006f1beSNicolas Bonnefon 
40333b2889SNicolas Bonnefon       TabbedCrawlerWidget();
41093a1bf6SNicolas Bonnefon       virtual ~TabbedCrawlerWidget() {}
42333b2889SNicolas Bonnefon 
43333b2889SNicolas Bonnefon       // "Overridden" addTab/removeTab that automatically
44333b2889SNicolas Bonnefon       // show/hide the tab bar
45*4006f1beSNicolas Bonnefon       // The tab is created with the 'old data' icon.
46333b2889SNicolas Bonnefon       int addTab( QWidget* page, const QString& label );
47333b2889SNicolas Bonnefon       void removeTab( int index );
48333b2889SNicolas Bonnefon 
49*4006f1beSNicolas Bonnefon       // Set the data status (icon) for the tab number 'index'
50*4006f1beSNicolas Bonnefon       void setTabDataStatus( int index, DataStatus status );
51*4006f1beSNicolas Bonnefon 
52f88e59a4SNicolas Bonnefon     protected:
53f88e59a4SNicolas Bonnefon       void keyPressEvent( QKeyEvent* event );
54045bfe08SGustav Andersson       void mouseReleaseEvent( QMouseEvent *event);
55f88e59a4SNicolas Bonnefon 
56093a1bf6SNicolas Bonnefon     private:
57093a1bf6SNicolas Bonnefon       QTabBar myTabBar_;
58093a1bf6SNicolas Bonnefon };
59093a1bf6SNicolas Bonnefon 
60093a1bf6SNicolas Bonnefon #endif
61