Added missing param comments
[situare] / src / ui / tabbedpanel.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Kaj Wallin - kaj.wallin@ixonos.com
6         Pekka Nissinen - pekka.nissinen@ixonos.com
7
8     Situare is free software; you can redistribute it and/or
9     modify it under the terms of the GNU General Public License
10     version 2 as published by the Free Software Foundation.
11
12     Situare is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with Situare; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
20     USA.
21 */
22
23 #ifndef TABBEDPANEL_H
24 #define TABBEDPANEL_H
25
26 #include <QWidget>
27
28 #include "panelcommon.h"
29
30 class QPropertyAnimation;
31 class QSignalTransition;
32 class QState;
33 class QStateMachine;
34
35 class PanelBar;
36 class PanelContentStack;
37 class PanelTabBar;
38
39 /**
40  * @brief Class for tabbed panels
41  *
42  * @author Kaj Wallin - kaj.wallin (at) ixonos.com
43  * @author Pekka Nissinen - pekka.nissinen@ixonos.com
44  */
45 class TabbedPanel : public QWidget
46 {
47     Q_OBJECT
48
49 public:
50     /**
51      * @brief Constructor
52      *
53      * @param parent Parent
54      */
55     TabbedPanel(QWidget *parent = 0);
56
57 /*******************************************************************************
58  * MEMBER FUNCTIONS AND SLOTS
59  ******************************************************************************/
60 public:
61     /**
62      * @brief Adds a tab to the panel
63      *
64      * Adds a tab with the given widget and icon into the tabbed panel and returns the index of the
65      * inserted tab.
66      *
67      * @param widget Widget to be added into the tab
68      * @param icon Icon of the tab
69      */
70     int addTab(QWidget *widget, const QIcon& icon);
71
72     /**
73      * @brief Inserts a tab to the panel
74      *
75      * Inserts a tab with the given widget and icon into the tabbed panel at the specified index,
76      * and returns the index of the inserted tab.
77      *
78      * If index is out of range, the tab is simply appended. Otherwise it is inserted at the
79      * specified position.
80      *
81      * @param index Index of the tab
82      * @param widget Widget to be inserted into the tab
83      * @param icon Icon of the tab
84      */
85     int insertTab(int index, QWidget *widget, const QIcon& icon);
86
87     /**
88      * @brief Removes a tab from the panel
89      *
90      * Removes a tab and its widget from the panel at index position. The widget itself is not
91      * deleted.
92      *
93      * @param index Index of the tab
94      */
95     void removeTab(int index);
96
97 public slots:
98     /**
99      * @brief Slot that closes the panel
100      */
101     void closePanel();
102
103     /**
104      * @brief Slot that shows the tab (and opens it if closed) with the desired widget
105      *
106      * @param widget Widget
107      */
108     void showPanel(QWidget *widget);
109
110     /**
111      * @brief Slot to redraw the panel after window resize event
112      *
113      * @param size Size of the new window
114      */
115     void resizePanel(const QSize &size);
116
117 private slots:
118     /**
119      * @brief Sets the panel at current index active
120      *
121      * @param index Index of the panel
122      */
123     void setCurrentIndex(int index);
124
125     /**
126      * @brief Internal slot used to track statemachine state
127      */
128     void stateChanged();
129
130 /*******************************************************************************
131  * SIGNALS
132  ******************************************************************************/
133 signals:
134     /**
135      * @brief This signal is emitted whenever the current tab page changes
136      *
137      * @param index Index of the new tab page
138      */
139     void currentChanged(int index);
140
141     /**
142      * @brief Signal that is sent when panel is closed
143      *
144      * @sa openPanel
145      * @sa closePanel
146      */
147     void panelClosed();
148
149     /**
150      * @brief Signal that is sent when panel is opened
151      *
152      * @sa openPanel
153      * @sa closePanel
154      */
155     void panelOpened();
156
157     /**
158      * @brief Signal that is sent to state machine when panel state must be changed
159      *
160      * @sa openPanel
161      * @sa closePanel
162      */
163     void toggleState();
164
165 /*******************************************************************************
166  * DATA MEMBERS
167  ******************************************************************************/
168 private:
169     bool m_isOpen;      ///< Boolean used to track the current state of the statemachine
170
171     QPropertyAnimation *m_panelAnimation;       ///< Animation for panel state changes
172
173     QSignalTransition *m_panelTransitionClose;  ///< Transition signal for closing the panel
174     QSignalTransition *m_panelTransitionOpen;   ///< Transition signal for opening the panel
175
176     QState *m_panelStateClosed;                 ///< State of the closed panel
177     QState *m_panelStateOpened;                 ///< State of the opened panel
178
179     QStateMachine *m_panelStateMachine;         ///< State machine for sliding the panel
180
181     PanelBar *m_panelBar;                       ///< Widget for panel bar
182     PanelContentStack *m_panelContentStack;     ///< Stack for panel widgets
183     PanelTabBar *m_panelTabBar;                 ///< Widget for panel tab bar
184 };
185
186 #endif // TABBEDPANEL_H