#include <wx/wx.h>
#include <Base/Common/BIASpragma.hh>
#include <Gui/ParamGUI.hh>
#include <Gui/StringConv.hh>
#include <Utils/Param.hh>
#include <iostream>
#include <vector>
#include <string>
using namespace BIAS;
using namespace std;
{
public:
MyAlgorithm(){coollevel = NULL;};
~MyAlgorithm(){};
void ParamAdd(
Param &p) {
coollevel = p.
AddParamInt(
"coollevel",
"Really cool threshold",0,0,100,0,1);
cooldbl = p.
AddParamDouble(
"cooldbl",
"Really cool double ",0,0,100,0,1);
};
void ParameterChanged(const std::string &name, const void *data){
cout <<"Here is MyAlgorithm! My parameter \""<<name<<"\" changed"<<endl;
if (data == coollevel)
cout <<"Hey, it was \"coollevel\", new cool level is: "<<*coollevel
<<endl;
};
protected:
int *coollevel;
double *cooldbl;
};
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
DECLARE_APP(MyApp)
class MyFrame : public wxFrame
{
public:
MyFrame();
~MyFrame();
};
MyAlgorithm *algo;
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame();
frame->Show(TRUE);
SetTopWindow(frame);
return true;
}
MyFrame::MyFrame()
: wxFrame(NULL, -1, _T("ParamGUISample1"), wxDefaultPosition,
wxSize(400,600) )
{
param_.AddParamInt("SampleInt1","Hilfetext zu SampleInt1",0,-100,100,0,1);
param_.AddParamBool("SampleBool1","Hilfetext zu SampleBool1",false,0,1);
param_.AddParamDouble("SampleDouble1","Hilfetext zu SampleDouble1");
param_.AddParamString("SampleString1","Hilfetext zu SampleString1");
vector<string> enums;
enums.push_back("Enum 1");
enums.push_back("Enum 2");
enums.push_back("Enum 3");
enums.push_back("Enum 4");
param_.AddParamEnum("SampleEnum","Hilfetext zu SampleEnum",enums);
algo = new MyAlgorithm();
algo->ParamAdd(param_);
param_.ParseCommandLine(wxTheApp->argc,
WxToAsciiArray(wxTheApp->argv,wxTheApp->argc));
param_.ShowData();
}
MyFrame::~MyFrame()
{
param_.ShowData();
}