xref: /glogg/src/tabbedcrawlerwidget.h (revision 45ef183cd93d6c0b14e535ca8e31874f61b2ffa4)
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 
26*45ef183cSNicolas Bonnefon #include "loadingstatus.h"
27*45ef183cSNicolas Bonnefon 
28093a1bf6SNicolas Bonnefon // This class represents glogg's main widget, a tabbed
29093a1bf6SNicolas Bonnefon // group of CrawlerWidgets.
30093a1bf6SNicolas Bonnefon // This is a very slightly customised QTabWidget, with
31333b2889SNicolas Bonnefon // a particular style.
32093a1bf6SNicolas Bonnefon class TabbedCrawlerWidget : public QTabWidget
33093a1bf6SNicolas Bonnefon {
34093a1bf6SNicolas Bonnefon   Q_OBJECT
35093a1bf6SNicolas Bonnefon     public:
36333b2889SNicolas Bonnefon       TabbedCrawlerWidget();
37093a1bf6SNicolas Bonnefon       virtual ~TabbedCrawlerWidget() {}
38333b2889SNicolas Bonnefon 
39333b2889SNicolas Bonnefon       // "Overridden" addTab/removeTab that automatically
40333b2889SNicolas Bonnefon       // show/hide the tab bar
414006f1beSNicolas Bonnefon       // The tab is created with the 'old data' icon.
42333b2889SNicolas Bonnefon       int addTab( QWidget* page, const QString& label );
43333b2889SNicolas Bonnefon       void removeTab( int index );
44333b2889SNicolas Bonnefon 
454006f1beSNicolas Bonnefon       // Set the data status (icon) for the tab number 'index'
464006f1beSNicolas Bonnefon       void setTabDataStatus( int index, DataStatus status );
474006f1beSNicolas Bonnefon 
48f88e59a4SNicolas Bonnefon     protected:
49f88e59a4SNicolas Bonnefon       void keyPressEvent( QKeyEvent* event );
50045bfe08SGustav Andersson       void mouseReleaseEvent( QMouseEvent *event);
51f88e59a4SNicolas Bonnefon 
52093a1bf6SNicolas Bonnefon     private:
53093a1bf6SNicolas Bonnefon       QTabBar myTabBar_;
54093a1bf6SNicolas Bonnefon };
55093a1bf6SNicolas Bonnefon 
56093a1bf6SNicolas Bonnefon #endif
57