Salome HOME
Copyright update 2022
[modules/gui.git] / src / SUIT / SUIT_ShortcutMgr.h
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef SUIT_SHORTCUTMGR_H
24 #define SUIT_SHORTCUTMGR_H
25
26 #include "SUIT.h"
27
28 #include <QObject>
29 #include <QMultiMap>
30
31 class QtxAction;
32
33 class QKeySequence;
34
35 #if defined WIN32
36 #pragma warning( disable: 4251 )
37 #endif
38
39 /*!
40   \class SUIT_ShortcutMgr
41   \brief Class which manages shortcuts customization.
42 */
43 class SUIT_EXPORT SUIT_ShortcutMgr: public QObject 
44 {
45   Q_OBJECT
46 public:
47   static void Init();
48   static SUIT_ShortcutMgr* getShortcutMgr();
49
50   void setSectionEnabled( const QString&, const bool = true );
51   void updateShortcuts();
52
53 protected:
54   SUIT_ShortcutMgr();
55   virtual ~SUIT_ShortcutMgr();
56
57 private slots:
58   void onActionDestroyed( QObject* );
59
60 private:
61   virtual bool eventFilter( QObject* o, QEvent* e );
62
63   void processAction( QtxAction* );
64   QKeySequence getShortcutByActionName( const QString& ) const;
65
66 private:
67   static SUIT_ShortcutMgr* myShortcutMgr;
68   QMultiMap<QString, QtxAction*> myShortcutActions;
69 };
70
71 #if defined WIN32
72 #pragma warning( default: 4251 )
73 #endif
74
75 #endif