+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+#include "bbcreaMaracasVisuwxPopupMenu.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include <wx/menu.h>
+#include "InteractorStyleMaracas.h"
+#include <vtkInteractorStyleBaseView.h>
+
+namespace bbcreaMaracasVisu
+{
+
+
+class PopupMenuInteractor : public InteractorStyleMaracas
+{
+public:
+ PopupMenuInteractor( wxPopupMenu *box, wxVtkBaseView *wxvtkbaseview );
+ ~PopupMenuInteractor();
+// virtual bool OnLeftButtonDown();
+// virtual bool OnLeftButtonUp();
+// virtual bool OnMouseMove();
+// virtual bool OnRightButtonDown();
+ virtual bool OnRightButtonUp();
+// virtual bool OnLeftDClick();
+ void OnPopupClick(wxCommandEvent &evt);
+
+private:
+ wxVtkBaseView *_wxvtkbaseview;
+ wxPopupMenu *_box;
+};
+
+PopupMenuInteractor::PopupMenuInteractor( wxPopupMenu *box , wxVtkBaseView *wxvtkbaseview )
+{
+ _wxvtkbaseview = wxvtkbaseview;
+ _box = box;
+}
+
+PopupMenuInteractor::~PopupMenuInteractor()
+{
+}
+
+void PopupMenuInteractor::OnPopupClick(wxCommandEvent &evt)
+{
+// void *data=static_cast<wxMenu *>(evt.GetEventObject())->GetClientData();
+// switch( evt.GetId()) {
+// case ID_SOMETHING:
+// break;
+// case ID_SOMETHING_ELSE:
+// break;
+// }
+
+ printf("EED PopupMenuInteractor::OnPopupClick %d\n", evt.GetId() );
+
+}
+
+bool PopupMenuInteractor::OnRightButtonUp()
+{
+ if (_wxvtkbaseview!=NULL)
+ {
+ wxWindow* window = _wxvtkbaseview->GetWxVTKRenderWindowInteractor();
+ const wxPoint pt = wxGetMousePosition();
+ int x = pt.x - window->GetScreenPosition().x;
+ int y = pt.y - window->GetScreenPosition().y;
+ wxMenu menu;
+ std::vector<std::string> lstItems = _box->bbGetInputIn();
+ int i,size = lstItems.size();
+ for (i=0;i<size;i++)
+ {
+ menu.Append(i+1000, lstItems[i] );
+ } // for
+// menu.Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuInteractor::OnPopupClick), NULL, this);
+// Connect( mwxCommandButton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &CommandButtonWidget::OnCommandButton );
+ menu.Connect( wxEVT_COMMAND_MENU_SELECTED , (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &PopupMenuInteractor::OnPopupClick );
+
+
+ window->PopupMenu(&menu,x,y);
+ } // if _vtkbaseview
+}
+
+
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,wxPopupMenu)
+BBTK_BLACK_BOX_IMPLEMENTATION(wxPopupMenu,bbtk::AtomicBlackBox);
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void wxPopupMenu::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+
+ if (firsttime==true)
+ {
+ firsttime=false;
+
+ if (bbGetInputwxVtkBaseView()!=NULL)
+ {
+ PopupMenuInteractor* popupmenuinteractor = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView() );
+ vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView() );
+ vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor );
+ } // if wxVtkBaseView
+ } // if firsttime
+
+}
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void wxPopupMenu::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+
+ firsttime=true;
+ bbSetInputwxVtkBaseView(NULL);
+
+}
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void wxPopupMenu::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void wxPopupMenu::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+