Refactored panel context button bar animation and now it is implemented in a lot...
[situare] / src / ui / tabbedpanel.h
index a54332c..b7473cc 100644 (file)
 
 class QPropertyAnimation;
 class QSignalTransition;
-class QStackedWidget;
 class QState;
 class QStateMachine;
 
 class PanelBar;
-class PanelContent;
+class PanelContentStack;
+class PanelContextButtonBar;
 class PanelTabBar;
 
 /**
@@ -70,7 +70,6 @@ public:
      */
     int addTab(QWidget *widget, const QIcon& icon);
 
-    ///< @todo define "out of range"
     /**
      * @brief Inserts a tab to the panel
      *
@@ -98,14 +97,18 @@ public:
 
 public slots:
     /**
-     * @brief Public slot that will close the panel unless already closed
+     * @brief Slot that closes the panel
      */
     void closePanel();
 
     /**
-     * @brief Public slot that will open the panel unless already open
+     * @brief Slot that opens the panel
+     *
+     * If widget pointer is provided the corresponding tab is also set active
+     *
+     * @param widget Widget
      */
-    void openPanel();
+    void openPanel(QWidget *widget = 0);
 
     /**
      * @brief Slot to redraw the panel after window resize event
@@ -114,16 +117,16 @@ public slots:
      */
     void resizePanel(const QSize &size);
 
+private slots:
     /**
-     * @brief Shows the tab at given index active
+     * @brief Sets the panel at current index active
      *
-     * @param index Index of the tab
+     * @param index Index of the panel
      */
-    void showTab(int index);
+    void setCurrentIndex(int index);
 
-private slots:
     /**
-     * @brief Internal slot used to track statemachine state
+     * @brief Internal slot used to set the panel state
      */
     void stateChanged();
 
@@ -132,7 +135,9 @@ private slots:
  ******************************************************************************/
 signals:
     /**
-     * @brief This signal is emitted whenever the current page index changes
+     * @brief This signal is emitted whenever the current tab page changes
+     *
+     * @param index Index of the new tab page
      */
     void currentChanged(int index);
 
@@ -153,7 +158,7 @@ signals:
     void panelOpened();
 
     /**
-     * @brief Signal that is sent to state machine when panel state must be changed
+     * @brief Signal that is sent when the panel state must be changed
      *
      * @sa openPanel
      * @sa closePanel
@@ -164,23 +169,16 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    bool m_isOpen;      ///< Boolean used to track the current state of the statemachine
-
-    QPropertyAnimation *m_panelAnimation;       ///< Animation for panel state changes
-
-    QSignalTransition *m_panelTransitionClose;  ///< Transition signal for closing the panel
-    QSignalTransition *m_panelTransitionOpen;   ///< Transition signal for opening the panel
-
-    QStackedWidget *m_panelWidgetStack;         ///< Stack for panel widgets
-
-    QState *m_panelStateClosed;                 ///< State of the closed panel
-    QState *m_panelStateOpened;                 ///< State of the opened panel
+    bool m_open;                            ///< Current state of the panel
+    bool m_closeRequestPending;
 
-    QStateMachine *m_panelStateMachine;         ///< State machine for sliding the panel
+    QState *m_stateClosed;                  ///< State of the closed panel
+    QState *m_stateOpened;                  ///< State of the opened panel
 
-    PanelBar *m_panelBar;                       ///< Widget for panel bar
-    PanelContent *m_panelContent;               ///< Widget for panel content
-    PanelTabBar *m_panelTabBar;                 ///< Widget for panel tab bar
+    PanelBar *m_panelBar;                               ///< Widget for panel bar
+    PanelContentStack *m_panelContentStack;             ///< Stack for panel widgets
+    PanelContextButtonBar * m_panelContextButtonBar;    ///< Widget for panel context button bar
+    PanelTabBar *m_panelTabBar;                         ///< Widget for panel tab bar
 };
 
 #endif // TABBEDPANEL_H