Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ParamGUI.cpp
1 #include "ParamGUI.hh"
2 
3 // STL headers
4 #include <iostream>
5 #include <map>
6 
7 // BIAS headers
8 #include <Utils/ParamTypes.hh>
9 #include <Base/Debug/DebugSimple.hh>
10 #include <Gui/StringConv.hh>
11 
12 using namespace std;
13 using namespace BIAS;
14 
15 // we set a typedef here, as we need const iterators very often...
16 typedef map<const std::string,BIAS::ParamTypeBase*>::const_iterator CI;
17 
18 // ========================================================================
19 // ========= =========
20 // ==== P a r a m G U I ====
21 // ========= =========
22 // ========================================================================
23 ParamGUI::ParamGUI()
24 : Param()
25 {
26 }
27 
28 
30 {
31 }
32 
33 
34 wxPanel* ParamGUI::GetPanel(wxWindow *parent, int GroupID)
35 {
36  //ParamGUIPanel *panel = new ParamGUIPanel(parent);
37  wxScrolledWindow* scrolled = new wxScrolledWindow(parent);
38  ParamGUIPanel* panel = new ParamGUIPanel(scrolled);
39 
40  int count = 0;
41 
42  for (CI it=GetParamMap().begin(); it!=GetParamMap().end(); it++)
43  {
44  if (it->second->Group_ == GroupID)
45  {
46  // panel->SetToolTip("Hallo");
47  count++;
48  if ( ParamTypeInt *item = dynamic_cast<ParamTypeInt*>(it->second) )
49  panel->AddIntWidgets(item);
50  else if ( ParamTypeBool *item = dynamic_cast<ParamTypeBool*>(it->second) )
51  panel->AddBoolWidgets(item);
52  else if ( ParamTypeDouble *item = dynamic_cast<ParamTypeDouble*>(it->second) )
53  panel->AddDoubleWidgets(item);
54  else if ( ParamTypeString *item = dynamic_cast<ParamTypeString*>(it->second) )
55  panel->AddStringWidgets(item);
56  else if ( ParamTypeVecDbl *item = dynamic_cast<ParamTypeVecDbl*>(it->second) )
57  panel->AddVecDblWidgets(item);
58  else if ( ParamTypeVecInt *item = dynamic_cast<ParamTypeVecInt*>(it->second) )
59  panel->AddVecIntWidgets(item);
60  else if ( ParamTypeEnum *item = dynamic_cast<ParamTypeEnum*>(it->second) )
61  panel->AddEnumWidgets(item);
62  else
63  {
64  BIASERR("Invalid parameter type!");
65  }
66  }
67  }
68  if (count > 0)
69  {
70  wxSize size = panel->GetSize();
71  scrolled->SetScrollbars(1, 1, size.GetWidth(), size.GetHeight());
72  return scrolled;
73  }
74  else
75  {
76  BIASERR("The requested group has no members!");
77  delete panel;
78  return NULL;
79  }
80 }
81 
82 
83 wxNotebook* ParamGUI::GetNotebook(wxWindow *parent)
84 {
85  // cout << "This is ParamGUI::GetNotebook()." << endl;
86  wxNotebook *notebook = new wxNotebook( parent, -1,wxDefaultPosition,
87  wxDefaultSize, wxNB_TOP );
88 
89  std::vector<int> groups = UniqueSortedGroups();
90 
91  wxPanel *panel;
92  wxString str;
93  for(unsigned int i=0; i<groups.size(); i++)
94  if (groups[i] != GRP_NOSHOW) {
95  // cout << "Building panel for group " << groups[i] << endl;
96  panel = GetPanel(notebook, groups[i]);
97  if(GroupNames_.size()< groups.size()){
98  //cout<<"GroupNames_.size()<=groups.size()"<<GroupNames_.size()<<","
99  // <<groups.size()<<endl;
100  str.Printf(wxT("Group %d"),groups[i]);
101  }
102  else
103  {
104  str = AsciiToWx(GetGroupName(groups[i]));
105  }
106  if (!notebook->AddPage(panel, str))
107  {
108  BIASERR("Error adding notebook page!");
109  delete notebook;
110  return NULL;
111  }
112  }
113  notebook->Fit();
114  return notebook;
115 }
116 
117 
118 wxFrame* ParamGUI::GetFrame(wxWindow *parent)
119 {
120  // cout << "This is ParamGUI::GetFrame()." << endl;
121  wxFrame *newframe = new wxFrame(parent, -1, _T("ParamGUI Frame"),
122  wxDefaultPosition, wxDefaultSize);
123  wxNotebook *MyNotebook = GetNotebook(newframe);
124 #if wxCHECK_VERSION(2,5,2)
125  wxBoxSizer *nbsizer;
126  nbsizer = new wxBoxSizer(wxHORIZONTAL);
127  nbsizer->Add(MyNotebook);
128 #else
129  wxNotebookSizer *nbsizer;
130  nbsizer = new wxNotebookSizer(MyNotebook);
131 #endif
132  newframe->SetSizer(nbsizer);
133  //newframe->SetSize(wxSize(500,500));
134  return newframe;
135 }
136 
138  const wxString &title,
139  bool bChancelButton)
140 {
141  // cout << "This is ParamGUI::GetFrame()." << endl;
142  ParamGUIDialog *newdialog = new ParamGUIDialog(parent,title,
143  wxDefaultPosition, wxDefaultSize, this, bChancelButton);
144  return newdialog;
145 }
146 
147 
148 // ========================================================================
149 // ========= =========
150 // ==== P a r a m G U I P a n e l ====
151 // ========= =========
152 // ========================================================================
154 : wxPanel(parent)
155 {
156  Parent_ = parent;
157  WidgetIDs_.clear();
158  Grid_ = new wxFlexGridSizer(1,3,2,5);
159 
160  wxStaticText *Header1 = new wxStaticText( this, -1, _T("Parameter") );
161  wxStaticText *Header2 = new wxStaticText( this, -1, _T("Type") );
162  wxStaticText *Header3 = new wxStaticText( this, -1, _T("Value") );
163 
164  Grid_->Add(Header1, 0, wxALIGN_CENTER);
165  Grid_->Add(Header2, 0, wxALIGN_CENTER);
166  Grid_->Add(Header3, 0, wxALIGN_CENTER);
167  SetSizer(Grid_);
168  //SetScrollRate(1, 1);
169 }
170 
171 
173 {
174 }
175 
176 
177 BEGIN_EVENT_TABLE(ParamGUIPanel, wxPanel)
178 EVT_SPINCTRL (-1, ParamGUIPanel::OnSpinCtrl)
179 EVT_CHECKBOX (-1, ParamGUIPanel::OnCheckBox)
180 EVT_TEXT_ENTER (-1, ParamGUIPanel::OnTextEnter)
181 EVT_CHOICE (-1, ParamGUIPanel::OnChoice)
182 END_EVENT_TABLE()
183 
184 
185 void ParamGUIPanel::AddIntWidgets(ParamTypeInt *item)
186 {
187  wxString tooltip(AsciiToWx(item->Help_));
188  unsigned int ID = wxNewId(); // generate a new unique ID
189  wxStaticText *LabelText = new wxStaticText( this, -1, AsciiToWx(item->Name_) );
190  wxStaticText *TypeText = new wxStaticText( this, -1, _T("Integer") );
191  wxString str;
192  str.Printf(wxT("%d"),item->value_);
193  wxSpinCtrl *Spin = new wxSpinCtrl( this, ID, str, wxDefaultPosition,
194  wxDefaultSize, wxSP_ARROW_KEYS,
195  item->min_, item->max_ );
196  Spin->SetToolTip(tooltip);
197  Grid_->SetRows(Grid_->GetRows()+1);
198  Grid_->Add(LabelText, 0, wxALIGN_CENTER);
199  Grid_->Add(TypeText, 0, wxALIGN_CENTER);
200  Grid_->Add(Spin, 0, wxALIGN_CENTER);
201  Fit();
202  struct ItemAndWidget NewStruct;
203  NewStruct.widget = Spin;
204  NewStruct.item = item;
205  pair<unsigned int, struct ItemAndWidget> NewPair( ID, NewStruct );
206  WidgetIDs_.insert(WidgetIDs_.end(), NewPair );
207 }
208 
209 
211 {
212  wxString tooltip(AsciiToWx(item->Help_));
213  unsigned int ID = wxNewId(); // generate a new unique ID
214  wxStaticText *LabelText = new wxStaticText( this, -1, AsciiToWx(item->Name_) );
215  wxStaticText *TypeText = new wxStaticText( this, -1, _T("Boolean") );
216  wxCheckBox *CheckBox = new wxCheckBox( this, ID, wxEmptyString );
217  CheckBox->SetValue(item->value_);
218 
219  CheckBox->SetToolTip(tooltip);
220 
221  Grid_->SetRows(Grid_->GetRows()+1);
222  Grid_->Add(LabelText, 0, wxALIGN_CENTER);
223  Grid_->Add(TypeText, 0, wxALIGN_CENTER);
224  Grid_->Add(CheckBox, 0, wxALIGN_CENTER);
225  Fit();
226  struct ItemAndWidget NewStruct;
227  NewStruct.widget = CheckBox;
228  NewStruct.item = item;
229  pair<unsigned int, struct ItemAndWidget> NewPair( ID, NewStruct );
230  WidgetIDs_.insert(WidgetIDs_.end(), NewPair );
231 }
232 
233 
235 {
236  wxString tooltip(AsciiToWx(item->Help_));
237  unsigned int ID = wxNewId(); // generate a new unique ID
238  wxStaticText *LabelText = new wxStaticText( this, -1, AsciiToWx(item->Name_) );
239  wxStaticText *TypeText = new wxStaticText( this, -1, _T("Double") );
240  wxString str;
241  str.Printf(wxT("%f"),item->value_);
242  wxTextCtrl *TextCtrl = new wxTextCtrl( this, ID, str, wxDefaultPosition,
243  wxDefaultSize, wxTE_PROCESS_ENTER );
244  TextCtrl->SetToolTip(tooltip);
245 
246  Grid_->SetRows(Grid_->GetRows()+1);
247  Grid_->Add(LabelText, 0, wxALIGN_CENTER);
248  Grid_->Add(TypeText, 0, wxALIGN_CENTER);
249  Grid_->Add(TextCtrl, 0, wxALIGN_CENTER);
250  Fit();
251  struct ItemAndWidget NewStruct;
252  NewStruct.widget = TextCtrl;
253  NewStruct.item = item;
254  pair<unsigned int, struct ItemAndWidget> NewPair( ID, NewStruct );
255  WidgetIDs_.insert(WidgetIDs_.end(), NewPair );
256 }
257 
258 
260 {
261  wxString tooltip(AsciiToWx(item->Help_));
262  unsigned int ID = wxNewId(); // generate a new unique ID
263  wxStaticText *LabelText = new wxStaticText( this, -1, AsciiToWx(item->Name_) );
264  wxStaticText *TypeText = new wxStaticText( this, -1, _T("String") );
265  wxString str = AsciiToWx(item->value_);
266  wxTextCtrl *TextCtrl = new wxTextCtrl( this, ID, str, wxDefaultPosition,
267  wxSize(200,-1), wxTE_PROCESS_ENTER );
268  TextCtrl->SetToolTip(tooltip);
269  Grid_->SetRows(Grid_->GetRows()+1);
270  Grid_->Add(LabelText, 0, wxALIGN_CENTER);
271  Grid_->Add(TypeText, 0, wxALIGN_CENTER);
272  Grid_->Add(TextCtrl, 0, wxALIGN_CENTER);
273  Fit();
274  struct ItemAndWidget NewStruct;
275  NewStruct.widget = TextCtrl;
276  NewStruct.item = item;
277  pair<unsigned int, struct ItemAndWidget> NewPair( ID, NewStruct );
278  WidgetIDs_.insert(WidgetIDs_.end(), NewPair );
279 }
280 
281 
283 {
284  wxString tooltip(AsciiToWx(item->Help_));
285  unsigned int ID = wxNewId(); // generate a new unique ID
286  wxStaticText *LabelText = new wxStaticText( this, -1, AsciiToWx(item->Name_) );
287  wxStaticText *TypeText = new wxStaticText( this, -1, _T("VecDbl") );
288  wxString str = AsciiToWx(item->GetValueString());
289  wxTextCtrl *TextCtrl = new wxTextCtrl( this, ID, str, wxDefaultPosition,
290  wxSize(200,-1), wxTE_PROCESS_ENTER );
291  TextCtrl->SetToolTip(tooltip);
292  Grid_->SetRows(Grid_->GetRows()+1);
293  Grid_->Add(LabelText, 0, wxALIGN_CENTER);
294  Grid_->Add(TypeText, 0, wxALIGN_CENTER);
295  Grid_->Add(TextCtrl, 0, wxALIGN_CENTER);
296  Fit();
297  struct ItemAndWidget NewStruct;
298  NewStruct.widget = TextCtrl;
299  NewStruct.item = item;
300  pair<unsigned int, struct ItemAndWidget> NewPair( ID, NewStruct );
301  WidgetIDs_.insert(WidgetIDs_.end(), NewPair );
302 }
303 
304 
306 {
307  wxString tooltip(AsciiToWx(item->Help_));
308  unsigned int ID = wxNewId(); // generate a new unique ID
309  wxStaticText *LabelText = new wxStaticText( this, -1, AsciiToWx(item->Name_) );
310  wxStaticText *TypeText = new wxStaticText( this, -1, _T("VecInt") );
311  wxString str = AsciiToWx(item->GetValueString());
312  wxTextCtrl *TextCtrl = new wxTextCtrl( this, ID, str, wxDefaultPosition,
313  wxSize(200,-1), wxTE_PROCESS_ENTER );
314  TextCtrl->SetToolTip(tooltip);
315  Grid_->SetRows(Grid_->GetRows()+1);
316  Grid_->Add(LabelText, 0, wxALIGN_CENTER);
317  Grid_->Add(TypeText, 0, wxALIGN_CENTER);
318  Grid_->Add(TextCtrl, 0, wxALIGN_CENTER);
319  Fit();
320  struct ItemAndWidget NewStruct;
321  NewStruct.widget = TextCtrl;
322  NewStruct.item = item;
323  pair<unsigned int, struct ItemAndWidget> NewPair( ID, NewStruct );
324  WidgetIDs_.insert(WidgetIDs_.end(), NewPair );
325 }
326 
327 
329 {
330  wxString tooltip(AsciiToWx(item->Help_));
331  unsigned int ID = wxNewId(); // generate a new unique ID
332  wxStaticText *LabelText = new wxStaticText( this, -1, AsciiToWx(item->Name_) );
333  wxStaticText *TypeText = new wxStaticText( this, -1, _T("Enum") );
334  int n = item->Map_.size();
335  int i=0;
336  wxString *choices=new wxString[n];
337  for(map<string,int>::iterator it=item->Map_.begin(); it!=item->Map_.end(); it++){
338  choices[i] = AsciiToWx(it->first);
339  i++;
340  }
341  long style =0; //no alphabetical sorting
342  wxChoiceWithMemory *Choice = new wxChoiceWithMemory(this, ID, wxDefaultPosition, wxSize(200,-1),
343  n, choices, style);
344  Choice->SetToolTip(tooltip);
345 
346  //backup indexes which now correspond to selections via memory
347  for(map<string,int>::iterator it=item->Map_.begin(); it!=item->Map_.end(); it++){
348  Choice->AddDataToMemory(it->second);
349  }
350 
351  Grid_->SetRows(Grid_->GetRows()+1);
352  Grid_->Add(LabelText, 0, wxALIGN_CENTER);
353  Grid_->Add(TypeText, 0, wxALIGN_CENTER);
354  Grid_->Add(Choice, 0, wxALIGN_CENTER);
355  Fit();
356  struct ItemAndWidget NewStruct;
357  NewStruct.widget = Choice;
358  NewStruct.item = item;
359  pair<unsigned int, struct ItemAndWidget> NewPair( ID, NewStruct );
360  WidgetIDs_.insert(WidgetIDs_.end(), NewPair );
361  delete[] choices;
362 
363  int v = Choice->GetSelectionForIndex(item->value_);
364  //cout<<"Setting Selection:"<<v<<endl;
365  Choice->SetSelection(v);
366 }
367 
368 
369 void ParamGUIPanel::OnSpinCtrl(wxSpinEvent &event)
370 {
371  // COUT("Fetched wxSpinEvent!" << endl);
372  int ID = event.GetId();
373  // COUT("ID = " << ID << endl);
374  map<unsigned int,struct ItemAndWidget>::const_iterator it;
375  it = WidgetIDs_.find(ID);
376  if ( it == WidgetIDs_.end() ){
377  BIASERR("This error should never occur or otherwise\n "<<
378  "something with the event IDs went wrong");
379  return;
380  }
381  if ( ParamTypeInt *item =
382  dynamic_cast<ParamTypeInt*>(it->second.item) ) {
383  item->value_ = ((wxSpinCtrl*)(it->second.widget))->GetValue();
384  if (item->CallbackObject_ != NULL)
385  item->CallbackObject_->ParameterChanged(item->Name_, &item->value_);
386  }
387  else
388  {
389  BIASERR("Error during dynamic cast!");
390  }
391 }
392 
393 
394 void ParamGUIPanel::OnCheckBox(wxCommandEvent &event)
395 {
396  // COUT("Fetched CheckBox event!" << endl);
397  int ID = event.GetId();
398  // COUT("ID = " << ID << endl);
399  map<unsigned int,struct ItemAndWidget>::const_iterator it;
400  it = WidgetIDs_.find(ID);
401  if ( it == WidgetIDs_.end() ){
402  BIASERR("This error should never occur or otherwise\n "<<
403  "something with the event IDs went wrong");
404  return;
405  }
406  if ( ParamTypeBool *item =
407  dynamic_cast<ParamTypeBool*>(it->second.item) ){
408  item->value_ = ((wxCheckBox*)(it->second.widget))->GetValue();
409  if (item->CallbackObject_ != NULL)
410  item->CallbackObject_->ParameterChanged(item->Name_, &item->value_);
411  }
412  else{
413  BIASERR("Error during dynamic cast!");
414  }
415 }
416 
417 
418 void ParamGUIPanel::OnTextEnter(wxCommandEvent &event)
419 {
420  COUT("Fetched TextEnter event!" << endl);
421  int ID = event.GetId();
422  // COUT("ID = " << ID << endl);
423  map<unsigned int,struct ItemAndWidget>::const_iterator it;
424  it = WidgetIDs_.find(ID);
425  if ( it == WidgetIDs_.end() ){
426  BIASERR("This error should never occur or otherwise\n "<<
427  "something with the event IDs went wrong");
428  return;
429  }
430  if ( ParamTypeDouble *item =
431  dynamic_cast<ParamTypeDouble*>(it->second.item) ){
432  double newval;
433  if ( !((wxTextCtrl*)it->second.widget)->GetValue().ToDouble(&newval) ){
434  wxMessageBox( wxT("Please check your input!"),
435  wxT("Not a double!"),
436  wxOK | wxICON_ERROR );
437  }
438  else{
439  // atof(
440  // item->SetFromString() <0)
441  // setwidgetvaslue(item->GetValueString();
442  if ( newval > item->max_ ){
443  wxString error;
444  error.Printf(wxT("Your value outruns the upper border!\nValue clipped to %f!"),
445  item->max_);
446  wxMessageBox( error,wxT("Limits!"),wxOK | wxICON_ERROR );
447  item->value_ = item->max_;
448  }
449  else if ( newval < item->min_ )
450  {
451  wxString error;
452  error.Printf(wxT("Your value underruns the lower border!\nValue ")
453  wxT("clipped to %f!"),item->min_);
454  wxMessageBox( error,wxT("Limits!"),wxOK | wxICON_ERROR );
455  item->value_ = item->min_;
456  }
457  else
458  item->value_ = newval;
459  if (item->CallbackObject_ != NULL)
460  item->CallbackObject_->ParameterChanged(item->Name_, &item->value_);
461  }
462  }
463  else if ( ParamTypeString *item =
464  dynamic_cast<ParamTypeString*>(it->second.item) ) {
465  item->value_ = WxToAscii(((wxTextCtrl*)(it->second.widget))->GetValue());
466  if (item->CallbackObject_ != NULL)
467  item->CallbackObject_->ParameterChanged(item->Name_, &item->value_);
468  }
469  else if ( ParamTypeVecDbl *item =
470  dynamic_cast<ParamTypeVecDbl*>(it->second.item) ){
471  vector<double> entries;
472  string number = WxToAscii(((wxTextCtrl*)(it->second.widget))->GetValue());
473  string::iterator its = number.begin();
474  while((*its) =='\"'){
475  number.erase(its);
476  its = number.begin();
477  }
478  its=number.end();
479  if((*its) =='\"'){
480  number.erase(its);
481  }
482  stringstream s(number);
483  // cout<<"number:"<<number<<endl;
484  LOCALE_C_ON
485  double temp;
486  while (s >> temp){
487  entries.push_back(temp);
488  //cout<<","<<temp<<endl;
489  }
490  LOCALE_C_OFF
491 
492  item->value_.newsize(entries.size());
493  for(unsigned i=0;i<entries.size();i++){
494  item->value_[i] = entries[i];
495  // cout<<i<<","<<item->value_[i]<<endl;
496  }
497 
498 
499  if (item->CallbackObject_ != NULL)
500  item->CallbackObject_->ParameterChanged(item->Name_, &item->value_);
501  }
502  else if ( ParamTypeVecInt *item =
503  dynamic_cast<ParamTypeVecInt*>(it->second.item) ){
504  vector<int> entries;
505  string number = WxToAscii(((wxTextCtrl*)(it->second.widget))->GetValue());
506  string::iterator its = number.begin();
507  while((*its) =='\"'){
508  number.erase(its);
509  its = number.begin();
510  }
511  its=number.end();
512  if((*its) =='\"'){
513  number.erase(its);
514  }
515  stringstream s(number);
516  // cout<<"number:"<<number<<endl;
517  LOCALE_C_ON
518  int temp;
519  while (s >> temp){
520  entries.push_back(temp);
521  //cout<<","<<temp<<endl;
522  }
523  LOCALE_C_OFF
524 
525  item->value_.newsize(entries.size());
526  for(unsigned i=0;i<entries.size();i++){
527  item->value_[i] = entries[i];
528  // cout<<i<<","<<item->value_[i]<<endl;
529  }
530  if (item->CallbackObject_ != NULL)
531  item->CallbackObject_->ParameterChanged(item->Name_, &item->value_);
532  }
533  else{
534  BIASERR("Error during dynamic cast!");
535  }
536 
537 }
538 
539 
540 void ParamGUIPanel::OnChoice(wxCommandEvent &event)
541 {
542  COUT("Fetched Choice event!" << endl);
543  int ID = event.GetId();
544  // COUT("ID = " << ID << endl);
545  map<unsigned int,struct ItemAndWidget>::const_iterator it;
546  it = WidgetIDs_.find(ID);
547  if ( it == WidgetIDs_.end() )
548  {
549  BIASERR("This error should never occur or otherwise\n "<<
550  "something with the event IDs went wrong");
551  return;
552  }
553  ParamTypeEnum *item = NULL;
554  item = dynamic_cast<ParamTypeEnum*>(it->second.item);
555  if (item)
556  {
557  int n = ((wxChoiceWithMemory*)(it->second.widget))->GetSelection();
558  //cout<<"Selection:"<<n<<endl;
559  item->value_ = ((wxChoiceWithMemory*)(it->second.widget))->GetIndexForSelection(n);
560  //cout<<"value:"<<item->value_<<endl;
561  if (item->CallbackObject_ != NULL)
562  item->CallbackObject_->ParameterChanged(item->Name_, &item->value_);
563  }
564  else
565  {
566  BIASERR("Error during dynamic cast, item is not of type ParamTypeEnum!");
567  }
568 }
569 
570 
571 
572 /////////////////////////////////////////////////////////////
574 AddDataToMemory(int index){
575  int selection = memorySelectionToIndex_.size();
576  memorySelectionToIndex_.insert(make_pair(selection,index));
577  memoryIndexToSelection_.insert(make_pair(index, selection));
578 }
579 
581 GetIndexForSelection(int selection){
582  std::map<int,int>::iterator it;
583  it = memorySelectionToIndex_.find(selection);
584  return it->second;
585 }
586 
589  std::map<int,int>::iterator it;
590  it = memoryIndexToSelection_.find(index);
591  return it->second;
592 }
593 /////////////////////////////////////////////////////////////
595 ParamGUIDialog(wxWindow *parent,const wxString& title, const wxPoint &p,
596  const wxSize &s,ParamGUI *pg, bool bChancelButton )
597  :wxDialog(parent,-1,title, p,s, wxRESIZE_BORDER |wxCAPTION | wxSYSTEM_MENU)
598 {
599 
600  wxNotebook *MyNotebook = pg->GetNotebook(this);
601  wxBoxSizer *mainsizer = new wxBoxSizer(wxVERTICAL);
602  wxBoxSizer *buttonsizer = new wxBoxSizer(wxHORIZONTAL);
603 
604  wxButton *ok = new wxButton(this,wxID_OK,wxT("OK"));
605  buttonsizer->Add(ok);
606 
607  if(bChancelButton){
608  wxButton *cancel = new wxButton(this,wxID_CANCEL,wxT("Cancel"));
609  buttonsizer->Add(cancel);
610  }
611 #if wxCHECK_VERSION(2,5,2)
612  mainsizer->Add(MyNotebook, 1, wxEXPAND);
613 #else
614  wxNotebookSizer *nbsizer;
615  nbsizer = new wxNotebookSizer(MyNotebook);
616  mainsizer->Add(nbsizer);
617 #endif
618  mainsizer->Add(buttonsizer);
619 
620  SetSizer(mainsizer);
621  Fit();
622 }
623 
626 {
627 }
628 
629 
630 
631 BEGIN_EVENT_TABLE(ParamGUIDialog, wxDialog)
632 END_EVENT_TABLE()
The main Parameter Gui interface, derived from BIAS::Param and extends this class.
Definition: ParamGUI.hh:88
void AddIntWidgets(BIAS::ParamTypeInt *item)
Definition: ParamGUI.cpp:185
wxControl * widget
Definition: ParamGUI.hh:22
void OnChoice(wxCommandEvent &event)
Definition: ParamGUI.cpp:540
virtual std::string GetValueString()
Definition: ParamTypes.hh:278
int GetSelectionForIndex(int index)
Definition: ParamGUI.cpp:588
void AddStringWidgets(BIAS::ParamTypeString *item)
Definition: ParamGUI.cpp:259
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
Definition: StringConv.hh:32
void OnCheckBox(wxCommandEvent &event)
Definition: ParamGUI.cpp:394
ParamCallbackInterface * CallbackObject_
if some one changed a parameter, we should call CallbackObject_-&gt;ParameterChanged(Name_); ...
Definition: ParamTypes.hh:82
std::vector< int > UniqueSortedGroups()
Returns a vector of all group IDs (unique) in ascending order.
Definition: Param.cpp:1483
void AddDoubleWidgets(BIAS::ParamTypeDouble *item)
Definition: ParamGUI.cpp:234
std::vector< std::string > GroupNames_
Definition: Param.hh:548
virtual void ParameterChanged(const std::string &paramname, const void *data)
Definition: Param.cpp:68
void AddVecIntWidgets(BIAS::ParamTypeVecInt *item)
Definition: ParamGUI.cpp:305
BIAS::ParamTypeBase * item
Definition: ParamGUI.hh:23
std::map< std::string, int > Map_
Definition: ParamTypes.hh:349
ParamGUIDialog(wxWindow *parent, const wxString &title, const wxPoint &p, const wxSize &s, ParamGUI *pg, bool bChancelButton=true)
Definition: ParamGUI.cpp:595
std::map< int, int > memoryIndexToSelection_
Definition: ParamGUI.hh:153
wxWindow * Parent_
Definition: ParamGUI.hh:48
ParamGUIPanel(wxWindow *parent)
Definition: ParamGUI.cpp:153
std::map< int, int > memorySelectionToIndex_
Definition: ParamGUI.hh:152
void AddBoolWidgets(BIAS::ParamTypeBool *item)
Definition: ParamGUI.cpp:210
wxFrame * GetFrame(wxWindow *parent)
Builds up a standalone wxFrame with a notebook embedded in it.
Definition: ParamGUI.cpp:118
std::string Name_
Definition: ParamTypes.hh:69
this provides a gui interface for the BIAS::Param class.
Definition: ParamGUI.hh:32
void OnTextEnter(wxCommandEvent &event)
Definition: ParamGUI.cpp:418
std::string Help_
Definition: ParamTypes.hh:73
ParamGUIDialog * GetDialog(wxWindow *parent, const wxString &title, bool bChancelButton=true)
Builds up a wxDialog with a notebook embedded in it.
Definition: ParamGUI.cpp:137
wxNotebook * GetNotebook(wxWindow *parent)
Builds up a wxNotebook with each parameter group on one page.
Definition: ParamGUI.cpp:83
virtual std::string GetValueString()
Definition: ParamTypes.hh:324
void AddVecDblWidgets(BIAS::ParamTypeVecDbl *item)
Definition: ParamGUI.cpp:282
This class Param provides generic support for parameters.
Definition: Param.hh:231
std::map< const std::string, BIAS::ParamTypeBase * > & GetParamMap()
Definition: Param.cpp:1885
this provides a gui interface for the BIAS::Param class.
Definition: ParamGUI.hh:70
int GetIndexForSelection(int selection)
Definition: ParamGUI.cpp:581
void OnSpinCtrl(wxSpinEvent &event)
Definition: ParamGUI.cpp:369
std::string GetGroupName(const int group_id)
gets the name of a group
Definition: Param.cpp:1465
void AddEnumWidgets(BIAS::ParamTypeEnum *item)
Definition: ParamGUI.cpp:328
void AddDataToMemory(int index)
Definition: ParamGUI.cpp:574
wxFlexGridSizer * Grid_
Definition: ParamGUI.hh:52
wxPanel * GetPanel(wxWindow *parent, int GroupID=GRP_ALL)
Builds up a wxPanel with the parameters specified by GroupID.
Definition: ParamGUI.cpp:34