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 #ifndef SUIT_VIEWMODEL_H
20 #define SUIT_VIEWMODEL_H
23 #include "SUIT_Desktop.h"
24 #include "SUIT_ViewWindow.h"
25 #include "SUIT_ViewManager.h"
31 #pragma warning( disable:4251 )
34 * This object manages the definition and behaviour of a View Window. \n
35 * In case of definition of this object in an external lib that lib must \n
36 * have an exported function "createViewModel" which returns newly created \n
37 * instance of SUIT_ViewModel.
39 class SUIT_EXPORT SUIT_ViewModel : public QObject
43 enum HotOperation { PAN, ZOOM, ROTATE, FIT_AREA };
45 typedef QMap<HotOperation, Qt::ButtonState> StatesMap;
46 typedef QMap<HotOperation, Qt::ButtonState> ButtonsMap;
49 virtual ~SUIT_ViewModel();
51 virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
53 virtual void setViewManager(SUIT_ViewManager* theViewManager) { myViewManager = theViewManager; }
54 SUIT_ViewManager* getViewManager() const { return myViewManager; }
56 virtual QString getType() const { return "SUIT_ViewModel"; }
58 virtual void contextMenuPopup(QPopupMenu*) {}
60 static void setHotButton(HotOperation theOper, Qt::ButtonState theState,
61 Qt::ButtonState theButton);
62 static void getHotButton(HotOperation theOper, Qt::ButtonState& theState,
63 Qt::ButtonState& theButton);
66 SUIT_ViewManager* myViewManager;
69 static StatesMap myStateMap;
70 static ButtonsMap myButtonMap;
74 #pragma warning( default:4251 )
79 typedef SUIT_ViewModel* (*VIEWMODEL_CREATE_FUNC)();
82 #define VIEWMODEL_CREATE_NAME "createViewModel"