*
* Nicolas Boichat, April 2004
*
+ * Version $Id$
*/
/*
Copyright (C) 2004 Kern Sibbald and John Walker
}
void wxbConfigParam::AddControl(wxWindow* parent, wxSizer* sizer) {
- sizer->Add(new wxStaticText(parent, -1, title + ": ", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT), 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL);
+ sizer->Add(new wxStaticText(parent, -1, title + ": ", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT), 0, wxEXPAND | wxALIGN_CENTER_HORIZONTAL);
switch (type) {
case text:
statictext = new wxStaticText(parent, -1, value, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
sizer->Add(textctrl, 1, wxEXPAND | wxADJUST_MINSIZE);
break;
case choice:
- choicectrl = new wxChoice(parent, id, wxDefaultPosition, wxDefaultSize, nvalues, values);
+ choicectrl = new wxChoice(parent, id, wxDefaultPosition, wxSize(150, 20), nvalues, values);
sizer->Add(choicectrl, 1, wxEXPAND);
break;
}
wxString wxbConfigParam::GetValue() {
switch (type) {
case text:
- return (statictext) ? statictext->GetLabel() : "";
+ return (statictext != NULL) ? statictext->GetLabel() : wxString("");
break;
case modifiableText:
- return (textctrl) ? textctrl->GetValue() : "";
+ return (textctrl != NULL) ? textctrl->GetValue() : wxString("");
break;
case choice:
- return (choicectrl) ? choicectrl->GetStringSelection() : "";
+ return (choicectrl != NULL) ? choicectrl->GetStringSelection() : wxString("");
break;
}
return "";
}
/* Creates a new config panel, config must be allocated with new */
-wxbConfigPanel::wxbConfigPanel(wxWindow* parent, wxbConfig* config,
+wxbConfigPanel::wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString title,
wxWindowID ok, wxWindowID cancel, wxWindowID apply): wxPanel(parent) {
this->config = config;
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
+
+ mainSizer->Add(
+ new wxStaticText(this, -1, title, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER),
+ 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
+
wxFlexGridSizer* cfgSizer = new wxFlexGridSizer(config->GetCount()+1, 2, 8, 5);
unsigned int i;
for (i = 0; i < config->GetCount(); i++) {
void wxbConfigPanel::ClearRowChoices(const char* title) {
int i;
if ((i = FindRow(title)) > -1) {
- return (*config)[i].Clear();
+ (*config)[i].Clear();
}
}
void wxbConfigPanel::AddRowChoice(const char* title, wxString value) {
int i;
if ((i = FindRow(title)) > -1) {
- return (*config)[i].Add(value);
+ (*config)[i].Add(value);
}
}