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 "bbwxInputTextMultiLine.h"
5 #include "bbwxPackage.h"
10 //--------------------------------------------------------------------------
11 class InputTextMultiLineWidget : wxPanel
14 InputTextMultiLineWidget(InputTextMultiLine* box, wxWindow *parent,
15 wxString In, wxString title );
16 ~InputTextMultiLineWidget();
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 InputTextMultiLine *mBox;
28 wxTextCtrl *mwxTextCtrl;
29 wxStaticText *mwxTitle;
32 //------------------------------------------------------------------------
33 //------------------------------------------------------------------------
34 //------------------------------------------------------------------------
36 InputTextMultiLineWidget::InputTextMultiLineWidget(InputTextMultiLine* box,
40 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
43 wxPanel *panel = this;
48 mwxTextCtrl = new wxTextCtrl( panel, -1, In,wxDefaultPosition, wxSize(40,40) , wxTE_MULTILINE);
49 Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_ENTER,
50 (wxObjectEventFunction)
52 (wxCommandEventFunction)
53 (void (wxPanel::*)(wxCommandEvent&))
54 &InputTextMultiLineWidget::OnTextEnter );
56 Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
57 (wxObjectEventFunction)
59 (wxCommandEventFunction)
60 (void (wxPanel::*)(wxCommandEvent&))
61 &InputTextMultiLineWidget::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);
69 sizer->AddGrowableRow(1);
71 panel-> SetSizer(sizer);
72 panel-> SetAutoLayout(true);
76 //-------------------------------------------------------------------------
78 InputTextMultiLineWidget::~InputTextMultiLineWidget()
82 //-------------------------------------------------------------------------
85 void InputTextMultiLineWidget::SetTitle(wxString s)
87 mwxTitle->SetLabel(s);
90 //-------------------------------------------------------------------------
91 std::string InputTextMultiLineWidget::GetValue()
93 return bbtk::wx2std ( mwxTextCtrl->GetValue() );
96 void InputTextMultiLineWidget::SetValue(std::string value)
98 mwxTextCtrl->SetValue( bbtk::std2wx(value) ) ;
101 //--------------------------------------------------------------------------
102 void InputTextMultiLineWidget::OnTextUpdate(wxCommandEvent& event)
104 if (mBox->bbGetInputReactiveOnKeystroke()==2){
105 mBox->bbSetOutputOut( GetValue() );
106 mBox->bbSetInputIn( GetValue() );
107 mBox->bbSignalOutputModification("Out");
111 //--------------------------------------------------------------------------
112 void InputTextMultiLineWidget::OnTextEnter(wxCommandEvent& event)
114 if (mBox->bbGetInputReactiveOnKeystroke()==1){
115 mBox->bbSetOutputOut( GetValue() );
116 mBox->bbSetInputIn( GetValue() );
117 mBox->bbSignalOutputModification("Out");
121 //--------------------------------------------------------------------------
122 //-------------------------------------------------------------------------
123 //--------------------------------------------------------------------------
124 //--------------------------------------------------------------------------
126 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,InputTextMultiLine)
127 BBTK_BLACK_BOX_IMPLEMENTATION(InputTextMultiLine,bbtk::WxBlackBox);
129 // 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)
131 void InputTextMultiLine::Process()
133 InputTextMultiLineWidget *w=(InputTextMultiLineWidget *)bbGetOutputWidget();
139 w->SetValue( bbGetInputIn().c_str() );
141 w->SetTitle( bbtk::std2wx ( bbGetInputTitle() ) );
142 bbSetOutputOut( w->GetValue() );
144 bbSetOutputOut( "<VOID>" );
148 // 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)
150 void InputTextMultiLine::CreateWidget(wxWindow* parent)
153 ( (wxWindow*) new InputTextMultiLineWidget( this, //bbGetWxParent(),
155 bbtk::std2wx ( bbGetInputIn() ) ,
156 bbtk::std2wx ( bbGetInputTitle() )
161 // 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)
163 void InputTextMultiLine::bbUserSetDefaultValues()
168 bbSetOutputWidget(NULL);
169 bbSetInputReactiveOnKeystroke(2);
172 // 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)
174 void InputTextMultiLine::bbUserInitializeProcessing()
179 // 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)
181 void InputTextMultiLine::bbUserFinalizeProcessing()