creaContours_lib
wxConceptControl Class Reference

#include <wxConceptControl.h>

Inheritance diagram for wxConceptControl:
Collaboration diagram for wxConceptControl:

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
 

Detailed Description

file wxConceptControl.h

Definition at line 63 of file wxConceptControl.h.

Constructor & Destructor Documentation

wxConceptControl::wxConceptControl ( wxWindow *  parent,
bool  orientation,
int  minV,
int  maxV,
int  actualV,
std::string &  aConceptName,
std::string  elementsDef = "" 
)

Definition at line 48 of file wxConceptControl.cxx.

References onSliderRelease(), and onSliderTrack().

49  :wxPanel(parent, -1, wxDefaultPosition, parent->GetSize(), wxTAB_TRAVERSAL)
50  {
51 
52  minValue = minV;
53  maxValue = maxV;
54  _numCheckBox = 0;
55 
56  showLabels = true;
57 
58  wxFlexGridSizer* sizer = new wxFlexGridSizer (1, 3, 15, 15);
59 
60  conceptName = new wxStaticText(this, -1, wxString(aConceptName.c_str(),wxConvUTF8), wxDefaultPosition, wxSize(90,20), wxALIGN_CENTRE );
61  sizer->Add( conceptName, 0, wxALIGN_CENTRE |wxALIGN_CENTER_HORIZONTAL);
62 
63  if(orientation)
64  {
65  sizer->AddGrowableCol(1);
66  conceptSlider = new wxSlider(this, -1, actualV, minV, maxV, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL| wxSL_AUTOTICKS | wxSL_LABELS, wxDefaultValidator, wxString(aConceptName.c_str(),wxConvUTF8));
67  }
68  else
69  {
70  sizer->AddGrowableRow(1);
71  conceptSlider = new wxSlider(this, -1, actualV, minV, maxV, wxDefaultPosition, wxDefaultSize, wxSL_LEFT| wxSL_AUTOTICKS | wxSL_LABELS, wxDefaultValidator, wxString(aConceptName.c_str(),wxConvUTF8) );
72  }
73  sizer->Add(conceptSlider, 0, wxGROW |wxALL );
74  createElements( sizer, elementsDef );
75  SetSizer( sizer );
76 
77  Connect( conceptSlider->GetId(), wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(wxConceptControl::onSliderTrack));//(wxObjectEventFunction) &wxConceptControl :: onSliderRelease );
78  Connect( conceptSlider->GetId(), wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(wxConceptControl::onSliderRelease));//(wxObjectEventFunction) &wxConceptControl :: onSliderTrack );
79 
80  this->SetAutoLayout( true );
81  this->Layout();
82  }

Here is the call graph for this function:

wxConceptControl::~wxConceptControl ( )

Definition at line 84 of file wxConceptControl.cxx.

85  {
86 
87  }

Member Function Documentation

void wxConceptControl::clearCheckAt ( int  position)

Definition at line 190 of file wxConceptControl.cxx.

References checkBoxes.

Referenced by wxInstantChooserPanel::onCheckBoxClicked().

191  {
192  checkBoxes[position]->SetValue( false );
193  }

Here is the caller graph for this function:

wxCheckBox * wxConceptControl::createCheckBoxAndAddToSizer ( wxSizer *  sizer,
std::string  label,
wxWindowID  id,
int  groupID 
)
private

Definition at line 269 of file wxConceptControl.cxx.

References checkBoxes, and onUpdateUICheckBox().

Referenced by createElements().

270  {
271  //char buffer[33];
272  //itoa( groupID, buffer, 10);
273 
274  std::string buffer;
275 
276  if(groupID == 0){
277  buffer = "0";
278  }else{
279  int k=groupID;
280  while (k > 0){
281  char temp = k % 10 + 48;
282  k = k / 10;
283  buffer = temp + buffer;
284  }
285  }
286 
287  //wxCheckBox *checkbox = new wxCheckBox( this, -1, wxString( label.c_str(), wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxString( buffer, wxConvUTF8) );
288  wxCheckBox *checkbox = new wxCheckBox( this, -1, wxString( label.c_str(), wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxString( buffer.c_str(), wxConvUTF8) );
289  sizer->Add(checkbox, 0, wxLEFT | wxRIGHT, 5);
290  sizer->Add(0, 2, 0, wxGROW);
291  checkBoxes.push_back( checkbox );
292  Connect( checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) (wxCommandEventFunction) &wxConceptControl::onUpdateUICheckBox );
293 
294  return checkbox;
295  }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxConceptControl::createElements ( wxSizer *  sizer,
std::string  elementsDef 
)
private

