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   class BatteryInterface;
00034 }
00035
00036 class WorldInfoViewer : public Gtk::Window
00037 {
00038  public:
00039   WorldInfoViewer( Glib::RefPtr<Gnome::Glade::Xml> ref_xml,
00040                    fawkes::WorldInfoDataContainer* data_container );
00041   virtual ~WorldInfoViewer();
00042
00043   Gtk::Window& get_window() const;
00044
00045   bool update();
00046   void gamestate_changed();
00047
00048  private:
00049   class RobotRecord : public Gtk::TreeModelColumnRecord
00050   {
00051    public:
00052     RobotRecord()
00053     {
00054       add(hostname);
00055       add(fqdn);
00056       add(show_pose);
00057       add(show_ball);
00058       add(show_opponents);
00059     }
00060
00061     Gtk::TreeModelColumn<Glib::ustring> hostname;
00062     Gtk::TreeModelColumn<Glib::ustring> fqdn;
00063     Gtk::TreeModelColumn<bool> show_pose;
00064     Gtk::TreeModelColumn<bool> show_ball;
00065     Gtk::TreeModelColumn<bool> show_opponents;
00066   };
00067
00068   Gtk::Widget* get_widget( Glib::RefPtr<Gnome::Glade::Xml> ref_xml,
00069                            const char* widget_name ) const;
00070
00071   // signal handlers
00072   void on_show_pose_toggled( const Glib::ustring& path );
00073   void on_show_ball_toggled( const Glib::ustring& path );
00074   void on_show_opponents_toggled( const Glib::ustring& path );
00075
00076   Gtk::Window*    m_wnd_main;
00077   Gtk::VBox*      m_vbx_field;
00078   Gtk::TreeView*  m_trv_robots;
00079   Gtk::Statusbar* m_stb_status;
00080
00081   unsigned int m_stb_message_id;
00082
00083   FieldView* m_field_view;
00084
00085   RobotRecord m_robot_record;
00086   Glib::RefPtr<Gtk::ListStore> m_robots_list;
00087
00088   fawkes::WorldInfoDataContainer* m_data_container;
00089
00090   unsigned int m_robot_id;
00091   std::map<Glib::ustring, unsigned int> m_robots;
00092   std::map<unsigned int, Gtk::TreeModel::Row> m_list_entries;
00093 };
00094
00095 #endif /*  __TOOLS_WORLDINFO_VIEWER_WORLDINFO_VIEWER_H_ */