My Project
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 
7 
9 {
10 
11 }
12 
14 {
15  this->hdc = hdc;
16 }
17 
19 {
20 
21 }
22 
24 {
25 
26 }
27 
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 
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 
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 
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 
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 }
Button interface class Provide interface for creating/removing custom text.
Definition: text.h:24
Rectangle.
Definition: drawinterface.h:99
bool redraw(int ID=-1)
Text interface class.
URectangle * rectangle(int ID)
Rectangle interface class Provide interface for creating/removing custom rectangle.
Definition: rectangle.h:24
BaseDrawInterfaceElement * _BaseInterfaceDraw
Pointer to object of element.
Text * text(int ID)
int id
Unique ID of element.
Text.
Definition: drawinterface.h:97
void remove(int ID)
enum InterfaceDrawType type
Interface Element type.