145 wxDialog( aParent, wxID_ANY,
_(
"Edit Advanced Configuration" ), wxDefaultPosition, wxDefaultSize,
146 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
151 m_grid->CreateGrid( 0, 3 );
152 m_grid->SetColSize( 0, 100 );
153 m_grid->SetColSize( 1, 80 );
154 m_grid->SetColLabelValue( 0,
_(
"Key" ) );
155 m_grid->SetColLabelValue( 1,
_(
"Value" ) );
156 m_grid->SetColLabelValue( 2,
_(
"Extant" ) );
158 m_grid->SetRowLabelSize( 0 );
159 m_grid->SetupColumnAutosizer( 1 );
163 wxStdDialogButtonSizer* buttonSizer =
new wxStdDialogButtonSizer();
164 wxButton* okButton =
new wxButton(
this, wxID_OK,
_(
"OK" ) );
165 okButton->SetDefault();
166 buttonSizer->AddButton( okButton );
167 buttonSizer->Realize();
169 wxBoxSizer* sizer =
new wxBoxSizer( wxVERTICAL );
170 sizer->Add(
m_grid, 1, wxEXPAND | wxALL, 5 );
171 sizer->Add( buttonSizer, 0, wxEXPAND | wxALL, 5 );
174 wxDisplay display( wxDisplay::GetFromWindow(
this ) );
175 wxRect displayRect = display.GetClientArea();
177 SetMinSize( wxSize( 500, 300 ) );
178 SetMaxSize( wxSize( displayRect.GetWidth() - 100, displayRect.GetHeight() - 100 ) );
179 SetSizeHints( wxSize( 700, 500 ) );
183 Bind( wxEVT_SIZE, &DIALOG_EDIT_CFG::OnSize,
this );
214 int rows =
m_grid->GetNumberRows();
216 for(
int row = 0; row < rows; ++row )
218 wxString key =
m_grid->GetCellValue( row, 0 );
219 wxString val =
m_grid->GetCellValue( row, 1 );
220 wxString ext =
m_grid->GetCellValue( row, 2 );
222 if( key.IsEmpty() || ext != wxS(
"1" ) )
226 for(
auto& entry : entries )
228 if( entry->m_Ident == key )
243 int row = aEvent.GetRow();
244 int col = aEvent.GetCol();
246 if( col == 0 || col == 1 )
248 m_grid->SetCellValue( row, 2, wxS(
"1" ) );
254 int lastRow =
m_grid->GetNumberRows() - 1;
255 if( !
m_grid->GetCellValue( lastRow, 0 ).IsEmpty() || !
m_grid->GetCellValue( lastRow, 1 ).IsEmpty() )
258 m_grid->SetCellValue(
m_grid->GetNumberRows() - 1, 2, wxS(
"0" ) );
307 bool ext =
m_grid->GetCellValue( aRow, 2 ) == wxS(
"1" );
308 wxFont font =
m_grid->GetCellFont( aRow, 0 );
309 font.SetWeight( ext ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL );
310 m_grid->SetCellFont( aRow, 0, font );
311 m_grid->SetCellFont( aRow, 1, font );