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 #ifndef RVIZ_PROPERTY_FORWARDS_H
00031 #define RVIZ_PROPERTY_FORWARDS_H
00032
00033 #include <boost/shared_ptr.hpp>
00034 #include <boost/weak_ptr.hpp>
00035 #include <boost/function.hpp>
00036
00037 #include <vector>
00038 #include <string>
00039
00040 #define FIXED_FRAME_STRING "<Fixed Frame>"
00041
00042 namespace rviz
00043 {
00044
00045 typedef boost::function<void(const std::string&)> StatusCallback;
00046 typedef std::vector<std::string> V_string;
00047 typedef boost::function<void(V_string&)> EditEnumOptionCallback;
00048 class EditEnumPGProperty;
00049
00050 class PropertyManager;
00051
00052 #define PROPERTY_FORWARD(name) \
00053 class name; \
00054 typedef boost::shared_ptr<name> name##Ptr; \
00055 typedef boost::weak_ptr<name> name##WPtr;
00056
00057 PROPERTY_FORWARD(PropertyBase);
00058 PROPERTY_FORWARD(BoolProperty);
00059 PROPERTY_FORWARD(IntProperty);
00060 PROPERTY_FORWARD(FloatProperty);
00061 PROPERTY_FORWARD(DoubleProperty);
00062 PROPERTY_FORWARD(StringProperty);
00063 PROPERTY_FORWARD(ColorProperty);
00064 PROPERTY_FORWARD(EnumProperty);
00065 PROPERTY_FORWARD(EditEnumProperty);
00066 PROPERTY_FORWARD(CategoryProperty);
00067 PROPERTY_FORWARD(Vector3Property);
00068 PROPERTY_FORWARD(QuaternionProperty);
00069 PROPERTY_FORWARD(ROSTopicStringProperty);
00070 PROPERTY_FORWARD(StatusProperty);
00071 PROPERTY_FORWARD(TFFrameProperty);
00072
00073 typedef std::vector<PropertyBasePtr> V_PropertyBasePtr;
00074 typedef std::vector<PropertyBaseWPtr> V_PropertyBaseWPtr;
00075
00076 template<class T>
00077 void propertyChanged(boost::weak_ptr<T>& wprop)
00078 {
00079 if (boost::shared_ptr<T> prop = wprop.lock())
00080 {
00081 prop->changed();
00082 }
00083 }
00084
00085 template<class T>
00086 void hideProperty(boost::weak_ptr<T>& wprop)
00087 {
00088 if (boost::shared_ptr<T> prop = wprop.lock())
00089 {
00090 prop->hide();
00091 }
00092 }
00093
00094 template<class T>
00095 void showProperty(boost::weak_ptr<T>& wprop)
00096 {
00097 if (boost::shared_ptr<T> prop = wprop.lock())
00098 {
00099 prop->show();
00100 }
00101 }
00102
00103 template<class T>
00104 void setPropertyHelpText(boost::weak_ptr<T>& wprop, const std::string& text)
00105 {
00106 if (boost::shared_ptr<T> prop = wprop.lock())
00107 {
00108 prop->setHelpText(text);
00109 }
00110 }
00111
00112 }
00113
00114 #endif
00115