Sorted src.pro file, added new signals/slots for showing/opening panels/tabs
[situare] / src / ui / paneltabbar.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Pekka Nissinen - pekka.nissinen@ixonos.com
6
7     Situare is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License
9     version 2 as published by the Free Software Foundation.
10
11     Situare is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with Situare; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19     USA.
20 */
21
22 #ifndef PANELTABBAR_H
23 #define PANELTABBAR_H
24
25 #include <QWidget>
26
27 class QButtonGroup;
28
29 /**
30  * @brief Class for tab bar
31  *
32  * @author Pekka Nissinen - pekka.nissinen@ixonos.com
33  */
34 class PanelTabBar : public QWidget
35 {
36     Q_OBJECT
37
38 public:
39     /**
40      * @brief Constructor
41      *
42      * @param parent Parent
43      */
44     PanelTabBar(QWidget *parent = 0);
45
46 /*******************************************************************************
47  * MEMBER FUNCTIONS AND SLOTS
48  ******************************************************************************/
49 public:
50     /**
51      * @brief Adds a tab
52      *
53      * Adds a tab with icon and returns the index of the inserted tab
54      *
55      * @param icon Icon of the tab
56      */
57     int addTab(const QIcon& icon);
58
59     /**
60      * @brief Inserts a tab
61      *
62      * Inserts a tab with icon at the specified index and returns the index of the inserted tab.
63      * If index is out of range, the tab is appended.
64      *
65      * @param index Index of the tab
66      * @param icon Icon of the tab
67      */
68     int insertTab(int index, const QIcon& icon);
69
70     /**
71      * @brief Removes a tab
72      *
73      * Removes a tab at index position
74      *
75      * @todo: Fix tab drawing order
76      *
77      * @param index Index of the tab
78      */
79     void removeTab(int index);
80
81 public slots:
82     /**
83      * @brief This slot is used to clear tab selections
84      */
85     void deselectTabs();
86
87     /**
88      * @brief This slot selects a tab at given index
89      */
90     void selectTab(int index);
91
92 private slots:
93     /**
94      * @brief Sets the tab at current index active
95      *
96      * @param index Index of the tab
97      */
98     void setCurrentIndex(int index);
99
100 /*******************************************************************************
101  * SIGNALS
102  ******************************************************************************/
103 signals:
104     /**
105      * @brief This signal is emitted whenever the current tab index changes
106      */
107     void currentChanged(int index);
108
109     /**
110      * @brief This signal is emitted whenever user wants to close a tab
111      */
112     void tabCloseRequested(int index);
113
114 /*******************************************************************************
115  * DATA MEMBERS
116  ******************************************************************************/
117 private:
118     int m_activeTab;    ///< Index of a active tab
119
120     QButtonGroup *m_tabButtonGroup; ///< Button groub for tab buttons
121 };
122
123 #endif // PANELTABBAR_H