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