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;
35 class ListItemContextButtonBar;
37 class PanelContentStack;
38 class PanelContextButtonBar;
42 * @brief Class for tabbed panels
44 * @author Kaj Wallin - kaj.wallin (at) ixonos.com
45 * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
47 class TabbedPanel : public QWidget
55 * @param parent Parent
57 TabbedPanel(QWidget *parent = 0);
59 /*******************************************************************************
60 * MEMBER FUNCTIONS AND SLOTS
61 ******************************************************************************/
64 * @brief Adds a tab to the panel
66 * Adds a tab with the given widget and icon into the tabbed panel and returns the index of the
69 * @param widget Widget to be added into the tab
70 * @param icon Icon of the tab
72 int addTab(QWidget *widget, const QIcon& icon);
75 * @brief Inserts a tab to the panel
77 * Inserts a tab with the given widget and icon into the tabbed panel at the specified index,
78 * and returns the index of the inserted tab.
80 * If index is out of range, the tab is simply appended. Otherwise it is inserted at the
83 * @param index Index of the tab
84 * @param widget Widget to be inserted into the tab
85 * @param icon Icon of the tab
87 int insertTab(int index, QWidget *widget, const QIcon& icon);
90 * @brief Removes a tab from the panel
92 * Removes a tab and its widget from the panel at index position. The widget itself is not
95 * @param index Index of the tab
97 void removeTab(int index);
100 * @brief Sets tabs enabled.
102 * If disabled tab is currently selected, panel will be closed also
103 * @param tabIndexes tab indexes to set
104 * @param enabled true if should be enabled, false otherwise
106 void setTabsEnabled(const QList<int> &tabIndexes, bool enabled);
110 * @brief Slot that closes the panel
115 * @brief Slot that opens the panel
117 * If widget pointer is provided the corresponding tab is also set active
119 * @param widget Widget
121 void openPanel(QWidget *widget = 0);
124 * @brief Slot to redraw the panel after window resize event
126 * @param size Size of the new window
128 void resizePanel(const QSize &size);
132 * @brief Calculates mask for tabbed panel
134 * Mask is constructed from PanelTabBar, PanelContextButtonBar and panel content sizes
136 void calculateMask();
139 * @brief Repositions context button bar
141 void repositionContextButtonBar();
144 * @brief Sets the panel at current index active
146 * @param index Index of the panel
148 void setCurrentIndex(int index);
151 * @brief Internal slot used to set the panel state
155 /*******************************************************************************
157 ******************************************************************************/
160 * @brief This signal is emitted whenever the current tab page changes
162 * @param index Index of the new tab page
164 void currentChanged(int index);
167 * @brief Emitted when there is a change in list item selection
169 * @param itemIsSelected True if any item is selected.
171 void listItemSelectionChanged(bool itemIsSelected);
174 * @brief Signal that is sent when panel is closed
182 * @brief Signal that is sent when panel is opened
190 * @brief Signal that is sent when the panel state must be changed
197 /*******************************************************************************
199 ******************************************************************************/
201 bool m_open; ///< Current state of the panel
202 bool m_closeRequestPending; ///< Indicates wheater the panel is waiting to be closed
204 QState *m_stateClosed; ///< State of the closed panel
205 QState *m_stateOpened; ///< State of the opened panel
207 ListItemContextButtonBar *m_itemContextButtonBar; ///< Widget for list item context button bar
208 PanelBar *m_panelBar; ///< Widget for panel bar
209 PanelContentStack *m_panelContentStack; ///< Stack for panel widgets
210 PanelContextButtonBar * m_panelContextButtonBar; ///< Widget for panel context button bar
211 PanelTabBar *m_panelTabBar; ///< Widget for panel tab bar
214 #endif // TABBEDPANEL_H