interfToolsSpreadPanel.cxx

Go to the documentation of this file.
00001 #include "interfToolsSpreadPanel.h"
00002 
00003 interfToolsSpreadPanel::interfToolsSpreadPanel(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler)        
00004         : wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_THEME){
00005         wxFlexGridSizer* flexsizer = new wxFlexGridSizer(3,1,2,2);      
00006         this->SetSizer(flexsizer, true);
00007         this->SetAutoLayout( true );
00008 
00009         resetbuttxt = initializeButton("data/Icons/reset.png", "Reset");
00010 
00011         wxFlexGridSizer* flexsizer1 = new wxFlexGridSizer(1,2,2,2);     
00012         radiobox = initializeRadioBox();
00013         addremovecont = initializeAddRemoveContour();   
00014         flexsizer1->Add(radiobox,wxFIXED_MINSIZE);
00015         flexsizer1->Add(addremovecont,wxEXPAND | wxALIGN_CENTRE_VERTICAL);
00016 
00017         gobuttxt = initializeButton("data/Icons/Go.png", "Go"); 
00018 
00019         flexsizer->Add(resetbuttxt, wxFIXED_MINSIZE);
00020         flexsizer->Add(flexsizer1, wxFIXED );
00021         flexsizer->Add(gobuttxt, wxFIXED_MINSIZE);
00022         
00023         
00024         this->Layout();
00025         
00026 }
00027 
00028 
00029 interfToolsSpreadPanel::~interfToolsSpreadPanel()
00030 {
00031 }
00032 
00033 wxPanel* interfToolsSpreadPanel::initializeRadioBox(){
00034         wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
00035         wxString lstOptions[3];
00036         lstOptions[0]=_T("A");
00037         lstOptions[1]=_T("B");
00038         lstOptions[2]=_T("C");
00039         wxRadioBox* _spreadMethodRadiobox       = new wxRadioBox(panel, -1, _T("Method"), wxDefaultPosition, wxSize(45,80), 3 , lstOptions,  3, wxRA_SPECIFY_ROWS);
00040         _spreadMethodRadiobox->SetSelection(2);
00041         return panel;
00042 }
00043 
00044 wxPanel* interfToolsSpreadPanel::initializeButton(std::string path, std::string nom){
00045                         
00046 
00047         wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
00048 
00049         wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1,2,2,2);      
00050         panel->SetSizer(flexsizer, true);
00051         panel->SetAutoLayout( true );
00052         
00053         wxBitmap* bitmap = new wxBitmap(wxString(path.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
00054 
00055         wxBitmapButton* bitmapbutton = new wxBitmapButton(panel, -1, *bitmap, wxDefaultPosition, wxDefaultSize,
00056                                                                                 wxBU_AUTODRAW, wxDefaultValidator, wxString(_T("")));
00057 
00058         
00059         wxStaticText* statictext = new wxStaticText(panel, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition, 
00060                                                                 wxDefaultSize, wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8));
00061 
00062         
00063         flexsizer->Add(bitmapbutton, wxFIXED_MINSIZE);
00064         flexsizer->Add(statictext, wxALIGN_CENTRE_VERTICAL | wxALIGN_CENTER_HORIZONTAL |wxEXPAND);
00065 
00066         panel->Layout();
00067         
00068         return panel;
00069 }
00070 
00071 wxPanel* interfToolsSpreadPanel::initializeAddRemoveContour(){
00072         
00073         wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE |wxVSCROLL , wxString(_T("")));
00074 
00075         scrollwin = new wxScrolledWindow(panel, -1, wxDefaultPosition, wxSize(80,50), wxVSCROLL, wxString(_T("")));
00076 
00077         checkboxsizer = new wxFlexGridSizer(0,1,2,2);   
00078 
00079 
00080         scrollwin->SetSizer(checkboxsizer, true);
00081         scrollwin->SetAutoLayout( false );
00082         //scrollwin->SetInitialSize(wxSize(200,200));
00083 
00084         
00085         return panel;
00086 }
00087 
00088 void interfToolsSpreadPanel::addContourCheckBox(std::string id){
00089 
00090 
00091         wxCheckBox* check = new wxCheckBox(scrollwin, -1, wxString(id.c_str(),wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0,
00092                                                         wxDefaultValidator, wxString(id.c_str(),wxConvUTF8));
00093 
00094         checkvect.push_back(id);
00095 
00096         checkboxsizer->Add(check, wxFIXED_MINSIZE | wxALIGN_LEFT );
00097         scrollwin->Layout();
00098         checkboxsizer->Layout();
00099 
00100 }
00101 
00102 void interfToolsSpreadPanel::removeContourCheckBox(std::string id){
00103 
00104         int index=-1;
00105         for(int i = 0; i < checkvect.size(); i++){
00106                 std::string temp = checkvect[i];
00107                 if(id == temp){
00108                         index = i;
00109                 }
00110         }
00111         if( index != -1){
00112                 if(checkboxsizer->Remove(index)){
00113                         checkboxsizer->Layout();
00114                 }else{
00115             throw "The checkbox could not be removed";
00116                 }
00117         }
00118 }
00119 
00120 

Generated on Wed Jun 27 23:28:32 2012 for creaContours_lib by  doxygen 1.5.7.1