/**
* \defgroup Tree Attributed tree management
*/
+ /**
+ * \defgroup Previewer Preview related
+ */
/**
* \ingroup Controller
#include <creaImageIOGimmickView.h>
#include <creaImageIOSystem.h>
+#include "boost/filesystem.hpp"
+
+namespace fs = boost::filesystem;
+
namespace creaImageIO
{
//======================================================================
{
mMessage="Selection OK !";
}
+ mValidationSignal(valid);
SetMessage(mMessage);
return valid;
}
mImageEventQueue.push_back(ImageEventType(i->second,image));
}
}
+
+ //====================================================================
+
+ //====================================================================
+ void GimmickView::ConnectValidationObserver(ValidationCallbackType callback)
+ {
+ mValidationSignal.connect(callback);
+ }
} // EO namespace creaImageIO
#include <vtkImageData.h>
#include <creaImageIOMultiThreadImageReader.h>
+// Signal/slot mechanism for progress events
+#include <boost/signal.hpp>
+#include <boost/bind.hpp>
+
#define GIMMICK_NO_IMAGE_SELECTION 0
#define GIMMICK_2D_IMAGE_SELECTION 2
#define GIMMICK_3D_IMAGE_SELECTION 3
MultiThreadImageReaderUser::EventType t,
vtkImageData* image);
+ //=============================================
+ typedef boost::signal<void (bool)> ValidationSignalType;
+ typedef ValidationSignalType::slot_function_type ValidationCallbackType;
+ //=============================================
+
+ //==================================================================
+ /// 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:
+ /// ConnectValidationObserver ( boost::bind( &C::f , c, _1 ) );
+ void ConnectValidationObserver(ValidationCallbackType callback);
+ //==================================================================
+
private:
/// Controller which manages the interaction with the model
Gimmick* mGimmick;
// queue of image event
typedef std::deque<ImageEventType> ImageEventQueueType;
ImageEventQueueType mImageEventQueue;
+
+ ValidationSignalType mValidationSignal;
};
// EO class GimmickView
mGimmick = new Gimmick();
mGimmick->Initialize();
-
+
mView = new WxGimmickView(mGimmick,
this,
max_dim,
threads);
mView->Initialize();
+ // Connect the AddProgress callback
+ mView->ConnectValidationObserver
+ ( boost::bind( &WxGimmickReaderDialog::OnValid , this, _1 ) );
}
catch (crea::Exception e)
{
}
///Callback method on a selection
- void WxGimmickReaderDialog::OnValid(wxCommandEvent& event)
+ void WxGimmickReaderDialog::OnValid(bool t)
{
- // bool t=mView->ValidateSelection(event.GetClientData());
- // TO DO
- // mOkButton->Enable(t);
+ mOkButton->Enable(t);
}
//================================================================
- BEGIN_EVENT_TABLE(WxGimmickReaderDialog, wxDialog)
- EVT_COMMAND(wxID_ANY, 0, WxGimmickReaderDialog::OnValid)
- END_EVENT_TABLE()
+ //BEGIN_EVENT_TABLE(WxGimmickReaderDialog, wxDialog)
+ //END_EVENT_TABLE()
//================================================================
void OnSelChanged(EventType& event);
void OnContextualMenu(EventType& event);
void OnMenuTest(wxCommandEvent& event);
- void OnValid(wxCommandEvent& event);
+ void OnValid(bool valid);
// void OnButtonOk(wxCommandEvent& event);
- // void OnButtonCancel(wxCommandEvent& event);
-
- DECLARE_EVENT_TABLE()
-
+ // void OnButtonCancel(wxCommandEvent& event);
private :