Worlds indexing
This commit is contained in:
@@ -27,6 +27,7 @@ GUI::GUI() {
|
||||
|
||||
menu = new PagesControl();
|
||||
container->add(menu);
|
||||
container->scrollable(false);
|
||||
}
|
||||
|
||||
GUI::~GUI() {
|
||||
@@ -160,4 +161,14 @@ shared_ptr<UINode> GUI::get(string name) {
|
||||
|
||||
void GUI::remove(string name) {
|
||||
storage.erase(name);
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::setFocus(shared_ptr<UINode> node) {
|
||||
if (focus) {
|
||||
focus->defocus();
|
||||
}
|
||||
focus = node;
|
||||
if (focus) {
|
||||
focus->focus(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace gui {
|
||||
void store(std::string name, std::shared_ptr<UINode> node);
|
||||
std::shared_ptr<UINode> get(std::string name);
|
||||
void remove(std::string name);
|
||||
void setFocus(std::shared_ptr<UINode> node);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -37,19 +37,20 @@ void guiutil::alert(GUI* gui, wstring text, gui::runnable on_hidden) {
|
||||
menu->set("<alert>");
|
||||
}
|
||||
|
||||
void guiutil::confirm(GUI* gui, wstring text, gui::runnable on_confirm) {
|
||||
void guiutil::confirm(GUI* gui, wstring text, gui::runnable on_confirm,
|
||||
wstring yestext, wstring notext) {
|
||||
PagesControl* menu = gui->getMenu();
|
||||
Panel* panel = new Panel(vec2(500, 200), vec4(8.0f), 8.0f);
|
||||
Panel* panel = new Panel(vec2(600, 200), vec4(8.0f), 8.0f);
|
||||
panel->color(vec4(0.0f, 0.0f, 0.0f, 0.5f));
|
||||
panel->add(new Label(text));
|
||||
Panel* subpanel = new Panel(vec2(500, 53));
|
||||
Panel* subpanel = new Panel(vec2(600, 53));
|
||||
subpanel->color(vec4(0));
|
||||
subpanel->add((new Button(L"Yes", vec4(8.0f)))->listenAction([=](GUI*){
|
||||
subpanel->add((new Button(yestext, vec4(8.0f)))->listenAction([=](GUI*){
|
||||
if (on_confirm)
|
||||
on_confirm();
|
||||
menu->back();
|
||||
}));
|
||||
subpanel->add((new Button(L"No", vec4(8.0f)))->listenAction([=](GUI*){
|
||||
subpanel->add((new Button(notext, vec4(8.0f)))->listenAction([=](GUI*){
|
||||
menu->back();
|
||||
}));
|
||||
panel->add(subpanel);
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace guiutil {
|
||||
gui::Button* backButton(gui::PagesControl* menu);
|
||||
gui::Button* gotoButton(std::wstring text, std::string page, gui::PagesControl* menu);
|
||||
void alert(gui::GUI* gui, std::wstring text, gui::runnable on_hidden=nullptr);
|
||||
void confirm(gui::GUI* gui, std::wstring text, gui::runnable on_confirm=nullptr);
|
||||
void confirm(gui::GUI* gui, std::wstring text, gui::runnable on_confirm=nullptr,
|
||||
std::wstring yestext=L"Yes", std::wstring notext=L"No");
|
||||
}
|
||||
|
||||
#endif // FRONTEND_GUI_GUI_UTIL_H_
|
||||
|
||||
Reference in New Issue
Block a user