Salome HOME
new function initView() is added in order to easily customize creation of a new view...
authorasv <asv@opencascade.com>
Tue, 23 Aug 2005 12:23:30 +0000 (12:23 +0000)
committerasv <asv@opencascade.com>
Tue, 23 Aug 2005 12:23:30 +0000 (12:23 +0000)
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h

index acfb8cf2eda7f579d05b13fb6ce4bdf1c0ec9ae8..bf90792a5a7b22cb3fe0932bf3195d7b7267e492 100755 (executable)
@@ -88,16 +88,23 @@ void OCCViewer_Viewer::setBackgroundColor( const QColor& c )
     myBgColor = c;
 }
 
-SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop )
+void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
 {
-  OCCViewer_ViewWindow* res = new OCCViewer_ViewWindow(theDesktop, this);
-  res->initLayout();
+  if ( view ) {
+    view->initLayout();
+    
+    OCCViewer_ViewPort3d* vp3d = view->getViewPort();
+    if ( vp3d )
+      vp3d->setBackgroundColor( myBgColor );
+  }
+}
 
-  OCCViewer_ViewPort3d* vp3d = res->getViewPort();
-  if ( vp3d )
-    vp3d->setBackgroundColor( myBgColor );
 
-  return res;
+SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop )
+{
+  OCCViewer_ViewWindow* view = new OCCViewer_ViewWindow(theDesktop, this);
+  initView( view );
+  return view;
 }
 
 //*********************************************************************
index d42be6a251fa8b24c82e197d9d038a1462eb2075..64e153ad35f093c745072c26a016cd832b6a5e0a 100755 (executable)
@@ -15,6 +15,7 @@
 
 class SUIT_ViewWindow;
 class SUIT_Desktop;
+class OCCViewer_ViewWindow;
 
 struct viewAspect
 {
@@ -121,6 +122,9 @@ public:
 signals:
   void selectionChanged();
 
+protected:
+  void initView( OCCViewer_ViewWindow* view );
+
 protected slots:
   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
   void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);