improve progress bar, refactor node destruction, simplify layers export

This commit is contained in:
2019-08-16 10:15:14 +02:00
parent bb7d681dc3
commit fa94aa632f
17 changed files with 66 additions and 169 deletions

View File

@@ -13,7 +13,7 @@
#include "oculus_vr.h"
#endif
std::shared_ptr<NodeProgressBar> App::show_progress(const std::string& title)
std::shared_ptr<NodeProgressBar> App::show_progress(const std::string& title, int total /*= 0*/)
{
auto pb = std::make_shared<NodeProgressBar>();
pb->m_manager = &layout;
@@ -22,18 +22,25 @@ std::shared_ptr<NodeProgressBar> App::show_progress(const std::string& title)
pb->loaded();
pb->m_progress->SetWidthP(0);
pb->m_title->set_text(title.c_str());
pb->m_total = total;
pb->m_count = 0;
layout[main_id]->add_child(pb);
return pb;
}
NodeMessageBox* App::message_box(const std::string &title, const std::string& text, bool cancel_button)
std::shared_ptr<NodeMessageBox> App::message_box(const std::string &title, const std::string& text, bool cancel_button)
{
auto* m = layout[main_id]->add_child<NodeMessageBox>();
auto m = std::make_shared<NodeMessageBox>();
m->m_manager = &layout;
m->init();
m->create();
m->loaded();
m->m_title->set_text(title.c_str());
m->m_message->set_text(text.c_str());
m->btn_ok->m_text->set_text("Ok");
if (!cancel_button)
m->btn_cancel->destroy();
layout[main_id]->add_child(m);
return m;
}