//===== // 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 "bbwxInputTextMultiLine.h" #include "bbwxPackage.h" namespace bbwx { //-------------------------------------------------------------------------- class InputTextMultiLineWidget : wxPanel { public: InputTextMultiLineWidget(InputTextMultiLine* box, wxWindow *parent, wxString In, wxString title ); ~InputTextMultiLineWidget(); std::string GetValue(); void SetValue(std::string value); void OnTextEnter(wxCommandEvent& event); void OnTextUpdate(wxCommandEvent& event); void SetTitle(wxString); private: InputTextMultiLine *mBox; wxTextCtrl *mwxTextCtrl; wxStaticText *mwxTitle; }; //------------------------------------------------------------------------ //------------------------------------------------------------------------ //------------------------------------------------------------------------ InputTextMultiLineWidget::InputTextMultiLineWidget(InputTextMultiLine* box, wxWindow *parent, wxString In, wxString title ) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL), mBox(box) { wxPanel *panel = this; //wxTE_PROCESS_ENTER //wxTE_MULTILINE //wxTE_PASSWORD mwxTextCtrl = new wxTextCtrl( panel, -1, In,wxDefaultPosition, wxSize(40,40) , wxTE_MULTILINE); Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_ENTER, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (void (wxPanel::*)(wxCommandEvent&)) &InputTextMultiLineWidget::OnTextEnter ); Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (void (wxPanel::*)(wxCommandEvent&)) &InputTextMultiLineWidget::OnTextUpdate ); wxFlexGridSizer *sizer = new wxFlexGridSizer(1); mwxTitle = new wxStaticText(panel, -1, title ); sizer->Add( mwxTitle ); sizer->Add( mwxTextCtrl, 1, wxEXPAND ); sizer->AddGrowableCol(0); sizer->AddGrowableRow(1); panel-> SetSizer(sizer); panel-> SetAutoLayout(true); panel-> Layout(); } //------------------------------------------------------------------------- InputTextMultiLineWidget::~InputTextMultiLineWidget() { } //------------------------------------------------------------------------- void InputTextMultiLineWidget::SetTitle(wxString s) { mwxTitle->SetLabel(s); } //------------------------------------------------------------------------- std::string InputTextMultiLineWidget::GetValue() { return bbtk::wx2std ( mwxTextCtrl->GetValue() ); } void InputTextMultiLineWidget::SetValue(std::string value) { mwxTextCtrl->SetValue( bbtk::std2wx(value) ) ; } //-------------------------------------------------------------------------- void InputTextMultiLineWidget::OnTextUpdate(wxCommandEvent& event) { if (mBox->bbGetInputReactiveOnKeystroke()==2){ mBox->bbSetOutputOut( GetValue() ); mBox->bbSetInputIn( GetValue() ); mBox->bbSignalOutputModification("Out"); } } //-------------------------------------------------------------------------- void InputTextMultiLineWidget::OnTextEnter(wxCommandEvent& event) { if (mBox->bbGetInputReactiveOnKeystroke()==1){ mBox->bbSetOutputOut( GetValue() ); mBox->bbSetInputIn( GetValue() ); mBox->bbSignalOutputModification("Out"); } } //-------------------------------------------------------------------------- //------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,InputTextMultiLine) BBTK_BLACK_BOX_IMPLEMENTATION(InputTextMultiLine,bbtk::WxBlackBox); //===== // 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 InputTextMultiLine::Process() { InputTextMultiLineWidget *w=(InputTextMultiLineWidget *)bbGetOutputWidget(); if (w) { if (firsttime==true) { firsttime=false; w->SetValue( bbGetInputIn().c_str() ); } w->SetTitle( bbtk::std2wx ( bbGetInputTitle() ) ); bbSetOutputOut( w->GetValue() ); } else { bbSetOutputOut( "" ); } } //===== // 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 InputTextMultiLine::CreateWidget(wxWindow* parent) { bbSetOutputWidget ( (wxWindow*) new InputTextMultiLineWidget( this, //bbGetWxParent(), parent, bbtk::std2wx ( bbGetInputIn() ) , bbtk::std2wx ( bbGetInputTitle() ) ) ); } //===== // 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 InputTextMultiLine::bbUserSetDefaultValues() { firsttime=true; bbSetInputTitle(""); bbSetInputIn(""); bbSetOutputWidget(NULL); 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 InputTextMultiLine::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 InputTextMultiLine::bbUserFinalizeProcessing() { } } // EO namespace bbwx