-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMenu_EventDetails.hpp
139 lines (103 loc) · 2.31 KB
/
Menu_EventDetails.hpp
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#pragma once
#ifndef WORLDSIM_MENU_EVENT_DETAILS_CPP
#define WORLDSIM_MENU_EVENT_DETAILS_CPP
/* WorldSim: Menu_EventDetails.cpp
#include "Menu_EventDetails.cpp"
Menu listing the details of the particular event.
*/
#include <Graphics/GUI/GUI_Table.hpp>
#include <Container/Table/Table.hpp>
class Menu_EventDetails: public GUI_Interface
{
public:
GUI_Manager guiManager;
/* Colours / theme. */
ColourRGB <unsigned char> cNormal;
ColourRGB <unsigned char> cSelected;
ColourRGB <unsigned char> cDropPanel;
ColourRGB <unsigned char> cHighlight;
Wildcat::Font* font;
GUI_Button buttonClose;
Event* selectedEvent;
Menu_EventDetails()
{
selectedEvent=0;
}
void setFont(Wildcat::Font* _font)
{
font = _font;
guiManager.setFont(_font);
}
// This is some bad overloading.
void init()
{
init(0);
}
void init(Event* _event)
{
if ( _event != 0 || selectedEvent== 0)
{
selectedEvent=_event;
}
/* Initialise theme. */
cNormal.set(220,220,220);
cSelected.set(180,180,180);
cDropPanel.set(170,170,170);
cHighlight.set(255,160,160);
buttonClose.text="X";
buttonClose.setColours(cNormal,cHighlight,0);
buttonClose.active=true;
guiManager.clear();
guiManager.add(&buttonClose);
guiManager.setFont(font);
eventResize();
}
void render()
{
if (selectedEvent==0)
{
active=false;
return;
}
if ( active )
{
Renderer::placeColour4a(150,150,150,220,panelX1,panelY1,panelX2,panelY2);
font8x8.drawText("Event details",panelX1,panelY2-20,panelX2,panelY2-5, true, true);
int yOffset=35;
int vSpacing=12;
int xBuffer = 50;
font8x8.drawText(selectedEvent->getLongDescription(),panelX1+xBuffer,panelY2-yOffset,panelX2-xBuffer,panelY1, false, false);
yOffset+=vSpacing;
guiManager.render();
}
}
bool keyboardEvent (Keyboard* _keyboard)
{
if ( active )
{
return guiManager.keyboardEvent(_keyboard);
}
return false;
}
bool mouseEvent (Mouse* _mouse)
{
if ( active )
{
/* If the guiManager did something with the mouse event. */
if(guiManager.mouseEvent(_mouse)==true)
{
}
if (buttonClose.clicked==true)
{
active=false;
buttonClose.unclick();
}
}
return false;
}
void eventResize()
{
buttonClose.setPanel(panelX2-40, panelY2-40, panelX2-20, panelY2-20);
}
};
#endif