Add ui::element::id
This commit is contained in:
parent
c8eaf4abe0
commit
924533fc7f
2 changed files with 10 additions and 0 deletions
|
|
@ -74,6 +74,9 @@ namespace psemek::ui
|
|||
virtual void style_updated() const;
|
||||
virtual void own_style_updated() const;
|
||||
|
||||
virtual std::optional<std::string> const & id() const { return id_; }
|
||||
virtual std::optional<std::string> set_id(std::optional<std::string> id);
|
||||
|
||||
virtual std::optional<std::string> const & hint() const { return hint_; }
|
||||
virtual std::optional<std::string> set_hint(std::optional<std::string> hint);
|
||||
|
||||
|
|
@ -114,6 +117,7 @@ namespace psemek::ui
|
|||
|
||||
mutable std::vector<util::function<void()>> delayed_callbacks_;
|
||||
|
||||
std::optional<std::string> id_;
|
||||
std::optional<std::string> hint_;
|
||||
|
||||
std::any data_;
|
||||
|
|
|
|||
|
|
@ -163,6 +163,12 @@ namespace psemek::ui
|
|||
SDL_StopTextInput();
|
||||
}
|
||||
|
||||
std::optional<std::string> element::set_id(std::optional<std::string> id)
|
||||
{
|
||||
std::swap(id_, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
std::optional<std::string> element::set_hint(std::optional<std::string> hint)
|
||||
{
|
||||
std::swap(hint_, hint);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue