Salome HOME
Merge from V6_main 13/12/2012
[modules/gui.git] / src / SUIT / SUIT_ViewWindow.h
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // SUIT_ViewWindow.h: interface for the SUIT_ViewWindow class.
24 //
25 #ifndef SUIT_VIEWWINDOW_H
26 #define SUIT_VIEWWINDOW_H
27
28 #include "SUIT.h"
29 #include "SUIT_CameraProperties.h"
30
31 #include <QMainWindow>
32 #include <QList>
33 #include <QMap>
34
35 class SUIT_Desktop;
36 class SUIT_ViewManager;
37 class QtxActionToolMgr;
38 class QtxMultiAction;
39 class QImage;
40
41 class SUIT_EXPORT SUIT_ViewWindow: public QMainWindow 
42 {
43   Q_OBJECT
44
45 public:
46
47   SUIT_ViewWindow( SUIT_Desktop* );
48   virtual ~SUIT_ViewWindow();
49
50   virtual void      setViewManager( SUIT_ViewManager* );
51   SUIT_ViewManager* getViewManager() const;
52
53   bool              event(QEvent*);
54
55   virtual QImage    dumpView();
56   bool              dumpViewToFormat( const QString& fileName, const QString& format );
57
58   bool              onAccelAction( int );
59
60   bool              closable() const;
61   bool              setClosable( const bool );
62
63   virtual QString   getVisualParameters();
64   virtual void      setVisualParameters( const QString& parameters );
65
66   void              setDestructiveClose( const bool );
67   
68   int               getId() const;
69
70   QtxActionToolMgr* toolMgr() const;
71
72   virtual void      setDropDownButtons( bool );
73   bool              dropDownButtons() const;
74
75   virtual SUIT_CameraProperties cameraProperties();
76
77 public slots:
78   virtual void      onDumpView();
79
80 signals:
81   void              tryClosing( SUIT_ViewWindow* );
82   void              closing( SUIT_ViewWindow* );
83   void              mousePressed( SUIT_ViewWindow*, QMouseEvent* );
84   void              mouseReleased( SUIT_ViewWindow*, QMouseEvent* );
85   void              mouseDoubleClicked( SUIT_ViewWindow*, QMouseEvent* );
86   void              mouseMoving( SUIT_ViewWindow*, QMouseEvent* );
87   void              wheeling( SUIT_ViewWindow*, QWheelEvent* );
88   void              keyPressed( SUIT_ViewWindow*, QKeyEvent* );
89   void              keyReleased( SUIT_ViewWindow*, QKeyEvent* );
90   void              contextMenuRequested( QContextMenuEvent *e );
91   void              viewModified( SUIT_ViewWindow* );
92   
93 protected:
94   void              closeEvent( QCloseEvent* );
95   virtual void      contextMenuEvent( QContextMenuEvent* );
96   virtual QString   filter() const;
97   virtual bool      action( const int );
98   virtual bool      dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
99
100   virtual QAction*  synchronizeAction();
101   static void       synchronizeView( SUIT_ViewWindow* viewWindow, int id );
102   
103   SUIT_Desktop*     myDesktop;
104   SUIT_ViewManager* myManager;
105
106 protected slots:
107   void              updateSyncViews();
108   void              onSynchronizeView(bool);
109   virtual void      synchronize( SUIT_ViewWindow* );
110   void              emitViewModified();
111   
112 private:
113   typedef QMap< int, QList<QtxMultiAction*> > ActionsMap;
114
115   QtxActionToolMgr* myToolMgr;
116   bool              myIsDropDown;
117   ActionsMap        myMultiActions;
118   QAction*          mySyncAction;
119 };
120
121 #endif // SUIT_VIEWWINDOW_H