8 #include "wxMatrixPanel.hh"
9 #include <Gui/StringConv.hh>
22 wxMatrixPanel::wxMatrixPanel(
wxWindow* parent, wxWindowID
id,
bool editable)
33 if ((
int)matrix.
GetRows() != rows_ || (int)matrix.
GetCols() != cols_)
37 wxSizer* sizer =
new wxFlexGridSizer(matrix.
GetCols(), matrix.
GetRows(), 0, 0);
43 for (
int i = 0; i < rows_; i++)
45 for (
int j = 0; j < cols_; j++)
47 wxTextCtrl* control =
new wxTextCtrl(
this, GetId());
48 control->SetEditable(editable_);
50 controls_.push_back(control);
57 for (
int i = 0; i < rows_; i++)
59 for (
int j = 0; j < cols_; j++, index++)
65 controls_[index]->SetValue(
AsciiToWx(str.str()));
75 for (
int i = 0; i < rows_; i++)
77 for (
int j = 0; j < cols_; j++, index++)
79 stringstream str(WxToAscii(controls_[index]->GetValue()));
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
unsigned int GetRows() const
void SetMatrix(const Matrix< double > &matrix)
unsigned int GetCols() const
Matrix< double > GetMatrix()