Salome HOME
updated copyright message
[modules/gui.git] / src / Qtx / QtxActionToolMgr.h
index 12ef84f9bd7ec37ef81b5520bb2845bf97c6beef..00f209340eb1c5b956f83780cda20ffe4a89aff8 100644 (file)
@@ -1,17 +1,40 @@
-// File:      QtxActionToolMgr.h
-// Author:    Alexander SOLOVYEV, Sergey TELKOV
+// 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:      QtxActionToolMgr.h
+// Author:    Alexander SOLOVYOV, Sergey TELKOV
+//
 #ifndef QTXACTIONTOOLMGR_H
 #define QTXACTIONTOOLMGR_H
 
 #include "Qtx.h"
-
-#include <qaction.h>
-
 #include "QtxActionMgr.h"
 
+#include <QMap>
+#include <QList>
+
 class QToolBar;
 class QMainWindow;
+class QAction;
 
 #ifdef WIN32
 #pragma warning( disable:4251 )
@@ -25,12 +48,13 @@ class QTX_EXPORT QtxActionToolMgr : public QtxActionMgr
   {
   public:
     ToolNode() : id( -1 ), visible( true ) {};
+    ToolNode( const int _id ) : id( _id ), visible( true ) {};
 
-    int       id;
-    bool      visible;
+    int       id;          //!< tool node ID
+    bool      visible;     //!< visibility status
   };
 
-  typedef QValueList<ToolNode> NodeList;
+  typedef QList<ToolNode> NodeList;    //!< toolbar nodes list
 
 protected:
   class ToolCreator;
@@ -41,7 +65,12 @@ public:
 
   QMainWindow*    mainWindow() const;
 
-  int             createToolBar( const QString&, int = -1 );
+  int             createToolBar( const QString&, int = -1, QMainWindow* = 0, bool = true );
+  int             createToolBar( const QString&, const QString&, int = -1, QMainWindow* = 0, bool = true );
+  int             createToolBar( const QString&, bool, Qt::ToolBarAreas = Qt::AllToolBarAreas, 
+                                 int = -1, QMainWindow* = 0, bool = true );
+  int             createToolBar( const QString&, const QString&, bool, Qt::ToolBarAreas = Qt::AllToolBarAreas, 
+                                 int = -1, QMainWindow* = 0, bool = true );
   void            removeToolBar( const QString& );
   void            removeToolBar( const int );
 
@@ -70,36 +99,47 @@ public:
 
   void            remove( const int, const int );
   void            remove( const int, const QString& );
+  void            clear( const int );
+  void            clear( const QString& );
 
   QToolBar*       toolBar( const int ) const;
   QToolBar*       toolBar( const QString& ) const;
+  QIntList        toolBarsIds() const;
   
   bool            hasToolBar( const int ) const;
   bool            hasToolBar( const QString& ) const;
 
+  bool            containsAction( const int, const int = -1 ) const;
+  int             index( const int, const int ) const;
+
   virtual bool    load( const QString&, QtxActionMgr::Reader& );
 
+  int             find( QToolBar* ) const;
+
 protected slots:
   void            onToolBarDestroyed();
 
 protected:
-  int             find( QToolBar* ) const;  
   int             find( const QString& ) const;
   QToolBar*       find( const QString&, QMainWindow* ) const;
 
   virtual void    internalUpdate();
   void            updateToolBar( const int );
 
+  virtual void    updateContent();
+
 private:
   void            simplifySeparators( QToolBar* );
+  void            triggerUpdate( const int );
 
 private:
-  typedef struct { NodeList nodes; QToolBar* toolBar; } ToolBarInfo;
-  typedef QMap<int, ToolBarInfo>                        ToolBarMap;
+  typedef struct { NodeList nodes; QToolBar* toolBar; } ToolBarInfo;   //!< toolbar info
+  typedef QMap<int, ToolBarInfo>                        ToolBarMap;    //!< toolbars map
 
 private:
-  ToolBarMap      myToolBars;
-  QMainWindow*    myMainWindow;
+  ToolBarMap      myToolBars;      //!< toobars map
+  QMainWindow*    myMainWindow;    //!< parent main window
+  QMap<int,int>   myUpdateIds;     //!< list of actions ID being updated
 };
 
 class QtxActionToolMgr::ToolCreator : public QtxActionMgr::Creator
@@ -112,7 +152,7 @@ public:
                       const ItemAttributes&, const int );
 
 private:
-  QtxActionToolMgr* myMgr;
+  QtxActionToolMgr* myMgr;         //!< toolbar manager
 };
 
 #endif