Disable Builder
Disable Builder is used to switch view to ControlState::Disabled. It's application-side configuration view state builder, not a method custom view authors need to override in View trait.
Currently exposed interface is:
Basic Writing
After importing DisableBuilder, all views implementing View can call .disable(...).
Closure returns true means disabled, returns false means normal. Fixed disable can directly write || true, but more common is reading state from signal.
Reactive Disable
.disable(...) will create a reactive updater. After signal read in closure changes, framework will recalculate disable state.
When need to combine multiple conditions, directly write business judgment in closure:
Mechanism Explanation
.disable(...) internally will:
- Read current view's
ViewId. - Use
create_updater_with_idto create an updater. - Write
ViewState.disablewhen updater changes. - Attach effect id to current
ViewId's pending effect list, view creation process will activate it.
Disable state participates in ControlState calculation, and has highest priority: Disabled > Active > Focus > Hover > Normal. View authors read ControlState::Disabled in on_draw, on_measure or event handling, decide visual and interaction behavior in disabled state.
Disable doesn't automatically remove focus table entry, also doesn't automatically cancel current focus. When need runtime change focus capability, use ViewId's focus API.

