rosout_list_control.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, Willow Garage, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of Willow Garage, Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 #ifndef RXTOOLS_ROSOUT_LIST_CONTROL_H_
00031 #define RXTOOLS_ROSOUT_LIST_CONTROL_H_
00032 
00033 #include <wx/wx.h>
00034 #include <wx/listctrl.h>
00035 
00036 #include "rosgraph_msgs/Log.h"
00037 
00038 #include <boost/function.hpp>
00039 
00040 #include <set>
00041 
00042 namespace rxtools
00043 {
00044 
00045 class RosoutPanel;
00046 
00047 namespace columns
00048 {
00049 enum Column
00050 {
00051   Message,
00052   Severity,
00053   Node,
00054   Time,
00055   Topics,
00056   Location,
00057 };
00058 }
00059 typedef columns::Column Column;
00060 
00061 typedef std::set<int32_t> S_int32;
00062 
00070 class RosoutListControl : public wxListCtrl
00071 {
00072 public:
00076   RosoutListControl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON,
00077                     const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListCtrlNameStr);
00081   virtual ~RosoutListControl();
00082 
00083   void setModel(RosoutPanel* model);
00084 
00090   wxString getSeverityText(const rosgraph_msgs::LogConstPtr& message) const;
00095   const S_int32& getSelection()
00096   {
00097     updateSelection();
00098     return selection_;
00099   }
00100 
00101   void setSelection(const S_int32& sel);
00102 
00103   void preItemChanges();
00104   void postItemChanges();
00105 
00106   void copySelectionToClipboard(bool message_only);
00107 
00108 protected:
00109 
00110   rosgraph_msgs::LogConstPtr getSelectedMessage();
00111   void updateSelection();
00112 
00113   // Callbacks
00114   void onItemActivated(wxListEvent& event);
00115   void onItemSelected(wxListEvent& event);
00116   void onItemRightClick(wxListEvent& event);
00117 
00118   void onCopy(wxCommandEvent& event);
00119   void onCopyMessageOnly(wxCommandEvent& event);
00120   void onChar(wxKeyEvent& event);
00121   void onIncludeLocation(wxCommandEvent& event);
00122   void onIncludeNode(wxCommandEvent& event);
00123   void onIncludeMessage(wxCommandEvent& event);
00124   void onIncludeLocationNewWindow(wxCommandEvent& event);
00125   void onIncludeNodeNewWindow(wxCommandEvent& event);
00126   void onIncludeMessageNewWindow(wxCommandEvent& event);
00127   void onExcludeLocation(wxCommandEvent& event);
00128   void onExcludeNode(wxCommandEvent& event);
00129   void onExcludeMessage(wxCommandEvent& event);
00130   void onExcludeLocationNewWindow(wxCommandEvent& event);
00131   void onExcludeNodeNewWindow(wxCommandEvent& event);
00132   void onExcludeMessageNewWindow(wxCommandEvent& event);
00133 
00134   // overrides from wxListCtrl
00135   virtual wxListItemAttr * OnGetItemAttr(long item) const;
00136   virtual wxString OnGetItemText(long item, long column) const;
00137   virtual int OnGetItemImage(long item) const;
00138 
00139   mutable wxListItemAttr attr_;
00140 
00141   RosoutPanel* model_;
00142 
00143   int32_t error_image_id_;
00144   int32_t warning_image_id_;
00145   int32_t fatal_image_id_;
00146   int32_t info_image_id_;
00147   int32_t debug_image_id_;
00148 
00149   S_int32 selection_;
00150   int32_t last_selection_;
00151 
00152   bool scrollbar_at_bottom_;
00153   bool disable_scroll_to_bottom_;
00154 
00155   // Because we have to force-selection after every SetItemCount, here we keep track of if
00156   // we're doing so manually to prevent it from always preventing auto-scroll
00157 #if __WXMAC__
00158   bool manual_selection_;
00159 #endif
00160 };
00161 
00162 } // namespace rxtools
00163 
00164 #endif /* RXTOOLS_ROSOUT_LIST_CONTROL_H_ */


rxtools
Author(s): Josh Faust, Rob Wheeler, Ken Conley
autogenerated on Mon Oct 6 2014 07:25:59