]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx
Implemented deleting of boxes from the scene....
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GPortController.cxx
index 33794ce4468e1b054701803e7ec7ee2ea7cd9e5a..c15a276efc67696d6fc55d0fed343ae5f1a939a9 100644 (file)
@@ -43,7 +43,7 @@ namespace bbtk
        //=========================================================================
        GPortController::GPortController()
        {
-               
+               _isLeftClickDown=false;
        }
 
        //=========================================================================
@@ -52,9 +52,52 @@ namespace bbtk
        }
        //=========================================================================
 
+       bool GPortController::OnLeftButtonDown()
+       {
+               
+               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(getId(),INIT_CREATION_CONTOUR);
+                               }
+                               else if (portType==GINPUTPORT)
+                               {
+                                       _model->notifyObservers(getId(),FIN_CREATION_CONTOUR);
+                               }
+                       }
+                       else
+                       {
+                               _view->setState(NOTHING_HAPPENS);
+                       }
+                       _isLeftClickDown=false; 
+               }
+
+               return true;
+       }
 
        //=========================================================================
 
+       
+
 }  // EO namespace bbtk
 
 // EOF