1 // SUIT_ViewModel.cxx: implementation of the SUIT_ViewModel class.
3 //////////////////////////////////////////////////////////////////////
5 #include "SUIT_ViewModel.h"
7 SUIT_ViewModel::StatesMap SUIT_ViewModel::myStateMap;
8 SUIT_ViewModel::ButtonsMap SUIT_ViewModel::myButtonMap;
10 static bool isInitialized = false;
13 SUIT_ViewModel::SUIT_ViewModel()
18 SUIT_ViewModel::myStateMap[ZOOM] = Qt::ControlButton;
19 SUIT_ViewModel::myButtonMap[ZOOM] = Qt::LeftButton;
21 SUIT_ViewModel::myStateMap[PAN] = Qt::ControlButton;
22 SUIT_ViewModel::myButtonMap[PAN] = Qt::MidButton;
24 SUIT_ViewModel::myStateMap[ROTATE] = Qt::ControlButton;
25 SUIT_ViewModel::myButtonMap[ROTATE] = Qt::RightButton;
27 SUIT_ViewModel::myStateMap[FIT_AREA] = Qt::ControlButton;
28 SUIT_ViewModel::myButtonMap[FIT_AREA] = Qt::RightButton;
34 SUIT_ViewModel::~SUIT_ViewModel()
38 /*!Create new instance of view window on desktop \a theDesktop.
39 *\retval SUIT_ViewWindow* - created view window pointer.
41 SUIT_ViewWindow* SUIT_ViewModel::createView(SUIT_Desktop* theDesktop)
43 return new SUIT_ViewWindow(theDesktop);
47 *\param theOper - hot operation
48 *\param theState - adding state to state map operations.
49 *\param theButton - adding state to button map operations.
51 void SUIT_ViewModel::setHotButton(HotOperation theOper, Qt::ButtonState theState,
52 Qt::ButtonState theButton)
54 myStateMap[theOper] = theState;
55 myButtonMap[theOper] = theButton;
58 /*! Gets hot button for operation \a theOper.
59 *\param theOper - input hot operation
60 *\param theState - output state from state map operations.
61 *\param theButton - output state from button map operations.
63 void SUIT_ViewModel::getHotButton(HotOperation theOper, Qt::ButtonState& theState,
64 Qt::ButtonState& theButton)
66 theState = myStateMap[theOper];
67 theButton = myButtonMap[theOper];