X-Git-Url: http://git.maemo.org/git/?p=situare;a=blobdiff_plain;f=src%2Fui%2Flistitemcontextbuttonbar.h;h=71be6462d2ca1eb0989b505c4c990bb4ed7f0fc3;hp=7b4a35721758a658128b883eed9dd2f9d69367cd;hb=83b1d47ddd0006f846ff43fd0d3e83218081abd3;hpb=36f5e82e67e2658f1ae40113ad2362324c4ff485 diff --git a/src/ui/listitemcontextbuttonbar.h b/src/ui/listitemcontextbuttonbar.h index 7b4a357..71be646 100644 --- a/src/ui/listitemcontextbuttonbar.h +++ b/src/ui/listitemcontextbuttonbar.h @@ -19,7 +19,6 @@ USA. */ - #ifndef LISTITEMCONTEXTBUTTONBAR_H #define LISTITEMCONTEXTBUTTONBAR_H @@ -27,39 +26,105 @@ class QPropertyAnimation; +/** + * @brief Button bar for list item relatex context buttons + * + * @author Sami Rämö - sami.ramo (at) ixonos.com + */ class ListItemContextButtonBar : public QWidget { Q_OBJECT public: + /** + * @brief Constructor + * + * @param parent Parent + */ explicit ListItemContextButtonBar(QWidget *parent = 0); + /** + * @brief Destructor + * + * Deletes images. + */ ~ListItemContextButtonBar(); +/******************************************************************************* + * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS + ******************************************************************************/ +private: + /** + * @brief Paint the background of the item + * + * @param event Paint event + */ void paintEvent(QPaintEvent *event); +/******************************************************************************* + * MEMBER FUNCTIONS AND SLOTS + ******************************************************************************/ +public: + /** + * @brief Start hiding animation + */ void hideContextButtonBar(); /** - * @brief Sets the context buttons to the context button bar + * @brief Set new context buttons * - * @param contextButtons Pointer to context buttons + * If bar is hidden, then changeButtons() is called. Otherwise pointer to new buttons is saved + * and hideContextButtonBar() is called. + * + * @param contextButtons Pointer to new context buttons */ void setContextButtons(QWidget *contextButtons); + /** + * @brief Start showing animation + * + * Animation is started only if the bar contains buttons. + */ void showContextButtonBar(); -signals: - public slots: + /** + * @brief Shows and hides the bar when item selection is changed + * + * Calls showContextButtonBar() or hideContextButtonBar() if changing the state of the bar is + * required. If there is a pointer to new buttons, then request is remembered instead of + * changing the state immediately. + * + * @param itemIsSelected True is any item is selected + */ void onListItemSelectionChanged(bool itemIsSelected); private: + /** + * @brief Do the actual changing of the buttons + * + * Does also re-sizing and re-positioning of the bar and sets new values for animation. + */ void changeButtons(); private slots: + /** + * @brief + * + * If bar was just hidden, then calls changeButtons() if there is a pointer to new buttons + * saved. If changing the buttons was done, then also checks if showing the bar was requested + * and calls showContextButtonBar() if needed. + */ void onAnimationFinished(); +/******************************************************************************* + * DATA MEMBERS + ******************************************************************************/ private: + /** + * @brief States for the animation + * + * @enum AnimationState + */ enum AnimationState { StateHidden, StateOpening, @@ -67,18 +132,18 @@ private: StateVisible }; - bool m_waitForOpen; + bool m_waitForOpen; ///< Is showing requested while chaging buttons is not ready - QPixmap *m_backgroundLeft; - QPixmap *m_backgroundMiddle; - QPixmap *m_backgroundRight; + QPixmap *m_backgroundLeft; ///< Background picture, left part + QPixmap *m_backgroundMiddle; ///< Background picture, center part + QPixmap *m_backgroundRight; ///< Background picture, right part - QPropertyAnimation *m_animation; + QPropertyAnimation *m_animation; ///< Sliding animation for show/hide - QWidget *m_contextButtons; ///< Widget for context buttons - QWidget *m_newContextButtons; ///< Temporary pointer for new context buttons + QWidget *m_contextButtons; ///< Widget for context buttons + QWidget *m_newContextButtons; ///< Temporary pointer for new context buttons - AnimationState m_state; + AnimationState m_state; ///< Current state of the animation }; #endif // LISTITEMCONTEXTBUTTONBAR_H