Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
tab-widget.hh
Go to the documentation of this file.
1 // Copyright (C) 2009-2011, Romain Goffe <romain.goffe@gmail.com>
2 // Copyright (C) 2009-2011, Alexandre Dupas <alexandre.dupas@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301, USA.
18 //******************************************************************************
19 
20 #ifndef __TAB_WIDGET_HH__
21 #define __TAB_WIDGET_HH__
22 
23 #include <QTabWidget>
24 #include <QTabBar>
25 #include <QString>
26 
44 class CTabWidget : public QTabWidget
45 {
46  Q_OBJECT
47  Q_ENUMS(SelectionBehavior)
51 
52 public:
60  };
61 
63  CTabWidget(QWidget *parent=0);
64 
66  virtual ~CTabWidget();
67 
73  int addTab(QWidget *widget);
74 
78  int addTab(QWidget *widget, const QString &label);
79 
85 
92 
93 public slots:
97  void closeTab();
98 
103  void closeTab(int index);
104 
108  void prev();
109 
113  void next();
114 
119  void changeTabText(const QString &text);
120 
121 protected:
127  void updateTabBarVisibility();
128 
129 private:
130  SelectionBehavior m_selectionBehaviorOnAdd;
131 };
132 
133 
144 class CTabBar : public QTabBar
145 {
146  Q_OBJECT
147 
148 public:
150  CTabBar(QWidget *parent=0);
152  ~CTabBar();
153 
154 protected:
159  virtual void mouseReleaseEvent(QMouseEvent *event);
160 };
161 
162 #endif // __TAB_WIDGET_HH__