Definition at line 235 of file wxConceptControl.cxx.

References _numCheckBox, and createCheckBoxAndAddToSizer().

236  {
237  const char * elements = elementsDef.c_str();
238  int elementsNum = elementsDef.size();
239  wxFlexGridSizer* checkSizer = new wxFlexGridSizer (1, elementsNum, 5, 5);
240  int i,ckecks = 0;
241  for( i = 0;*elements!= 0; elements++)
242  {
243  char a = *elements;
244  if( a == 67 || a == 99 )// Including C:67 or c:99 as a checkBox (ASCII)
245  {
246  /*if(ckecks==0){
247  createCheckBoxAndAddToSizer( checkSizer, "X", -1, ckecks);
248  }else{
249  createCheckBoxAndAddToSizer( checkSizer, "Y", -1, ckecks);
250  }*/
251  createCheckBoxAndAddToSizer( checkSizer, "X", -1, ckecks);
252  ckecks++;
253  }
254  else if ( a == 84 || a==116 )// Including T:84 or t t:116 as textCtrl (ASCII)
255  {
256 
257  }
258  i++;
259  }
260  _numCheckBox = ckecks;
261  sizer->Add(checkSizer, 0, wxGROW |wxALL );
262  }

Here is the call graph for this function:

int wxConceptControl::getActualValue ( )
bool wxConceptControl::getIfChecked ( int  position)

Definition at line 195 of file wxConceptControl.cxx.

References checkBoxes.

Referenced by wxInstantChooserPanel::onCheckBoxClicked().

196  {
197  return checkBoxes[position]->GetValue();
198  }

Here is the caller graph for this function:

int wxConceptControl::getMaxShowedValue ( )

Definition at line 143 of file wxConceptControl.cxx.

References conceptSlider.

Referenced by wxInstantChooserPanel::getLastConceptData(), and wxInstantChooserPanel::setResolutionRangeWithLasUpdate().

144  {
145  return conceptSlider->GetMax();
146  }

Here is the caller graph for this function:

int wxConceptControl::getMaxValue ( )

Definition at line 163 of file wxConceptControl.cxx.

References maxValue.

Referenced by wxInstantChooserPanel::changeResolutionAtConceptControl(), wxInstantChooserPanel::getLastConceptData(), and wxInstantChooserPanel::onResolutionSlider().

164  {
165  return maxValue;
166  }

Here is the caller graph for this function:

int wxConceptControl::getMinShowedValue ( )

Definition at line 138 of file wxConceptControl.cxx.

References conceptSlider.

Referenced by wxInstantChooserPanel::getLastConceptData(), and wxInstantChooserPanel::setResolutionRangeWithLasUpdate().

139  {
140  return conceptSlider->GetMin();
141  }

Here is the caller graph for this function:

int wxConceptControl::getMinValue ( )

Definition at line 153 of file wxConceptControl.cxx.

References minValue.

Referenced by wxInstantChooserPanel::changeResolutionAtConceptControl(), wxInstantChooserPanel::getLastConceptData(), and wxInstantChooserPanel::onResolutionSlider().

154  {
155  return minValue;
156  }

Here is the caller graph for this function:

std::string wxConceptControl::getName ( )

Definition at line 133 of file wxConceptControl.cxx.

References conceptName.

Referenced by wxInstantChooserPanel::getInstantData(), wxInstantChooserPanel::getLastConceptData(), wxInstantChooserPanel::onResolutionSlider(), and wxInstantChooserPanel::setInstant().

134  {
135  return std::string(conceptName->GetLabel().ToAscii()); //wxString to std::string convertor ?
136  }

Here is the caller graph for this function:

int wxConceptControl::getNumCheckBox ( )

Definition at line 264 of file wxConceptControl.cxx.

References _numCheckBox.

Referenced by wxInstantChooserPanel::onCheckBoxClicked().

264  {
265  return _numCheckBox;
266  }

Here is the caller graph for this function:

void wxConceptControl::OnCheckOrRadioBox ( wxCommandEvent &  event)
void wxConceptControl::onSliderRelease ( wxScrollEvent &  event)

Definition at line 111 of file wxConceptControl.cxx.

References sendEnvent().

Referenced by wxConceptControl().

112  {
113  // if( !resolutionChange )
114  sendEnvent( wxEVT_CONCEPT_RELEASE );
115  }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxConceptControl::onSliderTrack ( wxScrollEvent &  event)

Definition at line 104 of file wxConceptControl.cxx.

Referenced by wxConceptControl().

105  {
106 
107  }

Here is the caller graph for this function:

void wxConceptControl::onUpdateUICheckBox ( wxCommandEvent &  event)

