My Project
F:
University
Git
lego
lego
interface
drawinterface.cpp
Go to the documentation of this file.
1
#include "
stdafx.h
"
2
#include "../stdafx.h"
3
#include "
text.h
"
4
#include "
drawinterface.h
"
5
6
HDC
BaseDrawInterfaceElement::hdc
;
7
8
BaseDrawInterfaceElement::BaseDrawInterfaceElement
()
9
{
10
11
}
12
13
BaseDrawInterfaceElement::BaseDrawInterfaceElement
(HDC
hdc
)
14
{
15
this->hdc =
hdc
;
16
}
17
18
BaseDrawInterfaceElement::~BaseDrawInterfaceElement
()
19
{
20
21
}
22
23
BaseDrawInterface::BaseDrawInterface
()
24
{
25
26
}
27
28
BaseDrawInterface::~BaseDrawInterface
()
29
{
30
for
(
int
i = 0; i < this->interfaceDrawList.size(); i++)
31
{
32
delete
this->interfaceDrawList[i]->_BaseInterfaceDraw;
33
}
34
this->interfaceDrawList.clear();
35
}
36
37
Text
*
BaseDrawInterface::text
(
int
ID)
38
{
39
for
(
int
i = 0; i < this->interfaceDrawList.size(); i++)
40
{
41
if
((this->interfaceDrawList[i]->
id
== ID) && (this->interfaceDrawList[i]->type ==
EDTEXT
))
42
{
43
return
(
Text
*)this->interfaceDrawList[i]->_BaseInterfaceDraw;
44
}
45
}
46
InterfaceDraw
* txt =
new
InterfaceDraw
;
47
txt->
type
=
EDTEXT
;
48
txt->
id
= ID;
49
txt->
_BaseInterfaceDraw
=
new
Text
();
50
this->interfaceDrawList.push_back(txt);
51
return
(
Text
*)txt->
_BaseInterfaceDraw
;
52
}
53
54
URectangle
*
BaseDrawInterface::rectangle
(
int
ID)
55
{
56
for
(
int
i = 0; i < this->interfaceDrawList.size(); i++)
57
{
58
if
((this->interfaceDrawList[i]->
id
== ID) && (this->interfaceDrawList[i]->type ==
EDRECTANGLE
))
59
{
60
return
(
URectangle
*)this->interfaceDrawList[i]->_BaseInterfaceDraw;
61
}
62
}
63
InterfaceDraw
* txt =
new
InterfaceDraw
;
64
txt->
type
=
EDRECTANGLE
;
65
txt->
id
= ID;
66
txt->
_BaseInterfaceDraw
=
new
URectangle
();
67
this->interfaceDrawList.push_back(txt);
68
return
(
URectangle
*)txt->
_BaseInterfaceDraw
;
69
}
70
71
bool
BaseDrawInterface::redraw
(
int
ID)
72
{
73
bool
flag =
true
;
74
for
(
int
i = 0; i < this->interfaceDrawList.size(); i++)
75
{
76
if
(ID == -1 || this->interfaceDrawList[i]->
id
== ID)
77
{
78
if
(!this->interfaceDrawList[i]->_BaseInterfaceDraw->redraw())
79
{
80
flag =
false
;
81
}
82
}
83
}
84
return
flag;
85
}
86
87
void
BaseDrawInterface::remove
(
int
ID)
88
{
89
for
(
int
i = 0; i < this->interfaceDrawList.size(); i++)
90
{
91
if
(this->interfaceDrawList[i]->
id
== ID)
92
{
93
delete
this->interfaceDrawList[i]->_BaseInterfaceDraw;
94
this->interfaceDrawList.erase(this->interfaceDrawList.begin() + i);
95
}
96
}
97
}
Text
Button interface class Provide interface for creating/removing custom text.
Definition:
text.h:24
EDRECTANGLE
Rectangle.
Definition:
drawinterface.h:99
BaseDrawInterface::BaseDrawInterface
BaseDrawInterface()
Definition:
drawinterface.cpp:23
BaseDrawInterfaceElement::~BaseDrawInterfaceElement
~BaseDrawInterfaceElement()
Definition:
drawinterface.cpp:18
BaseDrawInterface::redraw
bool redraw(int ID=-1)
Definition:
drawinterface.cpp:71
text.h
Text interface class.
BaseDrawInterface::rectangle
URectangle * rectangle(int ID)
Definition:
drawinterface.cpp:54
URectangle
Rectangle interface class Provide interface for creating/removing custom rectangle.
Definition:
rectangle.h:24
InterfaceDraw::_BaseInterfaceDraw
BaseDrawInterfaceElement * _BaseInterfaceDraw
Pointer to object of element.
Definition:
drawinterface.h:110
InterfaceDraw
Definition:
drawinterface.h:106
stdafx.h
BaseDrawInterface::text
Text * text(int ID)
Definition:
drawinterface.cpp:37
BaseDrawInterfaceElement::hdc
static HDC hdc
Definition:
drawinterface.h:57
BaseDrawInterface::~BaseDrawInterface
~BaseDrawInterface()
Definition:
drawinterface.cpp:28
InterfaceDraw::id
int id
Unique ID of element.
Definition:
drawinterface.h:109
EDTEXT
Text.
Definition:
drawinterface.h:97
BaseDrawInterface::remove
void remove(int ID)
Definition:
drawinterface.cpp:87
drawinterface.h
InterfaceDraw::type
enum InterfaceDrawType type
Interface Element type.
Definition:
drawinterface.h:108
BaseDrawInterfaceElement::BaseDrawInterfaceElement
BaseDrawInterfaceElement()
Definition:
drawinterface.cpp:8
Generated by
1.8.12