Fawkes API  Fawkes Development Version
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 <cairomm/context.h>
00028 
00029 class FieldView;
00030 namespace fawkes {
00031   class WorldInfoDataContainer;
00032 }
00033 
00034 class WorldInfoViewer : public Gtk::Window
00035 {
00036  public:
00037   WorldInfoViewer(Glib::RefPtr<Gtk::Builder> builder,
00038                   fawkes::WorldInfoDataContainer* data_container );
00039   virtual ~WorldInfoViewer();
00040   
00041   Gtk::Window& get_window() const;
00042   
00043   bool update();
00044   void gamestate_changed();
00045   
00046  private:
00047   class RobotRecord : public Gtk::TreeModelColumnRecord
00048   {
00049    public:
00050     RobotRecord()
00051     {
00052       add(hostname);
00053       add(fqdn);
00054       add(show_pose);
00055       add(show_ball);
00056       add(show_opponents);
00057     }
00058     
00059     /// @cond INTERNALS
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     /// @endcond
00066   };
00067 
00068   // signal handlers
00069   void on_show_pose_toggled( const Glib::ustring& path );
00070   void on_show_ball_toggled( const Glib::ustring& path );
00071   void on_show_opponents_toggled( const Glib::ustring& path );
00072 
00073   Gtk::Window*    m_wnd_main;
00074   Gtk::VBox*      m_vbx_field;
00075   Gtk::TreeView*  m_trv_robots;
00076   Gtk::Statusbar* m_stb_status;
00077 
00078   unsigned int m_stb_message_id;
00079   
00080   FieldView* m_field_view;
00081 
00082   RobotRecord m_robot_record;
00083   Glib::RefPtr<Gtk::ListStore> m_robots_list;
00084 
00085   fawkes::WorldInfoDataContainer* m_data_container;
00086 
00087   unsigned int m_robot_id;
00088   std::map<Glib::ustring, unsigned int> m_robots;
00089   std::map<unsigned int, Gtk::TreeModel::Row> m_list_entries;
00090 };
00091 
00092 #endif /*  __TOOLS_WORLDINFO_VIEWER_WORLDINFO_VIEWER_H_ */