Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Gagis committed Nov 15, 2023
1 parent 1601a0c commit 8b06114
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/morda/widgets/button/button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@ button::button(const utki::shared_ref<morda::context>& c, const treeml::forest&
}

if (p.value == "pressed") {
this->isPressed_v = get_property_value(p).to_bool();
this->is_pressed_v = get_property_value(p).to_bool();
}
}
}

void button::set_pressed(bool pressed)
{
if (this->isPressed_v == pressed) {
if (this->is_pressed_v == pressed) {
return;
}
this->isPressed_v = pressed;
this->isPressedChangedNotified = false;
this->is_pressed_v = pressed;
this->is_pressed_changed_notified = false;
this->on_press_change();
}

void button::on_press_change()
{
if (this->isPressedChangedNotified) {
if (this->is_pressed_changed_notified) {
return;
}
this->isPressedChangedNotified = true;
this->is_pressed_changed_notified = true;

if (this->press_handler) {
this->press_handler(*this);
Expand Down
6 changes: 3 additions & 3 deletions src/morda/widgets/button/button.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ namespace morda {
*/
class button : public virtual widget
{
bool isPressed_v = false;
bool isPressedChangedNotified = true;
bool is_pressed_v = false;
bool is_pressed_changed_notified = true;

protected:
/**
Expand All @@ -53,7 +53,7 @@ class button : public virtual widget
*/
bool is_pressed() const noexcept
{
return this->isPressed_v;
return this->is_pressed_v;
}

void set_pressed(bool pressed);
Expand Down

0 comments on commit 8b06114

Please sign in to comment.