PagesControl, refactor

This commit is contained in:
MihailRis
2023-11-20 03:31:18 +03:00
parent 41f9c51a27
commit 4ea7bda249
15 changed files with 339 additions and 117 deletions
+24
View File
@@ -3,6 +3,8 @@
#include <glm/glm.hpp>
#include <vector>
#include <stack>
#include <string>
#include <memory>
#include "UINode.h"
@@ -56,5 +58,27 @@ namespace gui {
virtual void refresh() override;
virtual void lock() override;
};
struct Page {
std::shared_ptr<UINode> panel = nullptr;
};
class PagesControl : public Container {
protected:
std::unordered_map<std::string, Page> pages;
std::stack<std::string> pageStack;
Page current_;
std::string curname_ = "";
public:
PagesControl();
void set(std::string name, bool history=true);
void add(std::string name, std::shared_ptr<UINode> panel);
void back();
void clearHistory();
void reset();
Page current();
};
}
#endif // FRONTEND_GUI_PANELS_H_