mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
fix temporary pages
This commit is contained in:
parent
48aad8d974
commit
435a8299b7
3 changed files with 31 additions and 21 deletions
|
|
@ -8,6 +8,7 @@ namespace gui {
|
|||
struct Page {
|
||||
std::string name;
|
||||
std::shared_ptr<UINode> panel;
|
||||
bool temporal = false;
|
||||
};
|
||||
|
||||
using page_loader_func = std::function<std::shared_ptr<UINode>(const std::string& name)>;
|
||||
|
|
@ -31,14 +32,21 @@ namespace gui {
|
|||
/// @param history previous page will not be saved in history if false
|
||||
void setPage(const std::string &name, bool history=true);
|
||||
void setPage(Page page, bool history=true);
|
||||
void addPage(const std::string& name, const std::shared_ptr<UINode>& panel);
|
||||
void addPage(
|
||||
const std::string& name,
|
||||
const std::shared_ptr<UINode>& panel,
|
||||
bool temporal = false
|
||||
);
|
||||
void removePage(const std::string& name);
|
||||
std::shared_ptr<UINode> fetchPage(const std::string& name);
|
||||
Page fetchPage(const std::string& name);
|
||||
|
||||
/// @brief Add page supplier used if page is not found
|
||||
/// @param name page name
|
||||
/// @param pageSupplier page supplier function
|
||||
void addSupplier(const std::string& name, const supplier<std::shared_ptr<UINode>>& pageSupplier);
|
||||
void addSupplier(
|
||||
const std::string& name,
|
||||
const supplier<std::shared_ptr<UINode>>& pageSupplier
|
||||
);
|
||||
|
||||
/// @brief Page loader is called if accessed page is not found
|
||||
void setPageLoader(page_loader_func loader);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue