00001 #ifndef YES_NO_BUTTON_INTERFACE_H 00002 #define YES_NO_BUTTON_INTERFACE_H 00003 00004 #ifndef Q_MOC_RUN 00005 #include <ros/ros.h> 00006 #include <rviz/panel.h> 00007 #include <boost/thread.hpp> 00008 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 00009 # include <QtWidgets> 00010 #else 00011 # include <QtGui> 00012 #endif 00013 #endif 00014 00015 #include <jsk_gui_msgs/YesNo.h> 00016 00017 00018 namespace jsk_rviz_plugins 00019 { 00020 00021 class YesNoButtonInterface: public rviz::Panel 00022 { 00023 Q_OBJECT 00024 public: 00025 YesNoButtonInterface(QWidget* parent = 0); 00026 00027 virtual void onInitialize(); 00028 virtual void load(const rviz::Config& config); 00029 virtual void save(rviz::Config config) const; 00030 00031 protected Q_SLOTS: 00032 void respondYes(); 00033 void respondNo(); 00034 protected: 00035 virtual bool requested( 00036 jsk_gui_msgs::YesNo::Request& req, 00037 jsk_gui_msgs::YesNo::Response& res); 00038 QHBoxLayout* layout_; 00039 QPushButton* yes_button_; 00040 QPushButton* no_button_; 00041 bool yes_; 00042 bool need_user_input_; 00043 boost::mutex mutex_; 00044 ros::ServiceServer yes_no_button_service_; 00045 }; 00046 00047 } // namespace jsk_rviz_plugins 00048 00049 00050 #endif // YES_NO_BUTTON_INTERFACE_H