--- /dev/null
+#include <creaImageIOWxGimmickPanel.h>
+#include <creaImageIOSystem.h>
+
+namespace creaImageIO
+{
+ // CTor
+ WxGimmickPanel::WxGimmickPanel(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ int threads)
+ : wxPanel( parent,
+ id,
+ pos,
+ size,
+ wxRESIZE_BORDER |
+ wxSYSTEM_MENU |
+ wxCLOSE_BOX |
+ wxMAXIMIZE_BOX |
+ wxMINIMIZE_BOX |
+ wxCAPTION
+ ),
+ mGimmick(0),
+ mView(0)
+ {
+ GimmickDebugMessage(1,"WxGimmickPanel::WxGimmickPanel"
+ <<std::endl);
+ wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
+
+ try {
+
+ mGimmick = new Gimmick();
+ mGimmick->Initialize();
+
+ int min_dim = GIMMICK_2D_IMAGE_SELECTION;
+ int max_dim = GIMMICK_3D_IMAGE_SELECTION;
+ mView = new WxGimmickView(mGimmick,
+ this,
+ -1,
+ wxDefaultPosition,
+ size,
+ min_dim,
+ max_dim,
+ threads);
+ mView->Initialize();
+ // Connect the AddProgress callback
+ mView->ConnectValidationObserver ( boost::bind( &WxGimmickPanel::OnSelectedImage , this, _1 ) );
+ }
+ catch (crea::Exception e)
+ {
+ e.Print();
+ return;
+ }
+
+ topsizer->Add( mView,1,wxGROW,0);
+
+ SetSizer( topsizer );
+ Layout();
+ }
+
+ /// Destructor
+ WxGimmickPanel::~WxGimmickPanel()
+ {
+ GimmickDebugMessage(1,"WxGimmickPanel::~WxGimmickPanel"
+ <<std::endl);
+ if (mView)
+ {
+ delete mView;
+ }
+ if (mGimmick)
+ {
+ mGimmick->Finalize();
+ delete mGimmick;
+ }
+ }
+
+//======================================================================
+
+//======================================================================
+
+ ///Callback method on a selection
+ void WxGimmickPanel::OnSelectedImage(bool t)
+ {
+ //GetSelectedImages(std::vector<vtkImageData*>& s, int dim);
+ mSendImageSignal(t);
+ }
+
+ //================================================================
+ // BEGIN_EVENT_TABLE(WxGimmickPanel, wxDialog)
+ // END_EVENT_TABLE()
+ //================================================================
+
+
+ //====================================================================
+
+ //====================================================================
+ void WxGimmickPanel::ConnectSendImageObserver(SendImageCallbackType callback)
+ {
+ mSendImageSignal.connect(callback);
+ }
+
+} // EO namespace creaImageIO
+
+
--- /dev/null
+#ifndef __creaImageIOWxGimmickPanel_h_INCLUDED__
+#define __creaImageIOWxGimmickPanel_h_INCLUDED__
+
+#ifdef USE_WXWIDGETS
+
+// Signal/slot mechanism for progress events
+#include <boost/signal.hpp>
+#include <boost/bind.hpp>
+
+#include <creaImageIOWxGimmickView.h>
+#include <creaWx.h>
+
+namespace creaImageIO
+{
+ /**
+ * \ingroup GUI
+ */
+ //=====================================================================
+ //=====================================================================
+ class CREAIMAGEIO_EXPORT WxGimmickPanel : public wxPanel
+ {
+ public:
+ WxGimmickPanel();
+ WxGimmickPanel(wxWindow *parent,
+ const wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ int threads = 0);
+
+ ~WxGimmickPanel();
+
+ //=============================================
+ typedef boost::signal<void (bool)> SendImageSignalType;
+ typedef SendImageSignalType::slot_function_type SendImageCallbackType;
+ //=============================================
+
+ //==================================================================
+ /// Adds the function f to the list of functions to call
+ /// when the addition progresses.
+ /// f is of type ProgressCallbackType which is:
+ /// void (*ProgressCallbackType)(Progress&)
+ /// To pass a member function 'f' of an instance 'c' of a class 'C'
+ /// as callback you have to 'bind' it, i.e. call:
+ /// ConnectSendImageObserver ( boost::bind( &C::f , c, _1 ) );
+ void ConnectSendImageObserver(SendImageCallbackType callback);
+ //==================================================================
+
+ //===============================================================================================
+ //Image Selection
+ //===============================================================================================
+
+ void GetSelectedImages(std::vector<vtkImageData*>& s, int dim)
+ { mView->GetSelectedImages(s, dim); }
+
+ void OnSelectedImage(bool t);
+
+ // DECLARE_EVENT_TABLE();
+ private :
+
+ Gimmick* mGimmick;
+ WxGimmickView* mView;
+
+ ///The sendImage signal
+ SendImageSignalType mSendImageSignal;
+
+ }; // class WxGimmickPanel
+ //=====================================================================
+
+
+} // EO namespace creaImageIO
+
+
+#endif // USE_WIDGETS
+// EOF
+#endif