//===== // 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 "bbwxInputTextPassword.h" #include "bbwxPackage.h" namespace bbwx { //-------------------------------------------------------------------------- class InputTextPasswordWidget : wxPanel { public: InputTextPasswordWidget(InputTextPassword* box, wxWindow *parent, wxString In, wxString title ); ~InputTextPasswordWidget(); std::string GetValue(); void SetValue(std::string value); void OnTextEnter(wxCommandEvent& event); void OnTextUpdate(wxCommandEvent& event); void SetTitle(wxString); private: InputTextPassword *mBox; wxTextCtrl *mwxTextCtrl; wxStaticText *mwxTitle; }; //------------------------------------------------------------------------ //------------------------------------------------------------------------ //------------------------------------------------------------------------ InputTextPasswordWidget::InputTextPasswordWidget(InputTextPassword* 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_PASSWORD); Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_ENTER, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (void (wxPanel::*)(wxCommandEvent&)) &InputTextPasswordWidget::OnTextEnter ); Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (void (wxPanel::*)(wxCommandEvent&)) &InputTextPasswordWidget::OnTextUpdate ); wxFlexGridSizer *sizer = new wxFlexGridSizer(1); mwxTitle = new wxStaticText(panel, -1, title ); sizer-> Add( mwxTitle ); sizer-> Add( mwxTextCtrl, 1, wxEXPAND ); sizer-> AddGrowableCol(0); panel-> SetSizer(sizer); panel-> SetAutoLayout(true); panel-> Layout(); } //------------------------------------------------------------------------- InputTextPasswordWidget::~InputTextPasswordWidget() { } //------------------------------------------------------------------------- void InputTextPasswordWidget::SetTitle(wxString s) { mwxTitle->SetLabel(s); } //------------------------------------------------------------------------- std::string InputTextPasswordWidget::GetValue() { return bbtk::wx2std ( mwxTextCtrl->GetValue() ); } void InputTextPasswordWidget::SetValue(std::string value) { mwxTextCtrl->SetValue( bbtk::std2wx(value) ) ; } //-------------------------------------------------------------------------- void InputTextPasswordWidget::OnTextUpdate(wxCommandEvent& event) { if (mBox->bbGetInputReactiveOnKeystroke()==2){ mBox->bbSetOutputOut( GetValue() ); mBox->bbSetInputIn( GetValue() ); mBox->bbSignalOutputModification("Out"); } } //-------------------------------------------------------------------------- void InputTextPasswordWidget::OnTextEnter(wxCommandEvent& event) { if (mBox->bbGetInputReactiveOnKeystroke()==1){ mBox->bbSetOutputOut( GetValue() ); mBox->bbSetInputIn( GetValue() ); mBox->bbSignalOutputModification("Out"); } } //-------------------------------------------------------------------------- //------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,InputTextPassword) BBTK_BLACK_BOX_IMPLEMENTATION(InputTextPassword,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 InputTextPassword::Process() { InputTextPasswordWidget *w=(InputTextPasswordWidget *)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 InputTextPassword::CreateWidget(wxWindow* parent) { bbSetOutputWidget ( (wxWindow*) new InputTextPasswordWidget( 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 InputTextPassword::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 InputTextPassword::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 InputTextPassword::bbUserFinalizeProcessing() { } } // EO namespace bbwx