Back to index

salome-gui  6.5.0
SUIT_Accel.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // SUIT_Accel.h: interface for the SUIT_Accel class.
00024 //
00025 #ifndef SUIT_ACELL_H
00026 #define SUIT_ACELL_H
00027 
00028 #include "SUIT.h"
00029 
00030 #include <QMap>
00031 #include <QObject>
00032 #include <QString>
00033 
00034 class SUIT_EXPORT SUIT_Accel: public QObject
00035 {
00036   Q_OBJECT
00037 
00038 public:
00039   enum Actions { 
00040     PanLeft = 1, 
00041     PanRight, 
00042     PanUp, 
00043     PanDown, 
00044     ZoomIn, 
00045     ZoomOut, 
00046     ZoomFit, 
00047     RotateLeft, 
00048     RotateRight, 
00049     RotateUp, 
00050     RotateDown, 
00051     LastAction 
00052   };
00053 
00054 public:
00055   static SUIT_Accel* getAccel();
00056 
00057   void setActionKey( const int action, const int key, const QString& type );
00058   void unsetActionKey( const int key, const QString& type );
00059 
00060 protected:
00061   bool eventFilter( QObject *, QEvent * );
00062 
00063 private:
00064   SUIT_Accel();
00065 
00066   int getAccelKey( QEvent* );
00067 
00068   typedef QMap<int, int> IdActionMap; 
00069   typedef QMap<QString, IdActionMap> 
00070                ViewerTypeIdActionMap; 
00071   ViewerTypeIdActionMap myMap;        
00072 
00075   QMap<int, bool> myOptMap;
00076 
00077   static SUIT_Accel* myself;
00078 };
00079 
00080 #endif