Salome HOME
updated copyright message
[modules/gui.git] / src / Qtx / QtxWorkspaceAction.h
index 156643aac933a77e2cc98d7ea2339984cce6d002..dceef6963b1e55cc7ec2b7483fafa7f91aa2251f 100644 (file)
@@ -1,84 +1,97 @@
+// Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 // File:      QtxWorkspaceAction.h
 // Author:    Sergey TELKOV
-
+//
 #ifndef QTXWORKSPACEACTION_H
 #define QTXWORKSPACEACTION_H
 
-#include "QtxAction.h"
+#include "QtxActionSet.h"
 
-class QWorkspace;
+class QtxWorkspace;
 
 #ifdef WIN32
 #pragma warning( disable:4251 )
 #endif
 
-class QTX_EXPORT QtxWorkspaceAction : public QtxAction
+class QTX_EXPORT QtxWorkspaceAction : public QtxActionSet
 {
   Q_OBJECT
 
 public:
-  enum { Cascade    = 0x0001,
-         Tile       = 0x0002,
-         VTile      = 0x0004,
-         HTile      = 0x0008,
-         Windows    = 0x0010,
+  //! Actions (menu items) ID
+  enum { Cascade    = 0x0001,   //!< "Cascade child windows" operation
+         Tile       = 0x0002,   //!< "Tile child windows" operation
+         VTile      = 0x0004,   //!< "Tile child windows vertically" operation
+         HTile      = 0x0008,   //!< "Tile child windows horizontally" operation
+         Windows    = 0x0010,   //!< A list of child windows menu items
          Standard   = Cascade | Tile | Windows,
          Operations = Cascade | Tile | VTile | HTile,
          All        = Standard | HTile | VTile };
 
 public:
-  QtxWorkspaceAction( QWorkspace*, QObject* = 0, const char* = 0 );
+  QtxWorkspaceAction( QtxWorkspace*, QObject* = 0 );
   virtual ~QtxWorkspaceAction();
 
-  QWorkspace*  workspace() const;
-
-  int          items() const;
-  void         setItems( const int );
-  bool         hasItems( const int ) const;
+  QtxWorkspace* workspace() const;
 
-  int          accel( const int ) const;
-  QIconSet     iconSet( const int ) const;
-  QString      menuText( const int ) const;
-  QString      statusTip( const int ) const;
+  int           menuActions() const;
+  void          setMenuActions( const int );
 
-  void         setAccel( const int, const int );
-  void         setIconSet( const int, const QIconSet& );
-  void         setMenuText( const int, const QString& );
-  void         setStatusTip( const int, const QString& );
+  QIcon         icon( const int ) const;
+  QString       text( const int ) const;
+  int           accel( const int ) const;
+  QString       statusTip( const int ) const;
 
-  virtual bool addTo( QWidget* );
-  virtual bool addTo( QWidget*, const int );
-  virtual bool removeFrom( QWidget* );
+  void          setAccel( const int, const int );
+  void          setIcon( const int, const QIcon& );
+  void          setText( const int, const QString& );
+  void          setStatusTip( const int, const QString& );
 
-  void         perform( const int );
+  void          perform( const int );
 
 public slots:
-  void         tile();
-  void         cascade();
-  void         tileVertical();
-  void         tileHorizontal();
+  void          tile();
+  void          cascade();
+  void          tileVertical();
+  void          tileHorizontal();
 
 private slots:
-  void         onAboutToShow();
-  void         onItemActivated( int );
-  void         onPopupDestroyed( QObject* );
-
-private:
-  void         checkPopup( QPopupMenu* );
-  void         updatePopup( QPopupMenu* );
+  void          onAboutToShow();
+  void          onTriggered( int );
 
-  int          clearPopup( QPopupMenu* );
-  void         fillPopup( QPopupMenu*, const int );
+protected:
+  virtual void  addedTo( QWidget* );
+  virtual void  removedFrom( QWidget* );
 
 private:
-  typedef QMap<QPopupMenu*, QIntList> MenuMap;
-  typedef QMap<int, QtxAction*>       ItemMap;
+  void          updateContent();
+  void          updateWindows();
+  void          activateItem( const int );
 
 private:
-  MenuMap      myMenu;
-  ItemMap      myItem;
-  int          myFlags;
-  QWorkspace*  myWorkspace;
+  QtxWorkspace* myWorkspace;       //!< parent workspace
+  bool          myWindowsFlag;     //!< "show child windows items" flag
 };
 
 #ifdef WIN32