#include "bbPackRecalageImageSwitcherBox.h" #include "bbPackRecalagePackage.h" namespace bbPackRecalage { MyTimer::MyTimer(ImageSwitcherBox *box): wxTimer() { _box = box; } MyTimer::~MyTimer() { } void MyTimer::Notify() { _box->Process(); } BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,ImageSwitcherBox) BBTK_BLACK_BOX_IMPLEMENTATION(ImageSwitcherBox,bbtk::WxBlackBox); void ImageSwitcherBox::Process() { time = bbGetInputTime(); if(myTimer == NULL) { myTimer = new MyTimer(this); myTimer->Start(time); oldTime = time; } else if(oldTime != time) { myTimer->Start(time); oldTime = time; } if(change == false) { bbSetOutputOut(bbGetInputIn1()); change = true; } else { bbSetOutputOut(bbGetInputIn2()); change = false; } } void ImageSwitcherBox::CreateWidget(wxWindow* parent) { bbSetOutputWidget( new wxButton ( parent , -1 , _T("Start/Stop Image Change") ) ); } void ImageSwitcherBox::bbUserSetDefaultValues() { myTimer = NULL; change = false; time = -1; oldTime = -1; } void ImageSwitcherBox::bbUserInitializeProcessing() { } void ImageSwitcherBox::bbUserFinalizeProcessing() { myTimer->Stop(); delete myTimer; } } // EO namespace bbPackRecalage