mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
added GUI nodes and texts to AbstractGuiManager
This commit is contained in:
+66
-5
@@ -5,6 +5,8 @@
|
||||
#include "slider.h"
|
||||
#include "checkbox.h"
|
||||
#include "listbox.h"
|
||||
#include "node.h"
|
||||
#include "text.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace vb01Gui{
|
||||
@@ -120,10 +122,6 @@ namespace vb01Gui{
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractGuiManager::addButton(Button* b) {
|
||||
buttons.push_back(b);
|
||||
}
|
||||
|
||||
void AbstractGuiManager::addListbox(Listbox* l) {
|
||||
listboxes.push_back(l);
|
||||
buttons.push_back(l->getListboxButton());
|
||||
@@ -205,6 +203,39 @@ namespace vb01Gui{
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractGuiManager::removeGuiRectangle(Node* r) {
|
||||
for (int i = 0; i < guiRectangles.size(); i++) {
|
||||
if (r == guiRectangles[i]) {
|
||||
guiRectangles.erase(guiRectangles.begin() + i);
|
||||
delete r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO delete node too
|
||||
void AbstractGuiManager::removeText(Text* t) {
|
||||
for (int i = 0; i < texts.size(); i++) {
|
||||
if (t == texts[i]) {
|
||||
texts.erase(texts.begin() + i);
|
||||
delete t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text* AbstractGuiManager::getText(string name){
|
||||
Text *text = nullptr;
|
||||
|
||||
for(Text *t : texts)
|
||||
if(t->getNode()->getName() == name){
|
||||
text = t;
|
||||
break;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
void AbstractGuiManager::removeAllButtons(vector<Button*> exceptions){
|
||||
int targetId = 0;
|
||||
|
||||
@@ -275,16 +306,46 @@ namespace vb01Gui{
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractGuiManager::removeAllGuiRectangles(vector<Node*> exceptions) {
|
||||
int targetId = 0;
|
||||
|
||||
while(targetId != guiRectangles.size()) {
|
||||
if(find(exceptions.begin(), exceptions.end(), guiRectangles[targetId]) == exceptions.end()){
|
||||
delete guiRectangles[guiRectangles.size() - 1];
|
||||
guiRectangles.pop_back();
|
||||
}
|
||||
else
|
||||
targetId++;
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractGuiManager::removeAllTexts(vector<Text*> exceptions) {
|
||||
int targetId = 0;
|
||||
|
||||
while(targetId != textboxes.size()) {
|
||||
if(find(exceptions.begin(), exceptions.end(), texts[targetId]) == exceptions.end()){
|
||||
delete texts[texts.size() - 1];
|
||||
texts.pop_back();
|
||||
}
|
||||
else
|
||||
targetId++;
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractGuiManager::removeAllGuiElements(
|
||||
vector<Button*> buttonExceptions,
|
||||
vector<Listbox*> listboxExceptions,
|
||||
vector<Checkbox*> checkboxExceptions,
|
||||
vector<Slider*> sliderExceptions,
|
||||
vector<Textbox*> textboxExceptions){
|
||||
vector<Textbox*> textboxExceptions,
|
||||
vector<Node*> guiRectExceptions,
|
||||
vector<Text*> textExceptions){
|
||||
removeAllButtons(buttonExceptions);
|
||||
removeAllListboxes(listboxExceptions);
|
||||
removeAllCheckboxes(checkboxExceptions);
|
||||
removeAllSliders(sliderExceptions);
|
||||
removeAllTextboxes(textboxExceptions);
|
||||
removeAllGuiRectangles(guiRectExceptions);
|
||||
removeAllTexts(textExceptions);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user