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)
4 #include "bbwxInputTextPassword.h"
5 #include "bbwxPackage.h"
10 //--------------------------------------------------------------------------
11 class InputTextPasswordWidget : wxPanel
14 InputTextPasswordWidget(InputTextPassword* box, wxWindow *parent,
15 wxString In, wxString title );
16 ~InputTextPasswordWidget();
18 std::string GetValue();
19 void SetValue(std::string value);
21 void OnTextEnter(wxCommandEvent& event);
22 void OnTextUpdate(wxCommandEvent& event);
24 void SetTitle(wxString);
27 InputTextPassword *mBox;
28 wxTextCtrl *mwxTextCtrl;
29 wxStaticText *mwxTitle;
32 //------------------------------------------------------------------------
33 //------------------------------------------------------------------------
34 //------------------------------------------------------------------------
36 InputTextPasswordWidget::InputTextPasswordWidget(InputTextPassword* box,
40 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
43 wxPanel *panel = this;
49 mwxTextCtrl = new wxTextCtrl( panel, -1, In,wxDefaultPosition, wxSize(40,40) , wxTE_PASSWORD);
50 Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_ENTER,
51 (wxObjectEventFunction)
53 (wxCommandEventFunction)
54 (void (wxPanel::*)(wxCommandEvent&))
55 &InputTextPasswordWidget::OnTextEnter );
57 Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
58 (wxObjectEventFunction)
60 (wxCommandEventFunction)
61 (void (wxPanel::*)(wxCommandEvent&))
62 &InputTextPasswordWidget::OnTextUpdate );
64 wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
65 mwxTitle = new wxStaticText(panel, -1, title );
66 sizer-> Add( mwxTitle );
67 sizer-> Add( mwxTextCtrl, 1, wxEXPAND );
68 sizer-> AddGrowableCol(0);
70 panel-> SetSizer(sizer);
71 panel-> SetAutoLayout(true);
75 //-------------------------------------------------------------------------
77 InputTextPasswordWidget::~InputTextPasswordWidget()
81 //-------------------------------------------------------------------------
84 void InputTextPasswordWidget::SetTitle(wxString s)
86 mwxTitle->SetLabel(s);
89 //-------------------------------------------------------------------------
90 std::string InputTextPasswordWidget::GetValue()
92 return bbtk::wx2std ( mwxTextCtrl->GetValue() );
95 void InputTextPasswordWidget::SetValue(std::string value)
97 mwxTextCtrl->SetValue( bbtk::std2wx(value) ) ;
100 //--------------------------------------------------------------------------
101 void InputTextPasswordWidget::OnTextUpdate(wxCommandEvent& event)
103 if (mBox->bbGetInputReactiveOnKeystroke()==2){
104 mBox->bbSetOutputOut( GetValue() );
105 mBox->bbSetInputIn( GetValue() );
106 mBox->bbSignalOutputModification("Out");
110 //--------------------------------------------------------------------------
111 void InputTextPasswordWidget::OnTextEnter(wxCommandEvent& event)
113 if (mBox->bbGetInputReactiveOnKeystroke()==1){
114 mBox->bbSetOutputOut( GetValue() );
115 mBox->bbSetInputIn( GetValue() );
116 mBox->bbSignalOutputModification("Out");
121 //--------------------------------------------------------------------------
122 //-------------------------------------------------------------------------
123 //--------------------------------------------------------------------------
124 //--------------------------------------------------------------------------
131 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,InputTextPassword)
132 BBTK_BLACK_BOX_IMPLEMENTATION(InputTextPassword,bbtk::WxBlackBox);
134 // 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)
136 void InputTextPassword::Process()
138 InputTextPasswordWidget *w=(InputTextPasswordWidget *)bbGetOutputWidget();
144 w->SetValue( bbGetInputIn().c_str() );
146 w->SetTitle( bbtk::std2wx ( bbGetInputTitle() ) );
147 bbSetOutputOut( w->GetValue() );
149 bbSetOutputOut( "<VOID>" );
154 // 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)
156 void InputTextPassword::CreateWidget(wxWindow* parent)
159 ( (wxWindow*) new InputTextPasswordWidget( this, //bbGetWxParent(),
161 bbtk::std2wx ( bbGetInputIn() ) ,
162 bbtk::std2wx ( bbGetInputTitle() )
167 // 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)
169 void InputTextPassword::bbUserSetDefaultValues()
174 bbSetOutputWidget(NULL);
175 bbSetInputReactiveOnKeystroke(2);
178 // 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)
180 void InputTextPassword::bbUserInitializeProcessing()
185 // 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)
187 void InputTextPassword::bbUserFinalizeProcessing()