worldinfo_viewer.h

00001 
00002 /***************************************************************************
00003  *  worldinfo_viewer.h - World Info Viewer
00004  *
00005  *  Created: Wed April 09 20:09:01 2008
00006  *  Copyright  2008  Daniel Beck
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __TOOLS_WORLDINFO_VIEWER_WORLDINFO_VIEWER_H_
00024 #define __TOOLS_WORLDINFO_VIEWER_WORLDINFO_VIEWER_H_
00025 
00026 #include <gtkmm.h>
00027 #include <libglademm/xml.h>
00028 #include <cairomm/context.h>
00029 
00030 class FieldView;
00031 namespace fawkes {
00032   class WorldInfoDataContainer;
00033 }
00034 
00035 class WorldInfoViewer : public Gtk::Window
00036 {
00037  public:
00038   WorldInfoViewer( Glib::RefPtr<Gnome::Glade::Xml> ref_xml,
00039                    fawkes::WorldInfoDataContainer* data_container );
00040   virtual ~WorldInfoViewer();
00041   
00042   Gtk::Window& get_window() const;
00043   
00044   bool update();
00045   void gamestate_changed();
00046   
00047  private:
00048   class RobotRecord : public Gtk::TreeModelColumnRecord
00049   {
00050    public:
00051     RobotRecord()
00052     {
00053       add(hostname);
00054       add(fqdn);
00055       add(show_pose);
00056       add(show_ball);
00057       add(show_opponents);
00058     }
00059     
00060     Gtk::TreeModelColumn<Glib::ustring> hostname;
00061     Gtk::TreeModelColumn<Glib::ustring> fqdn;
00062     Gtk::TreeModelColumn<bool> show_pose;
00063     Gtk::TreeModelColumn<bool> show_ball;
00064     Gtk::TreeModelColumn<bool> show_opponents;
00065   };
00066 
00067   Gtk::Widget* get_widget( Glib::RefPtr<Gnome::Glade::Xml> ref_xml,
00068                            const char* widget_name ) const;
00069 
00070   // signal handlers
00071   void on_show_pose_toggled( const Glib::ustring& path );
00072   void on_show_ball_toggled( const Glib::ustring& path );
00073   void on_show_opponents_toggled( const Glib::ustring& path );
00074 
00075   Gtk::Window*    m_wnd_main;
00076   Gtk::VBox*      m_vbx_field;
00077   Gtk::TreeView*  m_trv_robots;
00078   Gtk::Statusbar* m_stb_status;
00079 
00080   unsigned int m_stb_message_id;
00081   
00082   FieldView* m_field_view;
00083 
00084   RobotRecord m_robot_record;
00085   Glib::RefPtr<Gtk::ListStore> m_robots_list;
00086 
00087   fawkes::WorldInfoDataContainer* m_data_container;
00088 
00089   unsigned int m_robot_id;
00090   std::map<Glib::ustring, unsigned int> m_robots;
00091   std::map<unsigned int, Gtk::TreeModel::Row> m_list_entries;
00092 };
00093 
00094 #endif /*  __TOOLS_WORLDINFO_VIEWER_WORLDINFO_VIEWER_H_ */