2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Sami Rämö - sami.ramo@ixonos.com
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.
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.
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,
22 #ifndef LISTITEMCONTEXTBUTTONBAR_H
23 #define LISTITEMCONTEXTBUTTONBAR_H
27 class QPropertyAnimation;
30 * @brief Button bar for list item relatex context buttons
32 * @author Sami Rämö - sami.ramo (at) ixonos.com
34 class ListItemContextButtonBar : public QWidget
41 * @param parent Parent
43 explicit ListItemContextButtonBar(QWidget *parent = 0);
50 ~ListItemContextButtonBar();
52 /*******************************************************************************
53 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
54 ******************************************************************************/
57 * @brief Paint the background of the item
59 * @param event Paint event
61 void paintEvent(QPaintEvent *event);
63 /*******************************************************************************
64 * MEMBER FUNCTIONS AND SLOTS
65 ******************************************************************************/
68 * @brief Start hiding animation
70 void hideContextButtonBar();
73 * @brief Set new context buttons
75 * If bar is hidden, then changeButtons() is called. Otherwise pointer to new buttons is saved
76 * and hideContextButtonBar() is called.
78 * @param contextButtons Pointer to new context buttons
80 void setContextButtons(QWidget *contextButtons);
83 * @brief Start showing animation
85 * Animation is started only if the bar contains buttons.
87 void showContextButtonBar();
91 * @brief Shows and hides the bar when item selection is changed
93 * Calls showContextButtonBar() or hideContextButtonBar() if changing the state of the bar is
94 * required. If there is a pointer to new buttons, then request is remembered instead of
95 * changing the state immediately.
97 * @param itemIsSelected True is any item is selected
99 void onListItemSelectionChanged(bool itemIsSelected);
103 * @brief Do the actual changing of the buttons
105 * Does also re-sizing and re-positioning of the bar and sets new values for animation.
107 void changeButtons();
113 * If bar was just hidden, then calls changeButtons() if there is a pointer to new buttons
114 * saved. If changing the buttons was done, then also checks if showing the bar was requested
115 * and calls showContextButtonBar() if needed.
117 void onAnimationFinished();
119 /*******************************************************************************
121 ******************************************************************************/
124 * @brief States for the animation
126 * @enum AnimationState
128 enum AnimationState {
135 bool m_waitForOpen; ///< Is showing requested while chaging buttons is not ready
137 QPixmap *m_backgroundLeft; ///< Background picture, left part
138 QPixmap *m_backgroundMiddle; ///< Background picture, center part
139 QPixmap *m_backgroundRight; ///< Background picture, right part
141 QPropertyAnimation *m_animation; ///< Sliding animation for show/hide
143 QWidget *m_contextButtons; ///< Widget for context buttons
144 QWidget *m_newContextButtons; ///< Temporary pointer for new context buttons
146 AnimationState m_state; ///< Current state of the animation
149 #endif // LISTITEMCONTEXTBUTTONBAR_H