This commit is contained in:
MihailRis
2024-03-19 14:33:08 +03:00
parent ed6cb6a620
commit 4b6c61ad89
6 changed files with 20 additions and 4 deletions
+1 -1
View File
@@ -248,7 +248,7 @@ Orientation Panel::getOrientation() const {
PagesControl::PagesControl() : Container(glm::vec2(1)){
}
bool PagesControl::has(std::string name) {
bool PagesControl::has(const std::string& name) {
return pages.find(name) != pages.end();
}
+1 -1
View File
@@ -99,7 +99,7 @@ namespace gui {
public:
PagesControl();
bool has(std::string name);
bool has(const std::string& name);
void setPage(std::string name, bool history=true);
void addPage(std::string name, std::shared_ptr<UINode> panel);
void back();
+5 -1
View File
@@ -24,7 +24,11 @@ std::shared_ptr<Button> guiutil::gotoButton(
) {
text = langs::get(text, L"menu");
return std::make_shared<Button>(text, glm::vec4(10.f), [=](GUI* gui) {
menu->setPage(page);
if (menu->has(page)) {
menu->setPage(page);
} else {
menu->setPage("404");
}
});
}