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
00031
00032
00033
00034
00035 #include "topic_display_dialog.h"
00036 #include "topic_display.h"
00037
00038
00039 #include <wx/msgdlg.h>
00040
00041 namespace rxtools
00042 {
00043
00044 TopicDisplayDialog::TopicDisplayDialog(wxWindow* parent, ros::Node*, bool multiselect, const std::string& message_type)
00045 : GenTopicDisplayDialog(parent)
00046 {
00047 topic_display_panel_ = new TopicDisplay(tree_panel_, message_type, false, tree_panel_->GetSize());
00048 topic_display_panel_->setMultiselectAllowed(multiselect);
00049
00050 topic_display_panel_->Connect(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( TopicDisplayDialog::onTreeItemActivated ), NULL, this );
00051 }
00052
00053 TopicDisplayDialog::TopicDisplayDialog(wxWindow* parent, bool multiselect, const std::string& message_type)
00054 : GenTopicDisplayDialog(parent)
00055 {
00056 topic_display_panel_ = new TopicDisplay(tree_panel_, message_type, false, tree_panel_->GetSize());
00057 topic_display_panel_->setMultiselectAllowed(multiselect);
00058
00059 topic_display_panel_->Connect(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( TopicDisplayDialog::onTreeItemActivated ), NULL, this );
00060 }
00061
00062 TopicDisplayDialog::~TopicDisplayDialog()
00063 {
00064 }
00065
00066 void TopicDisplayDialog::onOK(wxCommandEvent& event)
00067 {
00068 V_string selection;
00069 topic_display_panel_->getSelectedTopics(selection);
00070 if (!selection.empty())
00071 {
00072 EndModal(wxID_OK);
00073 }
00074 else
00075 {
00076 wxMessageBox(wxT("Please select a topic!"), wxT("No topic selected"), wxOK | wxCENTRE | wxICON_ERROR, this);
00077 }
00078 }
00079
00080 void TopicDisplayDialog::onCancel(wxCommandEvent& event)
00081 {
00082 EndModal(wxID_CANCEL);
00083 }
00084
00085 void TopicDisplayDialog::getSelection(V_string& selection)
00086 {
00087 topic_display_panel_->getSelectedTopics(selection);
00088 }
00089
00090 void TopicDisplayDialog::onTreeItemActivated(wxTreeEvent& event)
00091 {
00092 V_string selection;
00093 topic_display_panel_->getSelectedTopics(selection);
00094 if (!selection.empty())
00095 {
00096 EndModal(wxID_OK);
00097 }
00098 }
00099
00100 }