]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx
Stable version ... The connection is correctly painted :)
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GPortController.cxx
index 33794ce4468e1b054701803e7ec7ee2ea7cd9e5a..e2203ce8fd09136b278347d8de868a9f7244496b 100644 (file)
@@ -43,7 +43,7 @@ namespace bbtk
        //=========================================================================
        GPortController::GPortController()
        {
-               
+               _isLeftClickDown=false;
        }
 
        //=========================================================================
@@ -52,9 +52,61 @@ namespace bbtk
        }
        //=========================================================================
 
+       bool GPortController::OnLeftButtonDown()
+       {
+               
+               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 == HIGHLIGHTED)
+                       {
+                               _isLeftClickDown=true;
+                       }
+
+               }
+               return true;
+       }
+       //=========================================================================
+       bool GPortController::OnLeftButtonUp()
+       {
+               int state  = _view->getState();
+               if(_isLeftClickDown)
+               {
+                       if(state==HIGHLIGHTED)
+                       {
+                               int portType = ((GPortModel*)_model)->getPortType();
+
+                               //Evaluate new state
+                               if(portType==GOUTPUTPORT)
+                               {
+                                       _model->notifyObservers(_id,INIT_CREATION_CONTOUR);
+                               }
+                               else if (portType==GINPUTPORT)
+                               {
+                                       _model->notifyObservers(_id,FIN_CREATION_CONTOUR);
+                               }
+                       }
+                       else
+                       {
+                               _view->setState(NOTHING_HAPPENS);
+                       }
+                       _isLeftClickDown=false; 
+               }
+
+               return true;
+       }
 
        //=========================================================================
 
+       
+
 }  // EO namespace bbtk
 
 // EOF