#include <wxConceptControl.h>
Public Member Functions | |
wxConceptControl (wxWindow *parent, bool orientation, int minV, int maxV, int actualV, std::string &aConceptName, std::string elementsDef="") | |
~wxConceptControl () | |
void | onUpdateUICheckBox (wxCommandEvent &event) |
void | OnCheckOrRadioBox (wxCommandEvent &event) |
void | onSliderTrack (wxScrollEvent &event) |
void | onSliderRelease (wxScrollEvent &event) |
void | sendEnvent (WXTYPE theEventType) |
std::string | getName () |
int | getMinShowedValue () |
int | getMaxShowedValue () |
void | setMinValue (int theMin) |
int | getMinValue () |
void | setMaxValue (int theMax) |
int | getMaxValue () |
void | setActualValue (int theActual) |
int | getActualValue () |
void | setShowLables (bool ifShowCondition) |
void | clearCheckAt (int position) |
bool | getIfChecked (int position) |
void | setRange (int minShow, int maxShow) |
void | reset () |
int | getNumCheckBox () |
Private Member Functions | |
void | createElements (wxSizer *sizer, std::string elementsDef) |
wxCheckBox * | createCheckBoxAndAddToSizer (wxSizer *sizer, std::string label, wxWindowID id, int groupID) |
Private Attributes | |
wxSlider * | conceptSlider |
wxStaticText * | conceptName |
std::vector< wxTextCtrl * > | textBoxes |
std::vector< wxCheckBox * > | checkBoxes |
wxCheckBox * | lastUpdate |
int | minValue |
int | maxValue |
bool | showLabels |
int | _numCheckBox |
Definition at line 38 of file wxConceptControl.h.
wxConceptControl::wxConceptControl | ( | wxWindow * | parent, | |
bool | orientation, | |||
int | minV, | |||
int | maxV, | |||
int | actualV, | |||
std::string & | aConceptName, | |||
std::string | elementsDef = "" | |||
) |
Definition at line 23 of file wxConceptControl.cxx.
References onSliderRelease(), and onSliderTrack().
00024 :wxPanel(parent, -1, wxDefaultPosition, parent->GetSize(), wxTAB_TRAVERSAL) 00025 { 00026 00027 minValue = minV; 00028 maxValue = maxV; 00029 _numCheckBox = 0; 00030 00031 showLabels = true; 00032 00033 wxFlexGridSizer* sizer = new wxFlexGridSizer (1, 3, 15, 15); 00034 00035 conceptName = new wxStaticText(this, -1, wxString(aConceptName.c_str(),wxConvUTF8), wxDefaultPosition, wxSize(90,20), wxALIGN_CENTRE ); 00036 sizer->Add( conceptName, 0, wxALIGN_CENTRE |wxALIGN_CENTER_HORIZONTAL); 00037 00038 if(orientation) 00039 { 00040 sizer->AddGrowableCol(1); 00041 conceptSlider = new wxSlider(this, -1, actualV, minV, maxV, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL| wxSL_AUTOTICKS | wxSL_LABELS, wxDefaultValidator, wxString(aConceptName.c_str(),wxConvUTF8)); 00042 } 00043 else 00044 { 00045 sizer->AddGrowableRow(1); 00046 conceptSlider = new wxSlider(this, -1, actualV, minV, maxV, wxDefaultPosition, wxDefaultSize, wxSL_LEFT| wxSL_AUTOTICKS | wxSL_LABELS, wxDefaultValidator, wxString(aConceptName.c_str(),wxConvUTF8) ); 00047 } 00048 sizer->Add(conceptSlider, 0, wxGROW |wxALL ); 00049 createElements( sizer, elementsDef ); 00050 SetSizer( sizer ); 00051 00052 Connect( conceptSlider->GetId(), wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(wxConceptControl::onSliderTrack));//(wxObjectEventFunction) &wxConceptControl :: onSliderRelease ); 00053 Connect( conceptSlider->GetId(), wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(wxConceptControl::onSliderRelease));//(wxObjectEventFunction) &wxConceptControl :: onSliderTrack ); 00054 00055 this->SetAutoLayout( true ); 00056 this->Layout(); 00057 }
wxConceptControl::~wxConceptControl | ( | ) |
void wxConceptControl::clearCheckAt | ( | int | position | ) |
Definition at line 165 of file wxConceptControl.cxx.
References checkBoxes.
Referenced by wxInstantChooserPanel::onCheckBoxClicked().
00166 { 00167 checkBoxes[position]->SetValue( false ); 00168 }
wxCheckBox * wxConceptControl::createCheckBoxAndAddToSizer | ( | wxSizer * | sizer, | |
std::string | label, | |||
wxWindowID | id, | |||
int | groupID | |||
) | [private] |
Definition at line 244 of file wxConceptControl.cxx.
References checkBoxes, and onUpdateUICheckBox().
Referenced by createElements().
00245 { 00246 //char buffer[33]; 00247 //itoa( groupID, buffer, 10); 00248 00249 std::string buffer; 00250 00251 if(groupID == 0){ 00252 buffer = "0"; 00253 }else{ 00254 int k=groupID; 00255 while (k > 0){ 00256 char temp = k % 10 + 48; 00257 k = k / 10; 00258 buffer = temp + buffer; 00259 } 00260 } 00261 00262 //wxCheckBox *checkbox = new wxCheckBox( this, -1, wxString( label.c_str(), wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxString( buffer, wxConvUTF8) ); 00263 wxCheckBox *checkbox = new wxCheckBox( this, -1, wxString( label.c_str(), wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxString( buffer.c_str(), wxConvUTF8) ); 00264 sizer->Add(checkbox, 0, wxLEFT | wxRIGHT, 5); 00265 sizer->Add(0, 2, 0, wxGROW); 00266 checkBoxes.push_back( checkbox ); 00267 Connect( checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) (wxCommandEventFunction) &wxConceptControl::onUpdateUICheckBox ); 00268 00269 return checkbox; 00270 }
void wxConceptControl::createElements | ( | wxSizer * | sizer, | |
std::string | elementsDef | |||
) | [private] |
Definition at line 210 of file wxConceptControl.cxx.
References _numCheckBox, and createCheckBoxAndAddToSizer().
00211 { 00212 const char * elements = elementsDef.c_str(); 00213 int elementsNum = elementsDef.size(); 00214 wxFlexGridSizer* checkSizer = new wxFlexGridSizer (1, elementsNum, 5, 5); 00215 int i,ckecks = 0; 00216 for( i = 0;*elements!= 0; elements++) 00217 { 00218 char a = *elements; 00219 if( a == 67 || a == 99 )// Including C:67 or c:99 as a checkBox (ASCII) 00220 { 00221 /*if(ckecks==0){ 00222 createCheckBoxAndAddToSizer( checkSizer, "X", -1, ckecks); 00223 }else{ 00224 createCheckBoxAndAddToSizer( checkSizer, "Y", -1, ckecks); 00225 }*/ 00226 createCheckBoxAndAddToSizer( checkSizer, "X", -1, ckecks); 00227 ckecks++; 00228 } 00229 else if ( a == 84 || a==116 )// Including T:84 or t t:116 as textCtrl (ASCII) 00230 { 00231 00232 } 00233 i++; 00234 } 00235 _numCheckBox = ckecks; 00236 sizer->Add(checkSizer, 0, wxGROW |wxALL ); 00237 }
int wxConceptControl::getActualValue | ( | ) |
Definition at line 148 of file wxConceptControl.cxx.
References conceptSlider.
Referenced by wxInstantChooserPanel::changeResolutionAtConceptControl(), wxInstantChooserPanel::getInstantData(), wxInstantChooserPanel::getLastConceptData(), wxInstantChooserPanel::onResolutionSlider(), and setRange().
00149 { 00150 return conceptSlider->GetValue(); 00151 }
bool wxConceptControl::getIfChecked | ( | int | position | ) |
Definition at line 170 of file wxConceptControl.cxx.
References checkBoxes.
Referenced by wxInstantChooserPanel::onCheckBoxClicked().
00171 { 00172 return checkBoxes[position]->GetValue(); 00173 }
int wxConceptControl::getMaxShowedValue | ( | ) |
Definition at line 118 of file wxConceptControl.cxx.
References conceptSlider.
Referenced by wxInstantChooserPanel::getLastConceptData(), and wxInstantChooserPanel::setResolutionRangeWithLasUpdate().
00119 { 00120 return conceptSlider->GetMax(); 00121 }
int wxConceptControl::getMaxValue | ( | ) |
Definition at line 138 of file wxConceptControl.cxx.
References maxValue.
Referenced by wxInstantChooserPanel::changeResolutionAtConceptControl(), wxInstantChooserPanel::getLastConceptData(), and wxInstantChooserPanel::onResolutionSlider().
00139 { 00140 return maxValue; 00141 }
int wxConceptControl::getMinShowedValue | ( | ) |
Definition at line 113 of file wxConceptControl.cxx.
References conceptSlider.
Referenced by wxInstantChooserPanel::getLastConceptData(), and wxInstantChooserPanel::setResolutionRangeWithLasUpdate().
00114 { 00115 return conceptSlider->GetMin(); 00116 }
int wxConceptControl::getMinValue | ( | ) |
Definition at line 128 of file wxConceptControl.cxx.
References minValue.
Referenced by wxInstantChooserPanel::changeResolutionAtConceptControl(), wxInstantChooserPanel::getLastConceptData(), and wxInstantChooserPanel::onResolutionSlider().
00129 { 00130 return minValue; 00131 }
std::string wxConceptControl::getName | ( | ) |
Definition at line 108 of file wxConceptControl.cxx.
References conceptName.
Referenced by wxInstantChooserPanel::getInstantData(), wxInstantChooserPanel::getLastConceptData(), wxInstantChooserPanel::onResolutionSlider(), and wxInstantChooserPanel::setInstant().
00109 { 00110 return std::string(conceptName->GetLabel().ToAscii()); //wxString to std::string convertor ? 00111 }
int wxConceptControl::getNumCheckBox | ( | ) |
Definition at line 239 of file wxConceptControl.cxx.
References _numCheckBox.
Referenced by wxInstantChooserPanel::onCheckBoxClicked().
00239 { 00240 return _numCheckBox; 00241 }
void wxConceptControl::OnCheckOrRadioBox | ( | wxCommandEvent & | event | ) |
void wxConceptControl::onSliderRelease | ( | wxScrollEvent & | event | ) |
Definition at line 86 of file wxConceptControl.cxx.
References sendEnvent().
Referenced by wxConceptControl().
00087 { 00088 // if( !resolutionChange ) 00089 sendEnvent( wxEVT_CONCEPT_RELEASE ); 00090 }
void wxConceptControl::onSliderTrack | ( | wxScrollEvent & | event | ) |
Definition at line 79 of file wxConceptControl.cxx.
Referenced by wxConceptControl().
void wxConceptControl::onUpdateUICheckBox | ( | wxCommandEvent & | event | ) |
Definition at line 69 of file wxConceptControl.cxx.
References lastUpdate.
Referenced by createCheckBoxAndAddToSizer().
00070 { 00071 lastUpdate = (wxCheckBox * ) event.GetEventObject(); 00072 std::string groupId = std::string(lastUpdate->GetName().ToAscii()); 00073 event.SetClientData( (void *) atoi(groupId.c_str()) ); 00074 event.SetId( GetId() ); 00075 event.SetEventObject( this ); 00076 GetEventHandler()->ProcessEvent( event ); 00077 }
void wxConceptControl::reset | ( | ) |
Definition at line 191 of file wxConceptControl.cxx.
References checkBoxes, conceptSlider, maxValue, minValue, and textBoxes.
00192 { 00193 conceptSlider->SetRange(minValue, maxValue); 00194 conceptSlider->SetValue(minValue); 00195 int i, size = checkBoxes.size(); 00196 for(i=0; i<size; i++) 00197 { 00198 (checkBoxes[i])->SetValue( false ); 00199 } 00200 size = textBoxes.size(); 00201 for ( i =0; i<size; i++) 00202 { 00203 textBoxes[i]->Clear(); 00204 } 00205 }
void wxConceptControl::sendEnvent | ( | WXTYPE | theEventType | ) |
Definition at line 97 of file wxConceptControl.cxx.
Referenced by onSliderRelease().
00098 { 00099 wxCommandEvent cevent( theEventType, GetId() ); 00100 cevent.SetEventObject( this ); 00101 GetEventHandler()->ProcessEvent( cevent ); 00102 }
void wxConceptControl::setActualValue | ( | int | theActual | ) |
Definition at line 143 of file wxConceptControl.cxx.
References conceptSlider.
Referenced by wxInstantChooserPanel::setInstant().
00144 { 00145 conceptSlider->SetValue(theActual); 00146 }
void wxConceptControl::setMaxValue | ( | int | theMax | ) |
Definition at line 133 of file wxConceptControl.cxx.
References maxValue.
00134 { 00135 maxValue = theMax; 00136 }
void wxConceptControl::setMinValue | ( | int | theMin | ) |
Definition at line 123 of file wxConceptControl.cxx.
References minValue.
00124 { 00125 minValue = theMin; 00126 }
void wxConceptControl::setRange | ( | int | minShow, | |
int | maxShow | |||
) |
Definition at line 175 of file wxConceptControl.cxx.
References conceptSlider, and getActualValue().
Referenced by wxInstantChooserPanel::changeResolutionAtConceptControl(), and wxInstantChooserPanel::onResolutionSlider().
00176 { 00177 /* 00178 if( minShow < minVal ) 00179 minShow = minVal; 00180 if( maxShow > maxVal ) 00181 maxShow = maxVal; 00182 */ 00183 conceptSlider->SetRange(minShow, maxShow); 00184 int actual = getActualValue(); 00185 if( actual<minShow ) 00186 conceptSlider->SetValue( minShow ); 00187 else if( actual>maxShow ) 00188 conceptSlider->SetValue( maxShow ); 00189 }
void wxConceptControl::setShowLables | ( | bool | ifShowCondition | ) |
Definition at line 153 of file wxConceptControl.cxx.
References showLabels.
00154 { 00155 showLabels = ifShowCondition; 00156 //TODO -----UPDATE the slider too!! 00157 }
int wxConceptControl::_numCheckBox [private] |
Definition at line 140 of file wxConceptControl.h.
Referenced by createElements(), and getNumCheckBox().
std::vector<wxCheckBox *> wxConceptControl::checkBoxes [private] |
Definition at line 130 of file wxConceptControl.h.
Referenced by clearCheckAt(), createCheckBoxAndAddToSizer(), getIfChecked(), and reset().
wxStaticText* wxConceptControl::conceptName [private] |
wxSlider* wxConceptControl::conceptSlider [private] |
Definition at line 122 of file wxConceptControl.h.
Referenced by getActualValue(), getMaxShowedValue(), getMinShowedValue(), reset(), setActualValue(), and setRange().
wxCheckBox* wxConceptControl::lastUpdate [private] |
int wxConceptControl::maxValue [private] |
Definition at line 136 of file wxConceptControl.h.
Referenced by getMaxValue(), reset(), and setMaxValue().
int wxConceptControl::minValue [private] |
Definition at line 134 of file wxConceptControl.h.
Referenced by getMinValue(), reset(), and setMinValue().
bool wxConceptControl::showLabels [private] |
std::vector<wxTextCtrl *> wxConceptControl::textBoxes [private] |