Salome HOME
0022256: [CEA 866] Add item "Developers" in menu "Help"
[modules/gui.git] / src / SUPERVGraph / SUPERVGraph_ViewFrame.h
1 // Copyright (C) 2007-2013  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 //  SALOME SUPERVGraph : build Supervisor viewer into desktop
24 //  File   : SUPERVGraph_ViewFrame.h
25 //  Author : Nicolas REJNERI
26
27 #ifndef SUPERVGraph_ViewFrame_H
28 #define SUPERVGraph_ViewFrame_H
29
30 #include "SUPERVGraph.h"
31
32 #include "SALOME_InteractiveObject.hxx"
33 #include "SUIT_PopupClient.h"
34 #include "SUIT_ViewWindow.h"
35
36 #include <QtxAction.h>
37
38 #ifdef WIN32
39 #pragma warning ( disable:4251 )
40 #endif
41
42 class SUPERVGRAPH_EXPORT SUPERVGraph_View: public QWidget, public SUIT_PopupClient {
43   Q_OBJECT;
44  public:
45   static QString Type() { return "SUPERVGraphViewer"; }
46
47   SUPERVGraph_View(QWidget* theParent);
48   SUPERVGraph_View(SUPERVGraph_View* theParent);
49
50   virtual void ActivatePanning() = 0;
51   virtual void ResetView() = 0;
52
53   /* redefine functions from SUIT_PopupClient */
54   virtual QString popupClientType() const { return Type(); }
55   virtual void    contextMenuPopup( QMenu* );
56   
57   virtual void resizeView( QResizeEvent* theEvent ) {};
58   
59  protected:
60   void init(QWidget* theParent);
61   
62 };
63
64 class SUPERVGRAPH_EXPORT SUPERVGraph_ViewFrame : public SUIT_ViewWindow {
65   Q_OBJECT
66
67     public:
68   SUPERVGraph_ViewFrame(SUIT_Desktop* theDesktop );
69   ~SUPERVGraph_ViewFrame();
70
71   SUPERVGraph_View*              getViewWidget();
72   void                           setViewWidget(SUPERVGraph_View* theView);
73
74   void                           setBackgroundColor( const QColor& );
75   QColor                         backgroundColor() const;
76   
77   void                           onAdjustTrihedron( );
78   
79   /*  interactive object management */
80   void                           highlight( const Handle(SALOME_InteractiveObject)& IObject, 
81                                             bool highlight, bool immediatly = true );
82   void                           unHighlightAll();
83   void                           rename( const Handle(SALOME_InteractiveObject)& IObject,
84                                          QString newName );
85   bool                           isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
86   bool                           isVisible( const Handle(SALOME_InteractiveObject)& IObject );
87   
88   /* selection */
89   Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
90
91   /* display */         
92   void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
93   void           DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){};
94   void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
95   void           DisplayAll(){};
96   void           EraseAll(){};
97   void           Repaint() {};
98
99   QToolBar*      getToolBar() { return myToolBar; }
100
101  public slots:
102   void           onViewPan(); 
103   void           onViewZoom();
104   void           onViewFitAll();
105   void           onViewFitArea();
106   void           onViewGlobalPan(); 
107   void           onViewRotate();
108   void           onViewReset();     
109   void           onViewFront(); 
110   void           onViewBack(); 
111   void           onViewRight(); 
112   void           onViewLeft();     
113   void           onViewBottom();
114   void           onViewTop();
115   void           onViewTrihedron(); 
116
117  protected:
118   void           resizeEvent( QResizeEvent* theEvent );
119   
120  private:
121   void           createActions();
122   void           createToolBar();
123
124   //! Actions ID
125   enum { PanId, ResetId };
126   typedef QMap<int, QtxAction*> ActionsMap;
127
128   ActionsMap       myActionsMap;
129   QToolBar*        myToolBar;
130
131   SUPERVGraph_View* myView;
132 };
133
134 #ifdef WIN32
135 #pragma warning ( default:4251 )
136 #endif
137
138 #endif