forked from aleksanderkoder/VanityUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPage.cpp
More file actions
158 lines (137 loc) · 3.73 KB
/
Copy pathPage.cpp
File metadata and controls
158 lines (137 loc) · 3.73 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#include "Page.h"
Page::Page() {
this->buttons = new std::vector<Button*>();
this->labels = new std::vector<Label*>();
this->checkboxes = new std::vector<Checkbox*>();
this->textboxes = new std::vector<Textbox*>();
this->images = new std::vector<Image*>();
this->sliders = new std::vector<Slider*>();
this->divisions = new std::vector<Division*>();
}
void Page::AddElement(Button* button) {
this->buttons->push_back(button);
}
void Page::AddElement(Label* label) {
this->labels->push_back(label);
}
void Page::AddElement(Checkbox* checkbox) {
this->checkboxes->push_back(checkbox);
}
void Page::AddElement(Textbox* textbox) {
this->textboxes->push_back(textbox);
}
void Page::AddElement(Image* image) {
this->images->push_back(image);
}
void Page::AddElement(Slider* slider) {
this->sliders->push_back(slider);
}
void Page::AddElement(Division* division) {
this->divisions->push_back(division);
// Add all elements to page contained within the divison
auto buttons = division->GetButtons();
for (int i = 0; i < buttons->size(); i++) {
this->AddElement((*buttons)[i]);
}
auto textboxes = division->GetTextboxes();
for (int i = 0; i < textboxes->size(); i++) {
this->AddElement((*textboxes)[i]);
}
auto labels = division->GetLabels();
for (int i = 0; i < labels->size(); i++) {
this->AddElement((*labels)[i]);
}
auto checkboxes = division->GetCheckboxes();
for (int i = 0; i < checkboxes->size(); i++) {
this->AddElement((*checkboxes)[i]);
}
auto sliders = division->GetSliders();
for (int i = 0; i < sliders->size(); i++) {
this->AddElement((*sliders)[i]);
}
auto images = division->GetImages();
for (int i = 0; i < images->size(); i++) {
this->AddElement((*images)[i]);
}
auto divisions = division->GetDivisions();
for (int i = 0; i < divisions->size(); i++) {
this->AddElement((*divisions)[i]);
}
}
void Page::RemoveElement(Button* button) {
auto btns = this->buttons;
for (int i = 0; i < btns->size(); i++) {
Button* curr = (*btns)[i];
if (curr == button)
btns->erase(btns->begin() + i);
}
}
void Page::RemoveElement(Label* label) {
auto lbls = this->labels;
for (int i = 0; i < lbls->size(); i++) {
Label* curr = (*lbls)[i];
if (curr == label)
lbls->erase(lbls->begin() + i);
}
}
void Page::RemoveElement(Checkbox* checkbox) {
auto chkb = this->checkboxes;
for (int i = 0; i < chkb->size(); i++) {
Checkbox* curr = (*chkb)[i];
if (curr == checkbox)
chkb->erase(chkb->begin() + i);
}
}
void Page::RemoveElement(Textbox* textbox) {
auto txtb = this->textboxes;
for (int i = 0; i < txtb->size(); i++) {
Textbox* curr = (*txtb)[i];
if (curr == textbox)
txtb->erase(txtb->begin() + i);
}
}
void Page::RemoveElement(Image* image) {
auto img = this->images;
for (int i = 0; i < img->size(); i++) {
Image* curr = (*img)[i];
if (curr == image)
img->erase(img->begin() + i);
}
}
void Page::RemoveElement(Slider* slider) {
auto sliders = this->sliders;
for (int i = 0; i < sliders->size(); i++) {
Slider* curr = (*sliders)[i];
if (curr == slider)
sliders->erase(sliders->begin() + i);
}
}
void Page::RemoveElement(Division* division) {
auto divs = this->divisions;
for (int i = 0; i < divs->size(); i++) {
Division* curr = (*divs)[i];
if (curr == division)
divs->erase(divs->begin() + i);
}
}
std::vector<Button*>* Page::GetButtons() {
return this->buttons;
}
std::vector<Label*>* Page::GetLabels() {
return this->labels;
}
std::vector<Checkbox*>* Page::GetCheckboxes() {
return this->checkboxes;
}
std::vector<Textbox*>* Page::GetTextboxes() {
return this->textboxes;
}
std::vector<Image*>* Page::GetImages() {
return this->images;
}
std::vector<Slider*>* Page::GetSliders() {
return this->sliders;
}
std::vector<Division*>* Page::GetDivisions() {
return this->divisions;
}