]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbconfigpanel.cpp
Add version strings
[bacula/bacula] / bacula / src / wx-console / wxbconfigpanel.cpp
index f743b8c79928b4342a09a892f3c1623c4f17478d..9c9434cbdeda33bf0d79a0d3aeb369fa2ead31e9 100644 (file)
@@ -4,6 +4,7 @@
  *
  *    Nicolas Boichat, April 2004
  *
+ *    Version $Id$
  */
 /*
    Copyright (C) 2004 Kern Sibbald and John Walker
@@ -64,7 +65,7 @@ wxbConfigParam::~wxbConfigParam() {
 }
   
 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);
@@ -75,7 +76,7 @@ void wxbConfigParam::AddControl(wxWindow* parent, wxSizer* sizer) {
       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;
    }
@@ -88,13 +89,13 @@ wxString wxbConfigParam::GetTitle() {
 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 "";
@@ -154,12 +155,17 @@ void wxbConfigParam::Add(wxString value) {
 }
 
 /* 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++) {
@@ -228,14 +234,14 @@ int wxbConfigPanel::GetRowSelection(const char* title) {
 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);
    }  
 }