Refactored panel context button bar animation and now it is implemented in a lot...
[situare] / src / ui / panelcontextbuttonbar.h
index 7b4a4ba..fbdd58e 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <QWidget>
 
+class QState;
+
 class PanelContextButtonBar : public QWidget
 {
     Q_OBJECT
@@ -47,35 +49,88 @@ protected:
      */
     void paintEvent(QPaintEvent *event);
 
+    /**
+     * @brief Resizes the bar
+     *
+     * @param event Resize event
+     */
+    void resizeEvent(QResizeEvent *event);
+
 /*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public:
     /**
+     * @brief Hides the context button bar
+     */
+    void hideContextButtonBar();
+
+    /**
+     * @brief Returns the current state of the context button bar
+     *
+     * @return Current state
+     */
+    bool isBarVisible() const;
+
+    /**
+     * @brief Moves the context button bar to desired position
+     *
+     * @param x Horizontal position
+     * @param y Vertical position
+     */
+    void move(int x, int y);
+
+    /**
      * @brief Sets the context buttons to the context button bar
      *
      * @param contextButtons Pointer to context buttons
      */
     void setContextButtons(QWidget *contextButtons);
 
+    /**
+     * @brief Shows the context button bar
+     */
+    void showContextButtonBar();
+
+private slots:
+    /**
+     * @brief Internal slot used to set the context button bar state
+     */
+    void contextButtonBarStateChanged();
+
 /*******************************************************************************
  * SIGNALS
  ******************************************************************************/
 signals:
     /**
-     * @brief This signal is called when context button bar needs to be repositioned
+     * @brief Signal that is sent when context button bar is hidden
      */
-    void positionChangeRequested();
+    void barHidden();
+
+    /**
+     * @brief Signal that is sent when context button bar is visible
+     */
+    void barVisible();
+
+    /**
+     * @brief Signal that is sent when the context button bar state must be changed
+     */
+    void toggleState();
 
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
 private:
+    bool m_visible;             ///< Current state of the context button bar
+
     QPixmap m_barTile;          ///< Pixmap for button bar
     QPixmap m_barTop;           ///< Pixmap for button bar top
 
     QRect m_barRect;            ///< Rect for the button bar
 
+    QState *m_stateHidden;      ///< State of the hidden context button bar
+    QState *m_stateVisible;     ///< State of the visible context button bar
+
     QWidget *m_contextButtons;  ///< Widget for context buttons
 };