-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUIalert.cpp
60 lines (43 loc) · 1.27 KB
/
GUIalert.cpp
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
#include "GUI_Common.h"
#include "GUI_Surface_Base.h"
#include "GUI_Surface.h"
#include "GUI_elements.h"
#include "GUI_Looks.h"
#include "GUIentity.h"
#include "GUImanager.h"
#include "GUIplugin.h"
#include "GUIpopup.h"
#include "GUIalert.h"
GUIalert::GUIalert(string text, GUI_BaseElement *parent, RECT rect, string styleid, string styleset)
: GUIpopup(parent, rect, styleid, styleset)
{
//create the text
GUI_ElementStyle *style = GUI_Looks::GetStyle(styleid);
RECT textrect = _R(style->MarginLeft(), style->MarginTop(), width - style->MarginRight(), style->MarginTop() + style->GetFont()->GetfHeight() + 4);
CreateLabel(text, textrect, POPUP, ALERTTEXT, styleid);
//create the ok button
RECT okrect = _R(width / 2 - 20, height - style->MarginBottom() - style->GetFont()->GetfHeight() - 10,
width / 2 + 20, height - style->MarginBottom());
CreateDynamicButton("OK", okrect, POPUP, ALERTOKBTN);
}
GUIalert::~GUIalert()
{
}
bool GUIalert::ProcessChildren(GUI_MOUSE_EVENT _event, int _x, int _y)
{
if (isvisible)
{
int eventid = -1;
for (UINT i = rootelements.size(); i > 0; --i)
{
eventid = rootelements[i - 1]->ProcessMouse(_event, _x, _y);
if (eventid != -1) break;
}
if (eventid == ALERTOKBTN)
{
close();
return true;
}
}
return false;
}