From 674dc4904c0cb717e7413af6b9871b0d50fd314f Mon Sep 17 00:00:00 2001 From: donadio Date: Tue, 28 Apr 2009 14:42:44 +0000 Subject: [PATCH] *** empty log message *** --- src2/CMakeLists.txt | 1 + src2/creaImageIOWxGimmickPanel.cpp | 104 +++++++++++++++++++++++++++++ src2/creaImageIOWxGimmickPanel.h | 75 +++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 src2/creaImageIOWxGimmickPanel.cpp create mode 100644 src2/creaImageIOWxGimmickPanel.h diff --git a/src2/CMakeLists.txt b/src2/CMakeLists.txt index 18228ce..54b2ba8 100644 --- a/src2/CMakeLists.txt +++ b/src2/CMakeLists.txt @@ -45,6 +45,7 @@ SET( SRCS creaImageIOWxTreeView creaImageIOWxGimmickReaderDialog creaImageIOWxGimmickFrame + creaImageIOWxGimmickPanel # BlockScopeWxApp diff --git a/src2/creaImageIOWxGimmickPanel.cpp b/src2/creaImageIOWxGimmickPanel.cpp new file mode 100644 index 0000000..13ca31b --- /dev/null +++ b/src2/creaImageIOWxGimmickPanel.cpp @@ -0,0 +1,104 @@ +#include +#include + +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" + <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" + <Finalize(); + delete mGimmick; + } + } + +//====================================================================== + +//====================================================================== + + ///Callback method on a selection + void WxGimmickPanel::OnSelectedImage(bool t) + { + //GetSelectedImages(std::vector& s, int dim); + mSendImageSignal(t); + } + + //================================================================ + // BEGIN_EVENT_TABLE(WxGimmickPanel, wxDialog) + // END_EVENT_TABLE() + //================================================================ + + + //==================================================================== + + //==================================================================== + void WxGimmickPanel::ConnectSendImageObserver(SendImageCallbackType callback) + { + mSendImageSignal.connect(callback); + } + +} // EO namespace creaImageIO + + diff --git a/src2/creaImageIOWxGimmickPanel.h b/src2/creaImageIOWxGimmickPanel.h new file mode 100644 index 0000000..dd873f6 --- /dev/null +++ b/src2/creaImageIOWxGimmickPanel.h @@ -0,0 +1,75 @@ +#ifndef __creaImageIOWxGimmickPanel_h_INCLUDED__ +#define __creaImageIOWxGimmickPanel_h_INCLUDED__ + +#ifdef USE_WXWIDGETS + +// Signal/slot mechanism for progress events +#include +#include + +#include +#include + +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 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& 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 -- 2.45.0