-
Notifications
You must be signed in to change notification settings - Fork 28
/
GLWindowMenu.h
80 lines (51 loc) · 1.48 KB
/
GLWindowMenu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -*- c++ -*-
// Copyright 2008 Isis Innovation Limited
#ifndef __GL_WINDOW_MENU_H
#define __GL_WINDOW_MENU_H
// A simple gvars-driven menu system for GLWindow2
// N.b. each GLWindowMenu class internally contains sub-menus
#include <vector>
#include <map>
#include <gvars3/gvars3.h>
#include "GLWindow2.h"
class GLWindowMenu
{
public:
GLWindowMenu(std::string sName, std::string sTitle);
~GLWindowMenu();
void Render(int nTop, int nHeight, int nWidth, GLWindow2 &glw);
void FillBox(int l, int r, int t, int b);
void LineBox(int l, int r, int t, int b);
void GUICommandHandler(std::string sCommand, std::string sParams);
static void GUICommandCallBack(void* ptr, std::string sCommand, std::string sParams);
bool HandleClick(int button, int state, int x, int y);
private:
enum MenuItemType { Button, Toggle, Monitor, Slider };
struct MenuItem
{
MenuItemType type;
std::string sName;
std::string sParam;
std::string sNextMenu;
GVars3::gvar2_int gvnIntValue; // Not used by all, but used by some
int min;
int max;
};
struct SubMenu
{
std::vector<MenuItem> mvItems;
};
std::map<std::string, SubMenu> mmSubMenus;
std::string msCurrentSubMenu;
std::string msName;
std::string msTitle;
int mnWidth;
int mnMenuTop;
int mnMenuHeight;
int mnTextOffset;
GVars3::gvar2_int mgvnEnabled;
GVars3::gvar2_int mgvnMenuItemWidth;
GVars3::gvar2_int mgvnMenuTextOffset;
int mnLeftMostCoord;
};
#endif