--- /dev/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)
+//=====
+#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
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaMaracasVisuwxPopupMenu_h_INCLUDED__
+#define __bbcreaMaracasVisuwxPopupMenu_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+#include <wx/datetime.h>
+
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#ifdef __WXGTK__
+# include <locale.h>
+#endif //__WXGTK__
+// EO Wx headers
+
+#include "wxVtkBaseView.h"
+
+
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT wxPopupMenu
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(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)
+//=====
+ BBTK_DECLARE_INPUT(In,std::vector< std::string >);
+ BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*);
+// BBTK_DECLARE_INPUT(Position,std::vector< int >);
+ BBTK_DECLARE_OUTPUT(Out,int);
+ BBTK_DECLARE_OUTPUT(SimpleText,std::string);
+ BBTK_PROCESS(Process);
+ void Process();
+ bool 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxPopupMenu,bbtk::AtomicBlackBox);
+ BBTK_NAME("wxPopupMenu");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(wxPopupMenu,In,"Vector of items",std::vector< std::string >,"");
+// BBTK_INPUT(wxPopupMenu,Position,"Window position",std::vector< int >,"");
+ BBTK_INPUT(wxPopupMenu,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,"");
+ BBTK_OUTPUT(wxPopupMenu,Out,"Sected item",int,"");
+ BBTK_OUTPUT(wxPopupMenu,SimpleText,"Text selected item",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(wxPopupMenu);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuwxPopupMenu_h_INCLUDED__
+
// Fathers object
//<FATHERCLASS>::CopyAttributesTo(cloneObject);
- cloneObject->SetActive( this->GetActive() );
+ cloneObject->SetActive( this->GetActive() );
}
class creaMaracasVisu_EXPORT InteractorStyleMaracas
{
public:
- InteractorStyleMaracas();
- virtual ~InteractorStyleMaracas();
-
- virtual InteractorStyleMaracas * Clone();
- void CopyAttributesTo( InteractorStyleMaracas *cloneObject );
-
-
- virtual bool OnChar();
- virtual bool OnMouseMove();
- virtual bool OnLeftButtonDown();
- virtual bool OnLeftButtonUp();
- virtual bool OnMiddleButtonDown();
- virtual bool OnMiddleButtonUp();
- virtual bool OnRightButtonDown();
- virtual bool OnRightButtonUp();
-
- virtual bool OnLeftDClick();
- virtual bool OnRightDClick();
- virtual bool OnMiddleDClick();
-
- virtual bool OnMouseWheelForward();
- virtual bool OnMouseWheelBackward();
-
- void SetVtkInteractorStyleBaseView(vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView);
- void RemoveVtkInteractorStyleBaseView();
-
- void SetActive(bool active);
- bool GetActive();
-
+ InteractorStyleMaracas();
+ virtual ~InteractorStyleMaracas();
+ virtual InteractorStyleMaracas * Clone();
+ void CopyAttributesTo( InteractorStyleMaracas *cloneObject );
+ virtual bool OnChar();
+ virtual bool OnMouseMove();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+ virtual bool OnMiddleButtonDown();
+ virtual bool OnMiddleButtonUp();
+ virtual bool OnRightButtonDown();
+ virtual bool OnRightButtonUp();
+ virtual bool OnLeftDClick();
+ virtual bool OnRightDClick();
+ virtual bool OnMiddleDClick();
+ virtual bool OnMouseWheelForward();
+ virtual bool OnMouseWheelBackward();
+ void SetVtkInteractorStyleBaseView(vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView);
+ void RemoveVtkInteractorStyleBaseView();
+ void SetActive(bool active);
+ bool GetActive();
protected:
-
vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView;
//vtkInteractorStyleImage* _vtkInteractorStyleBaseView;
-
private:
bool _active;
};
vtkInteractorStyleBaseView3D();
~vtkInteractorStyleBaseView3D();
static vtkInteractorStyleBaseView3D *New();
-
- virtual void OnMouseMove () ;
- virtual void OnLeftButtonDown ();
- virtual void OnLeftButtonUp () ;
- virtual void OnMiddleButtonDown ();
- virtual void OnMiddleButtonUp () ;
- virtual void OnRightButtonDown () ;
- virtual void OnRightButtonUp () ;
+ virtual void OnMouseMove () ;
+ virtual void OnLeftButtonDown ();
+ virtual void OnLeftButtonUp () ;
+ virtual void OnMiddleButtonDown ();
+ virtual void OnMiddleButtonUp () ;
+ virtual void OnRightButtonDown () ;
+ virtual void OnRightButtonUp () ;
virtual void OnMouseWheelForward();
virtual void OnMouseWheelBackward();
-
private:
-
};
#endif /*VTKINTERACTORSTYLEBASEVIEW3D_H_*/