Make ui::element store style as non-const

This commit is contained in:
Nikita Lisitsa 2022-05-15 13:17:20 +03:00
parent 49e3e2e07b
commit 4c106cc4c6
2 changed files with 14 additions and 14 deletions

View file

@ -65,10 +65,10 @@ namespace psemek::ui
virtual bool transparent() const { return false; }
virtual std::shared_ptr<struct style const> style() const { return style_; }
virtual std::shared_ptr<struct style const> own_style() const { return own_style_; }
virtual std::shared_ptr<struct style const> set_style(std::shared_ptr<struct style const> st);
virtual std::shared_ptr<struct style const> set_own_style(std::shared_ptr<struct style const> st);
virtual std::shared_ptr<struct style> style() const { return style_; }
virtual std::shared_ptr<struct style> own_style() const { return own_style_; }
virtual std::shared_ptr<struct style> set_style(std::shared_ptr<struct style> st);
virtual std::shared_ptr<struct style> set_own_style(std::shared_ptr<struct style> st);
virtual void style_updated() const;
virtual void own_style_updated() const;
@ -89,8 +89,8 @@ namespace psemek::ui
protected:
virtual void release_children();
virtual std::shared_ptr<struct style const> merged_style() const;
virtual std::shared_ptr<struct style const> merged_own_style() const;
virtual std::shared_ptr<struct style> merged_style() const;
virtual std::shared_ptr<struct style> merged_own_style() const;
static bool in_text_input();
static void start_text_input();
@ -101,10 +101,10 @@ namespace psemek::ui
async::event_loop * loop_ = nullptr;
bool enabled_ = true;
bool hidden_ = false;
std::shared_ptr<struct style const> style_;
std::shared_ptr<struct style const> own_style_;
mutable std::shared_ptr<struct style const> merged_style_;
mutable std::shared_ptr<struct style const> merged_own_style_;
std::shared_ptr<struct style> style_;
std::shared_ptr<struct style> own_style_;
mutable std::shared_ptr<struct style> merged_style_;
mutable std::shared_ptr<struct style> merged_own_style_;
bool reshape_posted_ = false;
mutable std::vector<util::function<void()>> delayed_callbacks_;

View file

@ -71,7 +71,7 @@ namespace psemek::ui
return size_constraints()[1];
}
std::shared_ptr<style const> element::set_style(std::shared_ptr<struct style const> st)
std::shared_ptr<style> element::set_style(std::shared_ptr<struct style> st)
{
if (style_)
style_->use_as_style.erase(this);
@ -86,7 +86,7 @@ namespace psemek::ui
return st;
}
std::shared_ptr<struct style const> element::set_own_style(std::shared_ptr<struct style const> st)
std::shared_ptr<struct style> element::set_own_style(std::shared_ptr<struct style> st)
{
if (style_)
style_->use_as_own_style.erase(this);
@ -114,7 +114,7 @@ namespace psemek::ui
merged_own_style_ = nullptr;
}
std::shared_ptr<struct style const> element::merged_style() const
std::shared_ptr<struct style> element::merged_style() const
{
if (!merged_style_)
{
@ -134,7 +134,7 @@ namespace psemek::ui
return merged_style_;
}
std::shared_ptr<struct style const> element::merged_own_style() const
std::shared_ptr<struct style> element::merged_own_style() const
{
if (!merged_own_style_)
{