GLWindowMenu.h
Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Copyright 2008 Isis Innovation Limited
00003 
00004 #ifndef __GL_WINDOW_MENU_H
00005 #define __GL_WINDOW_MENU_H
00006 
00007 // A simple gvars-driven menu system for GLWindow2
00008 // N.b. each GLWindowMenu class internally contains sub-menus
00009 
00010 #include <vector>
00011 #include <map>
00012 #include <gvars3/gvars3.h>
00013 #include "GLWindow2.h"
00014 #include <ros/ros.h>
00015 #include <ros/package.h>
00016 
00017 class GLWindowMenu
00018 {
00019 public:
00020 
00021   GLWindowMenu(std::string sName, std::string sTitle);
00022   ~GLWindowMenu();
00023   void Render(int nTop, int nHeight, int nWidth, GLWindow2 &glw);
00024   void FillBox(int l, int r, int t, int b);
00025   void LineBox(int l, int r, int t, int b);
00026 
00027   void GUICommandHandler(std::string sCommand, std::string sParams);
00028   static void GUICommandCallBack(void* ptr, std::string sCommand, std::string sParams);
00029 
00030   bool HandleClick(int button, int state, int x, int y);
00031 
00032 
00033 
00034 private:
00035   enum MenuItemType { Button, Toggle, Monitor, Slider };
00036 
00037   struct MenuItem
00038   {
00039     MenuItemType type;
00040     std::string sName;
00041     std::string sParam;
00042     std::string sNextMenu;
00043     GVars3::gvar2_int gvnIntValue;  // Not used by all, but used by some
00044     int min;
00045     int max;
00046   };
00047 
00048   struct SubMenu
00049   {
00050     std::vector<MenuItem> mvItems;
00051   };
00052 
00053   std::map<std::string, SubMenu> mmSubMenus;
00054   std::string msCurrentSubMenu;
00055   std::string msName;
00056   std::string msTitle;
00057 
00058 
00059   int mnWidth;
00060   int mnMenuTop;
00061   int mnMenuHeight;
00062   int mnTextOffset;
00063 
00064   //Weiss{
00065   int mgvnEnabled;
00066   int mgvnMenuItemWidth;
00067   int mgvnMenuTextOffset;
00068   //GVars3::gvar2_int mgvnEnabled;
00069   //GVars3::gvar2_int mgvnMenuItemWidth;
00070   //GVars3::gvar2_int mgvnMenuTextOffset;
00071   //}
00072   int mnLeftMostCoord;
00073 
00074 };
00075 
00076 #endif
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 


ptam
Author(s): Markus Achtelik , Stephan Weiss , Simon Lynen
autogenerated on Sun Oct 5 2014 23:52:33