Merge branch 'master' into contact_dialog
[situare] / src / ui / tabbedpanel.h
index 9f59572..12fefa9 100644 (file)
@@ -34,13 +34,14 @@ class QStateMachine;
 
 class PanelBar;
 class PanelContentStack;
+class PanelContextButtonBar;
 class PanelTabBar;
 
 /**
  * @brief Class for tabbed panels
  *
  * @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
  */
 class TabbedPanel : public QWidget
 {
@@ -94,6 +95,15 @@ public:
      */
     void removeTab(int index);
 
+    /**
+    * @brief Sets tabs enabled.
+    *
+    * If disabled tab is currently selected, panel will be closed also
+    * @param tabIndexes tab indexes to set
+    * @param enabled true if should be enabled, false otherwise
+    */
+    void setTabsEnabled(const QList<int> &tabIndexes, bool enabled);
+
 public slots:
     /**
      * @brief Slot that closes the panel
@@ -101,11 +111,13 @@ public slots:
     void closePanel();
 
     /**
-     * @brief Slot that shows the tab (and opens it if closed) with the desired widget
+     * @brief Slot that opens the panel
+     *
+     * If widget pointer is provided the corresponding tab is also set active
      *
      * @param widget Widget
      */
-    void showPanel(QWidget *widget);
+    void openPanel(QWidget *widget = 0);
 
     /**
      * @brief Slot to redraw the panel after window resize event
@@ -116,6 +128,18 @@ public slots:
 
 private slots:
     /**
+     * @brief Calculates mask for tabbed panel
+     *
+     * Mask is constructed from PanelTabBar, PanelContextButtonBar and panel content sizes
+     */
+    void calculateMask();
+
+    /**
+     * @brief Repositions context button bar
+     */
+    void repositionContextButtonBar();
+
+    /**
      * @brief Sets the panel at current index active
      *
      * @param index Index of the panel
@@ -123,7 +147,7 @@ private slots:
     void setCurrentIndex(int index);
 
     /**
-     * @brief Internal slot used to track statemachine state
+     * @brief Internal slot used to set the panel state
      */
     void stateChanged();
 
@@ -155,7 +179,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
@@ -166,21 +190,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
-
-    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; ///< Indicates wheater the panel is waiting to be closed
 
-    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
-    PanelContentStack *m_panelContentStack;     ///< Stack for panel widgets
-    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