#include <interfToolsSpreadPanel.h>
Public Member Functions | |
interfToolsSpreadPanel (wxWindow *parent, int sizex, int sizey, wxEvtHandler *evtHandler) | |
~interfToolsSpreadPanel () | |
void | addContourCheckBox (std::string id) |
void | removeContourCheckBox (std::string id) |
Private Member Functions | |
wxPanel * | initializeRadioBox () |
wxPanel * | initializeButton (std::string path, std::string nom) |
wxPanel * | initializeAddRemoveContour () |
Private Attributes | |
wxPanel * | resetbuttxt |
wxPanel * | gobuttxt |
wxPanel * | radiobox |
wxPanel * | addremovecont |
wxScrolledWindow * | scrollwin |
wxFlexGridSizer * | checkboxsizer |
std::vector< std::string > | checkvect |
Definition at line 14 of file interfToolsSpreadPanel.h.
interfToolsSpreadPanel::interfToolsSpreadPanel | ( | wxWindow * | parent, | |
int | sizex, | |||
int | sizey, | |||
wxEvtHandler * | evtHandler | |||
) |
Definition at line 3 of file interfToolsSpreadPanel.cxx.
References addremovecont, gobuttxt, initializeAddRemoveContour(), initializeButton(), initializeRadioBox(), radiobox, and resetbuttxt.
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 }
interfToolsSpreadPanel::~interfToolsSpreadPanel | ( | ) |
void interfToolsSpreadPanel::addContourCheckBox | ( | std::string | id | ) |
Adds a new checkbox to the scrolledwindow using the checkboxsizer id of contour
Definition at line 88 of file interfToolsSpreadPanel.cxx.
References checkboxsizer, checkvect, and scrollwin.
Referenced by interfMainPanel::addContourCheckBox().
00088 { 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 }
wxPanel * interfToolsSpreadPanel::initializeAddRemoveContour | ( | ) | [private] |
initializes the panel that has all the contours that exist in the interface every time a contour is added into the scene, it must be added into this panel for all the contours it must exist a check box beside the contour. This checkbox controls the contours that are going to be used in the spread function.
Definition at line 71 of file interfToolsSpreadPanel.cxx.
References checkboxsizer, and scrollwin.
Referenced by interfToolsSpreadPanel().
00071 { 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 }
wxPanel * interfToolsSpreadPanel::initializeButton | ( | std::string | path, | |
std::string | nom | |||
) | [private] |
initializes the button and the text to be displayed it returns a panel with both components
Path | of the image to be used in the button | |
nom | text to be displayed at right of the button |
Definition at line 44 of file interfToolsSpreadPanel.cxx.
Referenced by interfToolsSpreadPanel().
00044 { 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 }
wxPanel * interfToolsSpreadPanel::initializeRadioBox | ( | ) | [private] |
initializes the radio box to display the options of the spread method.
Definition at line 33 of file interfToolsSpreadPanel.cxx.
Referenced by interfToolsSpreadPanel().
00033 { 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 }
void interfToolsSpreadPanel::removeContourCheckBox | ( | std::string | id | ) |
Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer) id of contour
Definition at line 102 of file interfToolsSpreadPanel.cxx.
References checkboxsizer, and checkvect.
Referenced by interfMainPanel::removeContourCheckBox().
00102 { 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 }
wxPanel* interfToolsSpreadPanel::addremovecont [private] |
wxFlexGridSizer* interfToolsSpreadPanel::checkboxsizer [private] |
Definition at line 42 of file interfToolsSpreadPanel.h.
Referenced by addContourCheckBox(), initializeAddRemoveContour(), and removeContourCheckBox().
std::vector<std::string> interfToolsSpreadPanel::checkvect [private] |
Definition at line 43 of file interfToolsSpreadPanel.h.
Referenced by addContourCheckBox(), and removeContourCheckBox().
wxPanel* interfToolsSpreadPanel::gobuttxt [private] |
wxPanel* interfToolsSpreadPanel::radiobox [private] |
wxPanel* interfToolsSpreadPanel::resetbuttxt [private] |
wxScrolledWindow* interfToolsSpreadPanel::scrollwin [private] |
Definition at line 41 of file interfToolsSpreadPanel.h.
Referenced by addContourCheckBox(), and initializeAddRemoveContour().