]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx
Updated Version with the moving of the objects updated and the background doesn't...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GBlackBoxController.cxx
index 7cdf253320c15db89d9aa4bf4d1a2149e2091aad..bafa37f019402b0de5a36bc0c19179e6334afe1a 100644 (file)
@@ -52,6 +52,98 @@ namespace bbtk
        }
        //=========================================================================
 
+       bool GBlackBoxController::OnMouseMove()
+       {
+               
+               if ( _vtkInteractorStyleBaseView!=NULL)
+               {
+                       int X,Y;
+                       wxVTKRenderWindowInteractor *_wxVTKiren;
+                       _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+                       _wxVTKiren->GetEventPosition( X , Y );
+
+                       int state  = _view->getState();
+                       
+                       //Evaluate new state
+                       
+                       if(state == NOTHING_HAPPENS)
+                       {
+                               if(_view->isPointInside(X,Y))
+                               {
+                                       _view->setState(HIGHLIGHTED);   
+                               }                       
+                       }
+                       if( state==HIGHLIGHTED)
+                       {
+                               if(!_view->isPointInside(X,Y))
+                               {
+                                       _view->setState(NOTHING_HAPPENS);
+                               }
+                       }
+                       
+                       _model->notifyObservers(_id);
+                       
+               }
+               return true;
+       }
+
+       //=========================================================================
+       
+       bool GBlackBoxController::OnLeftButtonDown()
+       {
+               int state  = _view->getState();
+                       
+               //Evaluate new state
+               if(state == HIGHLIGHTED)
+               {
+                       _isLeftClickDown=true;
+                       _view->setState(SELECTED);
+                       _model->notifyObservers(_id,ADD_TO_SELECTED);
+               }
+               return true;
+
+       }
+
+       //=========================================================================
+       
+       bool GBlackBoxController::OnLeftButtonUp()
+       {
+               int X,Y;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
+
+               int state  = _view->getState();
+                       
+               //Evaluate new state
+               if(_isLeftClickDown)
+               {
+                       _isLeftClickDown=false;
+                       if(_view->isPointInside(X,Y))
+                       {
+                               // It is supposed that I'm always inside even if the box is in drag
+                               _view->setState(SELECTED);
+                               _model->notifyObservers(_id);
+                       }
+               }
+               return true;
+               
+       }
+       
+       //=========================================================================
+       
+       bool GBlackBoxController::OnLeftDClick()
+       {
+               
+               return true;
+       }
+       
+       //=========================================================================
+       
+       bool GBlackBoxController::OnRightButtonDown()
+       {
+               return true;
+       }
 
        //=========================================================================