]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx
no message
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GBlackBoxController.cxx
index bafa37f019402b0de5a36bc0c19179e6334afe1a..93e06fa2fe1eec7e4595764be469d77281f2db6f 100644 (file)
@@ -81,7 +81,7 @@ namespace bbtk
                                }
                        }
                        
-                       _model->notifyObservers(_id);
+                       _model->notifyObservers(getId());
                        
                }
                return true;
@@ -98,7 +98,7 @@ namespace bbtk
                {
                        _isLeftClickDown=true;
                        _view->setState(SELECTED);
-                       _model->notifyObservers(_id,ADD_TO_SELECTED);
+                       _model->notifyObservers(getId(),ADD_TO_SELECTED);
                }
                return true;
 
@@ -123,7 +123,7 @@ namespace bbtk
                        {
                                // It is supposed that I'm always inside even if the box is in drag
                                _view->setState(SELECTED);
-                               _model->notifyObservers(_id);
+                               _model->notifyObservers(getId());
                        }
                }
                return true;
@@ -131,17 +131,39 @@ namespace bbtk
        }
        
        //=========================================================================
-       
-       bool GBlackBoxController::OnLeftDClick()
+
+       bool GBlackBoxController::OnRightButtonUp()
        {
-               
                return true;
        }
-       
+
        //=========================================================================
-       
-       bool GBlackBoxController::OnRightButtonDown()
+
+       bool GBlackBoxController::OnMiddleButtonDown()
        {
+               int X,Y;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
+
+               int state  = _view->getState();
+
+               //Evaluate new state
+               if(_view->isPointInside(X,Y))
+               {
+                       GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
+                       _view->setState(HIGHLIGHTED);
+                       if(bbmodel->isExecutable())
+                       {
+                               bbmodel->setExecutable(false);
+                       }
+                       else
+                       {
+                               bbmodel->setExecutable(true);                           
+                       }
+                       bbmodel->notifyObservers(getId());
+               }
+                       
                return true;
        }