1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 // SUIT_ViewModel.cxx: implementation of the SUIT_ViewModel class.
21 //////////////////////////////////////////////////////////////////////
23 #include "SUIT_ViewModel.h"
25 SUIT_ViewModel::StatesMap SUIT_ViewModel::myStateMap;
26 SUIT_ViewModel::ButtonsMap SUIT_ViewModel::myButtonMap;
28 static bool isInitialized = false;
31 SUIT_ViewModel::SUIT_ViewModel()
36 SUIT_ViewModel::myStateMap[ZOOM] = Qt::ControlButton;
37 SUIT_ViewModel::myButtonMap[ZOOM] = Qt::LeftButton;
39 SUIT_ViewModel::myStateMap[PAN] = Qt::ControlButton;
40 SUIT_ViewModel::myButtonMap[PAN] = Qt::MidButton;
42 SUIT_ViewModel::myStateMap[ROTATE] = Qt::ControlButton;
43 SUIT_ViewModel::myButtonMap[ROTATE] = Qt::RightButton;
45 SUIT_ViewModel::myStateMap[FIT_AREA] = Qt::ControlButton;
46 SUIT_ViewModel::myButtonMap[FIT_AREA] = Qt::RightButton;
52 SUIT_ViewModel::~SUIT_ViewModel()
56 /*!Create new instance of view window on desktop \a theDesktop.
57 *\retval SUIT_ViewWindow* - created view window pointer.
59 SUIT_ViewWindow* SUIT_ViewModel::createView(SUIT_Desktop* theDesktop)
61 return new SUIT_ViewWindow(theDesktop);
65 *\param theOper - hot operation
66 *\param theState - adding state to state map operations.
67 *\param theButton - adding state to button map operations.
69 void SUIT_ViewModel::setHotButton(HotOperation theOper, Qt::ButtonState theState,
70 Qt::ButtonState theButton)
72 myStateMap[theOper] = theState;
73 myButtonMap[theOper] = theButton;
76 /*! Gets hot button for operation \a theOper.
77 *\param theOper - input hot operation
78 *\param theState - output state from state map operations.
79 *\param theButton - output state from button map operations.
81 void SUIT_ViewModel::getHotButton(HotOperation theOper, Qt::ButtonState& theState,
82 Qt::ButtonState& theButton)
84 theState = myStateMap[theOper];
85 theButton = myButtonMap[theOper];