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 
00015 class GLWindowMenu
00016 {
00017  public:
00018   
00019   GLWindowMenu(std::string sName, std::string sTitle);
00020   ~GLWindowMenu();
00021   void Render(int nTop, int nHeight, int nWidth, GLWindow2 &glw);
00022   void FillBox(int l, int r, int t, int b);
00023   void LineBox(int l, int r, int t, int b);
00024   
00025   void GUICommandHandler(std::string sCommand, std::string sParams);
00026   static void GUICommandCallBack(void* ptr, std::string sCommand, std::string sParams);
00027   
00028   bool HandleClick(int button, int state, int x, int y);
00029 
00030   
00031 
00032  private:
00033   enum MenuItemType { Button, Toggle, Monitor, Slider };
00034   
00035   struct MenuItem
00036   {
00037     MenuItemType type;
00038     std::string sName;
00039     std::string sParam;
00040     std::string sNextMenu;
00041     GVars3::gvar2_int gvnIntValue;  // Not used by all, but used by some
00042     int min;
00043     int max;
00044   };
00045   
00046   struct SubMenu
00047   {
00048     std::vector<MenuItem> mvItems;
00049   };
00050   
00051   std::map<std::string, SubMenu> mmSubMenus;
00052   std::string msCurrentSubMenu;
00053   std::string msName;
00054   std::string msTitle;
00055 
00056   
00057   int mnWidth;
00058   int mnMenuTop;
00059   int mnMenuHeight;
00060   int mnTextOffset;
00061   
00062   GVars3::gvar2_int mgvnEnabled;
00063   GVars3::gvar2_int mgvnMenuItemWidth;
00064   GVars3::gvar2_int mgvnMenuTextOffset;
00065   
00066   int mnLeftMostCoord;
00067   
00068 };
00069 
00070 #endif
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 


tum_ardrone
Author(s):
autogenerated on Sat Jun 8 2019 20:27:23