2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@ixonos.com
6 Pekka Nissinen - pekka.nissinen@ixonos.com
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.
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.
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,
28 #include "panelcommon.h"
30 class QPropertyAnimation;
31 class QSignalTransition;
36 class PanelContentStack;
37 class PanelContextButtonBar;
41 * @brief Class for tabbed panels
43 * @author Kaj Wallin - kaj.wallin (at) ixonos.com
44 * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
46 class TabbedPanel : public QWidget
54 * @param parent Parent
56 TabbedPanel(QWidget *parent = 0);
58 /*******************************************************************************
59 * MEMBER FUNCTIONS AND SLOTS
60 ******************************************************************************/
63 * @brief Adds a tab to the panel
65 * Adds a tab with the given widget and icon into the tabbed panel and returns the index of the
68 * @param widget Widget to be added into the tab
69 * @param icon Icon of the tab
71 int addTab(QWidget *widget, const QIcon& icon);
74 * @brief Inserts a tab to the panel
76 * Inserts a tab with the given widget and icon into the tabbed panel at the specified index,
77 * and returns the index of the inserted tab.
79 * If index is out of range, the tab is simply appended. Otherwise it is inserted at the
82 * @param index Index of the tab
83 * @param widget Widget to be inserted into the tab
84 * @param icon Icon of the tab
86 int insertTab(int index, QWidget *widget, const QIcon& icon);
89 * @brief Removes a tab from the panel
91 * Removes a tab and its widget from the panel at index position. The widget itself is not
94 * @param index Index of the tab
96 void removeTab(int index);
99 * @brief Sets tabs enabled.
101 * If disabled tab is currently selected, panel will be closed also
102 * @param tabIndexes tab indexes to set
103 * @param enabled true if should be enabled, false otherwise
105 void setTabsEnabled(const QList<int> &tabIndexes, bool enabled);
109 * @brief Slot that closes the panel
114 * @brief Slot that opens the panel
116 * If widget pointer is provided the corresponding tab is also set active
118 * @param widget Widget
120 void openPanel(QWidget *widget = 0);
123 * @brief Slot to redraw the panel after window resize event
125 * @param size Size of the new window
127 void resizePanel(const QSize &size);
131 * @brief Calculates mask for tabbed panel
133 * Mask is constructed from PanelTabBar, PanelContextButtonBar and panel content sizes
135 void calculateMask();
138 * @brief Repositions context button bar
140 void repositionContextButtonBar();
143 * @brief Sets the panel at current index active
145 * @param index Index of the panel
147 void setCurrentIndex(int index);
150 * @brief Internal slot used to set the panel state
154 /*******************************************************************************
156 ******************************************************************************/
159 * @brief This signal is emitted whenever the current tab page changes
161 * @param index Index of the new tab page
163 void currentChanged(int index);
166 * @brief Signal that is sent when panel is closed
174 * @brief Signal that is sent when panel is opened
182 * @brief Signal that is sent when the panel state must be changed
189 /*******************************************************************************
191 ******************************************************************************/
193 bool m_open; ///< Current state of the panel
194 bool m_closeRequestPending; ///< Indicates wheater the panel is waiting to be closed
196 QState *m_stateClosed; ///< State of the closed panel
197 QState *m_stateOpened; ///< State of the opened panel
199 PanelBar *m_panelBar; ///< Widget for panel bar
200 PanelContentStack *m_panelContentStack; ///< Stack for panel widgets
201 PanelContextButtonBar * m_panelContextButtonBar; ///< Widget for panel context button bar
202 PanelTabBar *m_panelTabBar; ///< Widget for panel tab bar
205 #endif // TABBEDPANEL_H