]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
switch SVTK/VVTK interactor styles is improved (boolean slot).
authorasv <asv@opencascade.com>
Tue, 30 Aug 2005 05:55:10 +0000 (05:55 +0000)
committerasv <asv@opencascade.com>
Tue, 30 Aug 2005 05:55:10 +0000 (05:55 +0000)
src/VVTK/VVTK_ViewWindow.cxx
src/VVTK/VVTK_ViewWindow.h

index f42c30501c011544540f9fb08d0b5219bf72832f..dce4e48e0347a89a49841c0f4c1f3939f9344b6d 100755 (executable)
@@ -18,10 +18,11 @@ VVTK_ViewWindow
                   VVTK_Viewer* theModel )
   : SVTK_ViewWindow( theDesktop, theModel )
 {
+  // important! : the default interactor style which is pushed is VVTK
+  // see onSwitchIS() for details
   getView()->pushInteractorStyle( VVTK_InteractorStyle::New() );
 
-  connect(this,SIGNAL(selectionChanged()),
-         theModel,SLOT(onSelectionChanged()));
+  connect(this,SIGNAL(selectionChanged()),theModel,SLOT(onSelectionChanged()));
 
   // create another toolbar
   myToolBar = new QToolBar(this);
@@ -31,9 +32,11 @@ VVTK_ViewWindow
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
   // SVTK / VVTK switcher action
   QtxAction* aAction = new QtxAction(tr("MNU_VVTK_SWITCH"), aResMgr->loadPixmap( "VISU", tr( "ICON_VVTK_SWITCH" ) ),
-                                    tr( "MNU_VVTK_SWITCH" ), 0, this);
+                                    tr( "MNU_VVTK_SWITCH" ), 0, this, "vvtk/svtk", true);
+  aAction->setToggleAction(true); // pressed by default
+  aAction->toggle();
   aAction->setStatusTip(tr("DSC_VVTK_SWITCH"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onSwitchIS()));
+  connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchIS(bool)));
   aAction->addTo( myToolBar );
 }
 
@@ -46,7 +49,14 @@ VVTK_ViewWindow
 //----------------------------------------------------------------------------
 void
 VVTK_ViewWindow
-::onSwitchIS()
+::onSwitchIS(bool isVVTK)
 {
-  printf( "onswitch IS \n\n" );
+  // default interactor style which is pushed in this view window constructor
+  // is VVTK.  If it is a current interactor style -- push SVTK "above" it.
+  // if SVTK is a current one - pop it (remove from stack), below it there MUST BE
+  // (logically) a VVTK interactor style.
+  if ( isVVTK )
+    getView()->popInteractorStyle();
+  else
+    getView()->pushInteractorStyle( SVTK_InteractorStyle::New() );
 }
index e646b9255d89ecacac07fdb2d0b58329bd0b18a0..a946bf055689a1a399dd1c5238ed37458925c785 100755 (executable)
@@ -20,7 +20,7 @@ public:
   virtual ~VVTK_ViewWindow();
 
 protected slots:
-  void onSwitchIS(); 
+  void onSwitchIS(bool isVVTK); 
 
 private:
   QToolBar* myToolBar;