Salome HOME
Fix for bug 10438: Crash during Explode on Blocks operation (Global selection on...
[modules/gui.git] / src / Qtx / QtxWorkstack.h
index e86ac1ab75ebbcd19ba65a79f66a4c4bba40952f..a201ad2ff2662c574db9240db0967d0f974ffea5 100644 (file)
@@ -11,6 +11,7 @@
 #include <qtabbar.h>
 #include <qwidgetlist.h>
 
+class QAction;
 class QTabBar;
 class QPainter;
 class QSplitter;
@@ -22,11 +23,22 @@ class QtxWorkstackDrag;
 class QtxWorkstackChild;
 class QtxWorkstackTabBar;
 
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
 class QTX_EXPORT QtxWorkstack : public QWidget
 {
   Q_OBJECT
 
+public:
   enum { SplitVertical, SplitHorizontal, Close };
+    
+  enum SplitType {
+    SPLIT_STAY, //!< given widget stays in its workarea, others are moved into a new one
+    SPLIT_AT,   //!< widgets before a given widget stays in they workarea, others are moved into a new one
+    SPLIT_MOVE  //!< given widget is moved into a new workarea, others stay in an old one
+  };
 
 public:
   QtxWorkstack( QWidget* = 0 );
@@ -37,17 +49,28 @@ public:
 
   QWidget*            activeWindow() const;
 
+  int                 accel( const int ) const;
+  void                setAccel( const int, const int );
+
   void                split( const int );
 
+  // STV: Useless function. wid->setFocus() should be used instead.
+  // void OnTop( QWidget* wid);
+
+  void Split( QWidget* wid, const Qt::Orientation o, const SplitType type );
+  void Attract( QWidget* wid1, QWidget* wid2, const bool all );
+  void SetRelativePosition( QWidget* wid, const Qt::Orientation o, const double pos );
+  void SetRelativePositionInSplitter( QWidget* wid, const double pos );
+
 signals:
   void                windowActivated( QWidget* );
 
 public slots:
   void                splitVertical();
   void                splitHorizontal();
-
+  
 private slots:
-  void                onPopupActivated( int );
+  void                onCloseWindow();
   void                onDestroyed( QObject* );
   void                onWindowActivated( QWidget* );
   void                onContextMenuRequested( QPoint );
@@ -80,12 +103,16 @@ private:
   void                updateState( QSplitter* );
 
   void                distributeSpace( QSplitter* ) const;
+  int                 setPosition( QWidget* wid, QSplitter* split, const Qt::Orientation o,
+                                                          const int need_pos, const int splitter_pos );
 
 private:
   QWidget*            myWin;
   QtxWorkstackArea*   myArea;
   QSplitter*          mySplit;
 
+  QMap<int, QAction*> myActionsMap; //!< The map of the actions. Allows to get the QAction object by the key.
+
   friend class QtxWorkstackArea;
   friend class QtxWorkstackDrag;
 };
@@ -101,7 +128,7 @@ public:
   bool                isEmpty() const;
 
   void                insertWidget( QWidget*, const int = -1 );
-  void                removeWidget( QWidget* );
+  void                removeWidget( QWidget*, const bool = true );
 
   QWidget*            activeWidget() const;
   void                setActiveWidget( QWidget* );
@@ -135,6 +162,8 @@ private slots:
   void                onClose();
   void                onSelected( int );
 
+  void                onWidgetDestroyed();
+
   void                onDragActiveTab();
   void                onChildDestroyed( QObject* );
   void                onChildShown( QtxWorkstackChild* );
@@ -170,9 +199,14 @@ private:
   QtxWorkstackChild*  child( QWidget* ) const;
 
 private:
+  struct WidgetInfo
+  {
+    WidgetInfo() : id( 0 ), vis( false ) {}
+    int id; bool vis;
+  };
+
   typedef QMap<QWidget*, bool>               BlockMap;
   typedef QMap<QWidget*, QtxWorkstackChild*> ChildMap;
-  typedef struct { int id; bool vis; }       WidgetInfo;
   typedef QMap<QWidget*, WidgetInfo>         WidgetInfoMap;
 
 private:
@@ -270,6 +304,11 @@ private:
   int                 myTab;
   QtxWorkstackArea*   myArea;
   QPainter*           myPainter;
+  
 };
 
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
 #endif