1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SUIT_ViewModel.cxx: implementation of the SUIT_ViewModel class.
24 #include "SUIT_ViewModel.h"
25 #include "SUIT_ViewWindow.h"
27 SUIT_ViewModel::StatesMap SUIT_ViewModel::myStateMap;
28 SUIT_ViewModel::ButtonsMap SUIT_ViewModel::myButtonMap;
30 static bool isInitialized = false;
33 SUIT_ViewModel::SUIT_ViewModel()
39 SUIT_ViewModel::myStateMap[ZOOM] = Qt::ControlModifier;
40 SUIT_ViewModel::myButtonMap[ZOOM] = Qt::LeftButton;
42 SUIT_ViewModel::myStateMap[PAN] = Qt::ControlModifier;
43 SUIT_ViewModel::myButtonMap[PAN] = Qt::MidButton;
45 SUIT_ViewModel::myStateMap[ROTATE] = Qt::ControlModifier;
46 SUIT_ViewModel::myButtonMap[ROTATE] = Qt::RightButton;
48 SUIT_ViewModel::myStateMap[FIT_AREA] = Qt::ControlModifier;
49 SUIT_ViewModel::myButtonMap[FIT_AREA] = Qt::RightButton;
55 SUIT_ViewModel::~SUIT_ViewModel()
59 /*!Create new instance of view window on desktop \a theDesktop.
60 *\retval SUIT_ViewWindow* - created view window pointer.
62 SUIT_ViewWindow* SUIT_ViewModel::createView(SUIT_Desktop* theDesktop)
64 return new SUIT_ViewWindow(theDesktop);
68 \param theViewManager view manager
70 void SUIT_ViewModel::setViewManager(SUIT_ViewManager* theViewManager)
72 myViewManager = theViewManager;
78 SUIT_ViewManager* SUIT_ViewModel::getViewManager() const
84 *\param theOper - hot operation
85 *\param theState - adding state to state map operations.
86 *\param theButton - adding state to button map operations.
88 void SUIT_ViewModel::setHotButton( HotOperation theOper, Qt::KeyboardModifier theState, Qt::MouseButton theButton )
90 myStateMap[theOper] = theState;
91 myButtonMap[theOper] = theButton;
94 /*! Gets hot button for operation \a theOper.
95 *\param theOper - input hot operation
96 *\param theState - output state from state map operations.
97 *\param theButton - output state from button map operations.
99 void SUIT_ViewModel::getHotButton( HotOperation theOper, Qt::KeyboardModifier& theState, Qt::MouseButton& theButton )
101 theState = myStateMap[theOper];
102 theButton = myButtonMap[theOper];