X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=creaWT.git;a=blobdiff_plain;f=wt%2Fbbtk_wt_PKG%2Fsrc%2FbbwtCommandButton.cxx~;fp=wt%2Fbbtk_wt_PKG%2Fsrc%2FbbwtCommandButton.cxx~;h=0000000000000000000000000000000000000000;hp=1b526afcc8a6bde67c9d98afcc52c107b2da8e66;hb=5bdd6bc07e285c2dc485dd053aaee47356d8689b;hpb=430578713a572cd83e04ca0f65c6e34e87879cd6 diff --git a/wt/bbtk_wt_PKG/src/bbwtCommandButton.cxx~ b/wt/bbtk_wt_PKG/src/bbwtCommandButton.cxx~ deleted file mode 100644 index 1b526af..0000000 --- a/wt/bbtk_wt_PKG/src/bbwtCommandButton.cxx~ +++ /dev/null @@ -1,183 +0,0 @@ -//===== -// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) -//===== -#include "bbwtCommandButton.h" -#include "bbwtPackage.h" -#include "bbtkInterpreter.h" -#include "bbtkExecuter.h" -namespace bbwt -{ - - //--------------------------------------------------------------------------------- - class CommandButtonWidget : public Wt::WContainerWidget - { - public: - CommandButtonWidget(CommandButton* box, - Wt::WContainerWidget *parent, - Wt::WString label); - ~CommandButtonWidget(); - void OnCommandButton(); - void SetLabel(Wt::WString nLabel); - - - - private: - CommandButton* mBox; - Wt::WPushButton *mwtPushButton; - }; - //-------------------------------------------------------------------------- - //-------------------------------------------------------------------------- - CommandButtonWidget::CommandButtonWidget(CommandButton* box, - Wt::WContainerWidget *parent, - Wt::WString label) - : - Wt::WContainerWidget(parent), - mBox(box) - { - Wt::WContainerWidget *container = this; - mwtPushButton = new Wt::WPushButton(label,parent); - mwtPushButton->setMinimumSize(170,30); - mwtPushButton->clicked().connect(this, &CommandButtonWidget::OnCommandButton); - container->addWidget(mwtPushButton); - } - //-------------------------------------------------------------------------- - //-------------------------------------------------------------------------- - CommandButtonWidget::~CommandButtonWidget() - { - } - //-------------------------------------------------------------------------- - //-------------------------------------------------------------------------- - void CommandButtonWidget::OnCommandButton() - { - bbtk::Interpreter::Pointer I; - bbtk::VirtualExec::Pointer E; - if (mBox->bbGetParent() != 0) - { - bbtk::Factory::Pointer f = boost::dynamic_pointer_cast(mBox->bbGetParent()->bbGetDescriptor())->GetFactory(); - if ((f != 0)&& - (f->GetExecuter())) - { - E = f->GetExecuter(); - I = E->GetInterpreter(); - } - } - if (I==0) - { - // bbtkError("CommandButton::DoProcess() : could not find interpreter"); - if (E==0) - { - // If no executer : create a totally independant interpreter - I = bbtk::Interpreter::New(); - } - else - { - // If executer : create an interpreter using E - I = bbtk::Interpreter::New(E); - } - } - - std::string commandstr(mBox->bbGetInputIn()); - - // bbtk::Interpreter::mGlobalInterpreter->InterpretLine( commandstr ); - unsigned int i; - bool ok=true; - int pos1=0,pos2; - pos2 = commandstr.find(";",pos1); - std::string ccommand; - while (ok==true) - { - if (pos2==-1) - { - ok=false; - ccommand=commandstr.substr(pos1,commandstr.length()-pos1 ); - } - else - { - ccommand=commandstr.substr(pos1,pos2-pos1); - } - for ( i=0 ; i < ccommand.length() ; i++) - { - if (ccommand[i]==39) // ' - { - ccommand[i]=34; // " - } - } - I->InterpretLine( ccommand ); - pos1=pos2+1; - pos2 = commandstr.find(";",pos2+1); - - } - mBox->UpdateLabel(); - mBox->bbSignalOutputModification(); - - } - //-------------------------------------------------------------------------- - //-------------------------------------------------------------------------- - void CommandButtonWidget::SetLabel(Wt::WString nLabel) - { - mwtPushButton->setText(nLabel); - } - -BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,CommandButton) -BBTK_BLACK_BOX_IMPLEMENTATION(CommandButton,bbtk::WtBlackBox); -//===== -// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) -//===== -void CommandButton::Process() -{ - - CommandButtonWidget* w = (CommandButtonWidget*)bbGetOutputWidget(); - if (w) - { - UpdateLabel(); - } - -} -//===== -// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) -//===== -void CommandButton::CreateWidget(Wt::WContainerWidget* parent) -{ - - bbSetOutputWidget( new CommandButtonWidget(this, - parent, - bbtk::std2wt(bbGetInputLabel()) - ) - ); - -} -//-------------------------------------------------------------------------------------- - void CommandButton::UpdateLabel() - { - CommandButtonWidget* wtWidget = (CommandButtonWidget*)bbGetOutputWidget(); - wtWidget->SetLabel( bbtk::std2wt( bbGetInputLabel() ) ); - } - -//===== -// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) -//===== -void CommandButton::bbUserSetDefaultValues() -{ - bbSetInputIn(""); - bbSetInputLabel(""); - bbSetOutputWidget(0); - -} -//===== -// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) -//===== -void CommandButton::bbUserInitializeProcessing() -{ - -} -//===== -// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) -//===== -void CommandButton::bbUserFinalizeProcessing() -{ - -} -} -// EO namespace bbwt - -