feat: key pressed event interception & 'owner' input.add_callback third argument
This commit is contained in:
@@ -2,11 +2,12 @@
|
||||
|
||||
#include "UINode.hpp"
|
||||
#include "commons.hpp"
|
||||
#include "util/ObjectsKeeper.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace gui {
|
||||
class Container : public UINode {
|
||||
class Container : public UINode, public util::ObjectsKeeper {
|
||||
int prevScrollY = -1;
|
||||
protected:
|
||||
std::vector<std::shared_ptr<UINode>> nodes;
|
||||
|
||||
@@ -13,11 +13,15 @@ bool Menu::has(const std::string& name) {
|
||||
pageSuppliers.find(name) != pageSuppliers.end();
|
||||
}
|
||||
|
||||
void Menu::addPage(const std::string& name, const std::shared_ptr<UINode> &panel) {
|
||||
pages[name] = Page{name, panel};
|
||||
void Menu::addPage(const std::string& name, const std::shared_ptr<UINode>& panel) {
|
||||
pages[name] = Page {name, panel};
|
||||
}
|
||||
|
||||
void Menu::addSupplier(const std::string &name, const supplier<std::shared_ptr<UINode>> &pageSupplier) {
|
||||
void Menu::removePage(const std::string& name) {
|
||||
pages.erase(name);
|
||||
}
|
||||
|
||||
void Menu::addSupplier(const std::string& name, const supplier<std::shared_ptr<UINode>>& pageSupplier) {
|
||||
pageSuppliers[name] = pageSupplier;
|
||||
}
|
||||
|
||||
@@ -89,6 +93,6 @@ void Menu::reset() {
|
||||
clearHistory();
|
||||
if (current.panel) {
|
||||
Container::remove(current.panel);
|
||||
current = Page{"", nullptr};
|
||||
current = Page {"", nullptr};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace gui {
|
||||
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 removePage(const std::string& name);
|
||||
std::shared_ptr<UINode> fetchPage(const std::string& name);
|
||||
|
||||
/// @brief Add page supplier used if page is not found
|
||||
|
||||
Reference in New Issue
Block a user