$search
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 the 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 RVIZ_DISPLAYS_PANEL_H 00031 #define RVIZ_DISPLAYS_PANEL_H 00032 00033 #include "generated/rviz_generated.h" 00034 00035 #include <boost/thread/mutex.hpp> 00036 #include <boost/signals/trackable.hpp> 00037 #include <boost/weak_ptr.hpp> 00038 00039 #include <vector> 00040 #include <map> 00041 #include <set> 00042 00043 namespace Ogre 00044 { 00045 class Root; 00046 class SceneManager; 00047 class Camera; 00048 class RaySceneQuery; 00049 class ParticleSystem; 00050 } 00051 00052 class wxTimerEvent; 00053 class wxKeyEvent; 00054 class wxSizeEvent; 00055 class wxTimer; 00056 class wxPropertyGrid; 00057 class wxPropertyGridEvent; 00058 class wxConfigBase; 00059 00060 namespace rviz 00061 { 00062 00063 class VisualizationManager; 00064 class Tool; 00065 00066 class Display; 00067 class DisplayWrapper; 00068 typedef std::vector<DisplayWrapper*> V_DisplayWrapper; 00069 00074 class DisplaysPanel : public DisplaysPanelGenerated, public boost::signals::trackable 00075 { 00076 public: 00083 DisplaysPanel( wxWindow* parent ); 00084 virtual ~DisplaysPanel(); 00085 00086 void initialize(VisualizationManager* manager); 00087 00088 wxPropertyGrid* getPropertyGrid() { return property_grid_; } 00089 VisualizationManager* getManager() { return manager_; } 00090 00091 protected: 00092 void setDisplayCategoryLabel(const DisplayWrapper* display, int index); 00093 void setDisplayCategoryColor(const DisplayWrapper* display); 00094 00095 void sortDisplays(); 00096 00097 // wx callbacks 00099 void onPropertyChanging( wxPropertyGridEvent& event ); 00101 void onPropertyChanged( wxPropertyGridEvent& event ); 00103 void onPropertySelected( wxPropertyGridEvent& event ); 00105 void onPropertyHighlighted( wxPropertyGridEvent& event ); 00107 void onLinkClicked(wxHtmlLinkEvent& event); 00108 00109 void onStateChangedTimer(wxTimerEvent& event); 00110 00112 virtual void onNewDisplay( wxCommandEvent& event ); 00114 virtual void onDeleteDisplay( wxCommandEvent& event ); 00116 virtual void onManage(wxCommandEvent& event); 00117 00118 // Other callbacks 00120 void onDisplayStateChanged(Display* display); 00121 void onDisplayCreated(DisplayWrapper* display); 00122 void onDisplayDestroyed(DisplayWrapper* display); 00123 void onDisplayAdding(DisplayWrapper* display); 00124 void onDisplayAdded(DisplayWrapper* display); 00125 void onDisplayRemoving(DisplayWrapper* display); 00126 void onDisplayRemoved(DisplayWrapper* display); 00127 void onDisplaysRemoving(const V_DisplayWrapper& displays); 00128 void onDisplaysRemoved(const V_DisplayWrapper& displays); 00129 void onDisplaysConfigLoaded(const boost::shared_ptr<wxConfigBase>& config); 00130 void onDisplaysConfigSaving(const boost::shared_ptr<wxConfigBase>& config); 00131 00132 wxPropertyGrid* property_grid_; 00133 VisualizationManager* manager_; 00134 DisplayWrapper* selected_display_; 00135 00136 typedef std::map<DisplayWrapper*, uint32_t> M_DisplayToIndex; 00137 M_DisplayToIndex display_map_; 00138 00139 typedef std::set<Display*> S_Display; 00140 boost::mutex state_changed_displays_mutex_; 00141 S_Display state_changed_displays_; 00142 wxTimer* state_changed_timer_; 00143 }; 00144 00145 } // namespace rviz 00146 00147 #endif 00148