Salome HOME
updated copyright message
[modules/gui.git] / src / SUIT / SUIT_Accel.h
index 78c9bff30161c9102ecf692682cc113ac533e63f..dcc86e8bfa6292ff975ab896215e974a9b5f2741 100644 (file)
@@ -1,36 +1,35 @@
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
+// 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.
-// 
-// 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 
+// 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 
+// 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/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // SUIT_Accel.h: interface for the SUIT_Accel class.
 //
-//////////////////////////////////////////////////////////////////////
-
-#ifndef SUIT_Accel_h 
-#define SUIT_Accel_h
+#ifndef SUIT_ACELL_H
+#define SUIT_ACELL_H
 
 #include "SUIT.h"
 
-#include <qobject.h>
-#include <qstring.h>
-#include <qmap.h>
-
-class QAccel;
-class SUIT_Desktop;
+#include <QMap>
+#include <QObject>
+#include <QString>
 
 class SUIT_EXPORT SUIT_Accel: public QObject
 {
@@ -53,21 +52,29 @@ public:
   };
 
 public:
-  SUIT_Accel( SUIT_Desktop* theDesktop );
-  virtual ~SUIT_Accel();
+  static SUIT_Accel* getAccel();
 
   void setActionKey( const int action, const int key, const QString& type );
+  void unsetActionKey( const int key, const QString& type );
 
-protected slots:
-  void onActivated( int );
+protected:
+  bool eventFilter( QObject *, QEvent * );
 
 private:
-  QAccel* myAccel; 
-  SUIT_Desktop* myDesktop;
+  SUIT_Accel();
+
+  int getAccelKey( QEvent* );
+
+  typedef QMap<int, int> IdActionMap; //!< maps key to action id
+  typedef QMap<QString, IdActionMap> 
+               ViewerTypeIdActionMap; //!< maps viewer type to IdActionMap
+  ViewerTypeIdActionMap myMap;        //!< viewer actions map
+
+  //! Maps key to <not_used> flag map, used for optimization.
+  //! All registered keys (accelerators) are stored in this map.
+  QMap<int, bool> myOptMap;
 
-  typedef QMap<int, int> IdActionMap; // internal_id - to - action map
-  typedef QMap<QString, IdActionMap> ViewerTypeIdActionMap; // viewer_type - to - IdActionMap
-  ViewerTypeIdActionMap myMap;
+  static SUIT_Accel* myself;
 };
 
 #endif