Allow storing arbitrary user data in ui::element
This commit is contained in:
parent
4c106cc4c6
commit
0b3ef5f4f5
1 changed files with 6 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <any>
|
||||
|
||||
namespace psemek::ui
|
||||
{
|
||||
|
|
@ -76,6 +77,9 @@ namespace psemek::ui
|
|||
virtual std::optional<std::string> const & hint() const { return hint_; }
|
||||
virtual std::optional<std::string> set_hint(std::optional<std::string> hint);
|
||||
|
||||
virtual std::any const & data() const { return data_; }
|
||||
virtual std::any & data() { return data_; }
|
||||
|
||||
virtual void update(float /* dt */) {}
|
||||
|
||||
virtual void draw(painter & p) const = 0;
|
||||
|
|
@ -111,6 +115,8 @@ namespace psemek::ui
|
|||
|
||||
std::optional<std::string> hint_;
|
||||
|
||||
std::any data_;
|
||||
|
||||
void post_delayed_callbacks() const;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue