#include "bbPackRecalageImageSwitcherBox.h" #include "bbPackRecalagePackage.h" namespace bbPackRecalage { MyTimer::MyTimer(ImageSwitcherBox *box): wxTimer() { _box = box; } MyTimer::~MyTimer() { } void MyTimer::Notify() { _box->Process(); _box->bbSignalOutputModification(std::string("Out")); } BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,ImageSwitcherBox) BBTK_BLACK_BOX_IMPLEMENTATION(ImageSwitcherBox,bbtk::WxBlackBox); void ImageSwitcherBox::Process() { time = bbGetInputTime(); _on = bbGetInputOn(); if(myTimer == NULL) { myTimer = new MyTimer(this); myTimer->Start(time); oldTime = time; } if(oldTime != time && myTimer !=NULL) { myTimer->Stop(); 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 = 500; oldTime = 500; _on = false; } void ImageSwitcherBox::bbUserInitializeProcessing() { } void ImageSwitcherBox::bbUserFinalizeProcessing() { myTimer->Stop(); delete myTimer; } } // EO namespace bbPackRecalage