USA.
*/
-
#ifndef LISTITEMCONTEXTBUTTONBAR_H
#define LISTITEMCONTEXTBUTTONBAR_H
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,
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
*/
QWidget* genericPanelButtons() const;
+ /**
+ * @brief Getter for the list item related context buttons
+ *
+ * @returns Pointer to context buttons widget
+ */
QWidget* itemButtons() const;
protected slots:
+ /**
+ * @brief Call when there is a change in list item selection
+ *
+ * Emits listItemSelectionChanged(bool). Parameter is true if any item is selected.
+ */
void onListItemSelectionChanged();
/*******************************************************************************
*/
void openPanelRequested(QWidget *widget);
+ /**
+ * @brief Emitted when there is a change in list item selection
+ *
+ * @param itemIsSelected True if any item is selected.
+ */
void listItemSelectionChanged(bool itemIsSelected);
/*******************************************************************************