+++ /dev/null
-//=====
-// 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 "bbwtInputText.h"
-#include "bbwtPackage.h"
-namespace bbwt
-{
- //--------------------------------------------------------------------------
- class InputTextWidget : public Wt::WContainerWidget
- {
- public:
- InputTextWidget(InputText* box,
- Wt::WContainerWidget *parent,
- Wt::WString In,
- Wt::WString title
- );
- ~InputTextWidget();
-
- std::string GetValue();
- void SetValue(std::string value);
-
- void OnTextEnter();
- void OnTextUpdate(const Wt::WKeyEvent e);
-
- void SetTitle(Wt::WString);
-
- private:
- InputText *mBox;
- Wt::WLineEdit *mwtLineEdit;
- Wt::WText *mwtTitle;
- };
-
- //------------------------------------------------------------------------
- //------------------------------------------------------------------------
- //------------------------------------------------------------------------
-
- InputTextWidget::InputTextWidget(InputText* box,
- Wt::WContainerWidget *parent,
- Wt::WString In,
- Wt::WString title)
- :
- Wt::WContainerWidget(parent),
- mBox(box)
- {
- Wt::WContainerWidget *panel = this;
- Wt::WBorderLayout *layout = new Wt::WBorderLayout();
-
-
- mwtLineEdit = new Wt::WLineEdit();
-
- mwtLineEdit->changed().connect(this,&InputTextWidget::OnTextEnter);
- mwtLineEdit->keyWentUp().connect(this, &InputTextWidget::OnTextUpdate);
-
-
- mwtTitle = new Wt::WText(title);
-
- layout->addWidget(mwtTitle,Wt::WBorderLayout::North);
- layout->addWidget(mwtLineEdit,Wt::WBorderLayout::Center);
-
- panel->setLayout(layout);
-
- }
- //-------------------------------------------------------------------------
-
- InputTextWidget::~InputTextWidget()
- {
- }
-
- //-------------------------------------------------------------------------
-
-
- void InputTextWidget::SetTitle(Wt::WString s)
- {
- mwtTitle->setText(s);
- }
-
- //-------------------------------------------------------------------------
- std::string InputTextWidget::GetValue()
- {
- return bbtk::wt2std ( mwtLineEdit->text() );
- }
-
- void InputTextWidget::SetValue(std::string value)
- {
- mwtLineEdit->setText( bbtk::std2wt(value) ) ;
- }
-
- //--------------------------------------------------------------------------
- void InputTextWidget::OnTextEnter()
- {
- std::cout<<"bbwtInputText.cxx -> OnTextEnter pre if"<<std::endl;
- if (mBox->bbGetInputReactiveOnKeystroke()==1)
- {
- std::cout<<"bbwtInputText.cxx -> OnTextEnter if"<<std::endl;
- mBox->bbSetOutputOut( GetValue() );
- mBox->bbSetInputIn( GetValue() );
- mBox->bbSignalOutputModification("Out");
- }
- }
-
- //--------------------------------------------------------------------------
- void InputTextWidget::OnTextUpdate(const Wt::WKeyEvent e)
- {
- std::cout<<"bbwtInputText.cxx -> pre If ...OnTextUpdate VALUE : "<<GetValue()<<std::endl;
- std::cout<<"bbwtInputText.cxx -> pre If ...OnTextUpdate presionado : "<<e.key()<<std::endl;
- std::cout<<"bbwtInputText.cxx -> OnTextUpdate pre if"<<std::endl;
- if ((mBox->bbGetInputReactiveOnKeystroke()==2 && e.key() != Wt::Key_Enter)||((mBox->bbGetInputReactiveOnKeystroke()==1 && e.key() == Wt::Key_Enter) ))
- {
- std::cout<<"bbwtInputText.cxx -> OnTextUpdate if"<<std::endl;
- std::cout<<"bbwtInputText.cxx -> OnTextUpdate VALUE : "<<GetValue()<<std::endl;
- mBox->bbSetOutputOut( GetValue() + bbtk::wt2std(e.text()) );
- mBox->bbSetInputIn( GetValue() );
- mBox->bbSignalOutputModification("Out");
- }
-
- }
-
-
- //--------------------------------------------------------------------------
- //-------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
-BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,InputText)
-BBTK_BLACK_BOX_IMPLEMENTATION(InputText,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 InputText::Process()
-{
-
- InputTextWidget *w=(InputTextWidget *)bbGetOutputWidget();
- if (w)
- {
- if (firsttime==true)
- {
- firsttime=false;
- w->SetValue( bbGetInputIn().c_str() );
- }
- w->SetTitle( bbtk::std2wt ( bbGetInputTitle() ) );
- bbSetOutputOut( w->GetValue() );
- }
- else
- {
- bbSetOutputOut( "<VOID>" );
- }
-}
-//=====
-// 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 InputText::CreateWidget(Wt::WContainerWidget* parent)
-{
-
- bbSetOutputWidget
- ( new InputTextWidget(this, //bbGetWxParent(),
- parent,
- bbtk::std2wt ( bbGetInputIn() ) ,
- bbtk::std2wt ( bbGetInputTitle() ) ) );
- Process();
-}
-//=====
-// 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 InputText::bbUserSetDefaultValues()
-{
- firsttime=true;
- bbSetInputTitle("");
- bbSetInputIn("");
- bbSetOutputWidget(0);
- bbSetInputReactiveOnKeystroke(2);
-
-}
-//=====
-// 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 InputText::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 InputText::bbUserFinalizeProcessing()
-{
-
-}
-}
-// EO namespace bbwt
-
-