Salome HOME
PR: mergefrom_PAL_OCC_21Oct04
[modules/kernel.git] / src / SUPERVGraph / SUPERVGraph_ViewFrame.h
1 //  SALOME SUPERVGraph : build Supervisor viewer into desktop
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SUPERVGraph_ViewFrame.h
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef SUPERVGraph_ViewFrame_H
30 #define SUPERVGraph_ViewFrame_H
31
32 #include "QAD.h"
33 #include "QAD_ViewFrame.h"
34 #include "QAD_Application.h"
35
36 #include "SALOME_InteractiveObject.hxx"
37 #include "SALOME_Selection.h" 
38
39 class QAD_EXPORT SUPERVGraph_View: public QWidget, public QAD_PopupClientServer{
40   Q_OBJECT;
41  public:
42   SUPERVGraph_View(QWidget* theParent);
43   SUPERVGraph_View(SUPERVGraph_View* theParent);
44
45   virtual void ActivatePanning() = 0;
46   virtual void ResetView() = 0;
47  protected:
48   void init(QWidget* theParent);
49   void onCreatePopup();
50 };
51
52 class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame {
53   Q_OBJECT
54
55     public:
56   SUPERVGraph_ViewFrame(QWidget* parent, const char* name=0 );
57   ~SUPERVGraph_ViewFrame();
58
59   ViewType                       getTypeView() const{ return VIEW_GRAPHSUPERV;};
60   SUPERVGraph_View*              getViewWidget();
61   void                           setViewWidget(SUPERVGraph_View* theView);
62
63   void                           setBackgroundColor( const QColor& );
64   QColor                         backgroundColor() const;
65   
66   void                           SetSelectionMode( Selection_Mode mode );
67
68   void                           onAdjustTrihedron( );
69   
70   /*  popup management */
71   void                           setPopupServer( QAD_Application* );
72
73   /*  interactive object management */
74   void                           highlight( const Handle(SALOME_InteractiveObject)& IObject, 
75                                             bool highlight, bool immediatly = true );
76   void                           unHighlightAll();
77   void                           rename( const Handle(SALOME_InteractiveObject)& IObject,
78                                          QString newName );
79   bool                           isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
80   bool                           isVisible( const Handle(SALOME_InteractiveObject)& IObject );
81
82   /*  undo/redo management */
83   void              undo(SALOMEDS::Study_var aStudy,
84                          const char* StudyFrameEntry);
85   void              redo(SALOMEDS::Study_var aStudy,
86                          const char* StudyFrameEntry);
87
88
89   /* selection */
90   Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
91
92   /* display */         
93   void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
94   void           DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){};
95   void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
96   void           DisplayAll(){};
97   void           EraseAll(){};
98   void           Repaint() {};
99
100  public slots:
101   void           onViewPan(); 
102   void           onViewZoom();
103   void           onViewFitAll();
104   void           onViewFitArea();
105   void           onViewGlobalPan(); 
106   void           onViewRotate();
107   void           onViewReset();     
108   void           onViewFront(); 
109   void           onViewBack(); 
110   void           onViewRight(); 
111   void           onViewLeft();     
112   void           onViewBottom();
113   void           onViewTop();
114   void           onViewTrihedron(); 
115  
116  private:
117   SUPERVGraph_View* myView;
118   QAD_Application* myApp;
119 }; 
120 #endif