Definition at line 94 of file wxConceptControl.cxx.

References lastUpdate.

Referenced by createCheckBoxAndAddToSizer().

95  {
96  lastUpdate = (wxCheckBox * ) event.GetEventObject();
97  std::string groupId = std::string(lastUpdate->GetName().ToAscii());
98  event.SetClientData( (void *) atoi(groupId.c_str()) );
99  event.SetId( GetId() );
100  event.SetEventObject( this );
101  GetEventHandler()->ProcessEvent( event );
102  }

Here is the caller graph for this function:

void wxConceptControl::reset ( )

Definition at line 216 of file wxConceptControl.cxx.

References checkBoxes, conceptSlider, maxValue, minValue, and textBoxes.

217  {
218  conceptSlider->SetRange(minValue, maxValue);
219  conceptSlider->SetValue(minValue);
220  int i, size = checkBoxes.size();
221  for(i=0; i<size; i++)
222  {
223  (checkBoxes[i])->SetValue( false );
224  }
225  size = textBoxes.size();
226  for ( i =0; i<size; i++)
227  {
228  textBoxes[i]->Clear();
229  }
230  }
void wxConceptControl::sendEnvent ( WXTYPE  theEventType)

Definition at line 122 of file wxConceptControl.cxx.

Referenced by onSliderRelease().

123  {
124  wxCommandEvent cevent( theEventType, GetId() );
125  cevent.SetEventObject( this );
126  GetEventHandler()->ProcessEvent( cevent );
127  }

Here is the caller graph for this function:

void wxConceptControl::setActualValue ( int  theActual)

Definition at line 168 of file wxConceptControl.cxx.

References conceptSlider.

Referenced by wxInstantChooserPanel::setInstant().

169  {
170  conceptSlider->SetValue(theActual);
171  }

Here is the caller graph for this function:

void wxConceptControl::setMaxValue ( int  theMax)

Definition at line 158 of file wxConceptControl.cxx.

References maxValue.

159  {
160  maxValue = theMax;
161  }
void wxConceptControl::setMinValue ( int  theMin)

Definition at line 148 of file wxConceptControl.cxx.

References minValue.

149  {
150  minValue = theMin;
151  }
void wxConceptControl::setRange ( int  minShow,
int  maxShow 
)

Definition at line 200 of file wxConceptControl.cxx.

References conceptSlider, and getActualValue().

Referenced by wxInstantChooserPanel::changeResolutionAtConceptControl(), and wxInstantChooserPanel::onResolutionSlider().

201  {
202  /*
203  if( minShow < minVal )
204  minShow = minVal;
205  if( maxShow > maxVal )
206  maxShow = maxVal;
207  */
208  conceptSlider->SetRange(minShow, maxShow);
209  int actual = getActualValue();
210  if( actual<minShow )
211  conceptSlider->SetValue( minShow );
212  else if( actual>maxShow )
213  conceptSlider->SetValue( maxShow );
214  }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxConceptControl::setShowLables ( bool  ifShowCondition)

Definition at line 178 of file wxConceptControl.cxx.

References showLabels.

179  {
180  showLabels = ifShowCondition;
181  //TODO -----UPDATE the slider too!!
182  }

Member Data Documentation

int wxConceptControl::_numCheckBox
private

Definition at line 165 of file wxConceptControl.h.

Referenced by createElements(), and getNumCheckBox().

std::vector<wxCheckBox *> wxConceptControl::checkBoxes
private

Definition at line 155 of file wxConceptControl.h.

Referenced by clearCheckAt(), createCheckBoxAndAddToSizer(), getIfChecked(), and reset().

wxStaticText* wxConceptControl::conceptName
private

Definition at line 151 of file wxConceptControl.h.

Referenced by getName().

wxSlider* wxConceptControl::conceptSlider
private
wxCheckBox* wxConceptControl::lastUpdate
private

Definition at line 157 of file wxConceptControl.h.

Referenced by onUpdateUICheckBox().

int wxConceptControl::maxValue
private

Definition at line 161 of file wxConceptControl.h.

Referenced by getMaxValue(), reset(), and setMaxValue().

int wxConceptControl::minValue
private

Definition at line 159 of file wxConceptControl.h.

Referenced by getMinValue(), reset(), and setMinValue().

bool wxConceptControl::showLabels
private

Definition at line 163 of file wxConceptControl.h.

Referenced by setShowLables().

std::vector<wxTextCtrl *> wxConceptControl::textBoxes
private

Definition at line 153 of file wxConceptControl.h.

Referenced by reset().


The documentation for this class was generated from the following files: