00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "edit_enum_property.h"
00031 #include "properties/forwards.h"
00032 #include "frame_manager.h"
00033
00034 #include <ros/console.h>
00035
00036 #include <tf/transform_listener.h>
00037
00038 namespace rviz
00039 {
00040
00041 IMPLEMENT_DYNAMIC_CLASS(EditEnumPGEditor, wxPGComboBoxEditor);
00042 IMPLEMENT_DYNAMIC_CLASS(EditEnumPGProperty, wxEditEnumProperty);
00043
00044 EditEnumPGEditor::EditEnumPGEditor()
00045 {
00046
00047 }
00048
00049 EditEnumPGEditor::EditEnumPGEditor(const EditEnumOptionCallback& cb)
00050 : option_cb_(cb)
00051 {
00052
00053 }
00054
00055 wxPGWindowList EditEnumPGEditor::CreateControls(wxPropertyGrid *propgrid, wxPGProperty *property, const wxPoint &pos, const wxSize &size) const
00056 {
00057 if (option_cb_)
00058 {
00059
00060
00061
00062 #if wxMAJOR_VERSION == 2 and wxMINOR_VERSION == 9 // If wxWidgets 2.9.x
00063 wxPGChoices _choices = property->GetChoices();
00064 #else
00065 wxPGChoices& _choices = property->GetChoices();
00066 #endif
00067 _choices.Clear();
00068
00069 V_string choices;
00070 option_cb_(choices);
00071 V_string::iterator it = choices.begin();
00072 V_string::iterator end = choices.end();
00073 for (; it != end; ++it)
00074 {
00075 const std::string& choice = *it;
00076 if (choice.empty())
00077 {
00078 continue;
00079 }
00080
00081 _choices.Add(wxString::FromAscii(choice.c_str()));
00082 }
00083 }
00084
00085 return wxPGComboBoxEditor::CreateControls(propgrid, property, pos, size);
00086 }
00087
00088 EditEnumPGProperty::EditEnumPGProperty()
00089 {
00090
00091 }
00092
00093 EditEnumPGProperty::EditEnumPGProperty(const wxString& label, const wxString& name, const wxString& value )
00094 : wxEditEnumProperty( label, name )
00095 {
00096 SetValue(value);
00097 }
00098
00099 }
00100