]> SALOME platform Git repositories - modules/gui.git/blob - src/SUPERVGraph/SUPERVGraph_ViewFrame.h
Salome HOME
985c5708502490e757c6c1ddd8a98263428fa811
[modules/gui.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 "SUPERVGraph.h"
33
34 #include "SALOME_InteractiveObject.hxx"
35 #include "SUIT_PopupClient.h"
36 #include "SUIT_ViewWindow.h"
37
38 #include <qaction.h>
39
40 class SUPERVGRAPH_EXPORT SUPERVGraph_View: public QWidget, public SUIT_PopupClient {
41   Q_OBJECT;
42  public:
43   static QString Type() { return "SUPERVGraphViewer"; }
44
45   SUPERVGraph_View(QWidget* theParent);
46   SUPERVGraph_View(SUPERVGraph_View* theParent);
47
48   virtual void ActivatePanning() = 0;
49   virtual void ResetView() = 0;
50
51   /* redefine functions from SUIT_PopupClient */
52   virtual QString popupClientType() const { return Type(); }
53   virtual void    contextMenuPopup( QPopupMenu* );
54   
55   virtual void resizeView( QResizeEvent* theEvent ) {};
56   
57  protected:
58   void init(QWidget* theParent);
59   
60 };
61
62 class SUPERVGRAPH_EXPORT SUPERVGraph_ViewFrame : public SUIT_ViewWindow {
63   Q_OBJECT
64
65     public:
66   SUPERVGraph_ViewFrame(SUIT_Desktop* theDesktop );
67   ~SUPERVGraph_ViewFrame();
68
69   SUPERVGraph_View*              getViewWidget();
70   void                           setViewWidget(SUPERVGraph_View* theView);
71
72   void                           setBackgroundColor( const QColor& );
73   QColor                         backgroundColor() const;
74   
75   void                           onAdjustTrihedron( );
76   
77   /*  interactive object management */
78   void                           highlight( const Handle(SALOME_InteractiveObject)& IObject, 
79                                             bool highlight, bool immediatly = true );
80   void                           unHighlightAll();
81   void                           rename( const Handle(SALOME_InteractiveObject)& IObject,
82                                          QString newName );
83   bool                           isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
84   bool                           isVisible( const Handle(SALOME_InteractiveObject)& IObject );
85   
86   /* selection */
87   Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
88
89   /* display */         
90   void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
91   void           DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){};
92   void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
93   void           DisplayAll(){};
94   void           EraseAll(){};
95   void           Repaint() {};
96
97  public slots:
98   void           onViewPan(); 
99   void           onViewZoom();
100   void           onViewFitAll();
101   void           onViewFitArea();
102   void           onViewGlobalPan(); 
103   void           onViewRotate();
104   void           onViewReset();     
105   void           onViewFront(); 
106   void           onViewBack(); 
107   void           onViewRight(); 
108   void           onViewLeft();     
109   void           onViewBottom();
110   void           onViewTop();
111   void           onViewTrihedron(); 
112
113  protected:
114   void           resizeEvent( QResizeEvent* theEvent );
115   
116  private:
117   void           createActions();
118   void           createToolBar();
119
120   //! Actions ID
121   enum { PanId, ResetId };
122   typedef QMap<int, QAction*> ActionsMap;
123
124   ActionsMap       myActionsMap;
125   QToolBar*        myToolBar;
126
127   SUPERVGraph_View* myView;
128 }; 
129 #endif