| 127 | } |
| 128 | |
| 129 | void Element::propagate_disabled(bool disabled) { |
| 130 | disabled_from_parent = disabled; |
| 131 | |
| 132 | bool attribute_state = disabled_from_parent || !enabled; |
| 133 | if (disabled_attribute != attribute_state) { |
| 134 | disabled_attribute = attribute_state; |
| 135 | base->SetAttribute("disabled", attribute_state); |
| 136 | |
| 137 | if (events_enabled & Events(EventType::Enable)) { |
| 138 | handle_event(Event::enable_event(!attribute_state)); |
| 139 | } |
| 140 | |
| 141 | for (auto &child : children) { |
| 142 | child->propagate_disabled(attribute_state); |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | void Element::handle_event(const Event& event) { |
| 148 | for (const auto& callback : callbacks) { |