Implement disabled for druid controls#1717
Conversation
…ledChanged - implemented the disabled state in WidgetPod - changed call to focus_change from event to post event processing - implemented disabled handling in window.rs and core.rs
- the focus chain was cleared, if the widget was disabled
(i hope)
Update Documentation Co-authored-by: Colin Rofls <colin@cmyr.net>
Update documentation Co-authored-by: Colin Rofls <colin@cmyr.net>
Co-authored-by: Colin Rofls <colin@cmyr.net>
Signed-off-by: xarvic <xarvix@web.de>
|
This is weird. Github believes that i made the change from #1702 here because i merged the branches before creating the PR :/ I hope this will be fine. |
Signed-off-by: xarvic <xarvix@web.de>
Signed-off-by: xarvic <xarvix@web.de>
|
@xarvic if you like you could just squash locally? Otherwise we can squash afterwards, I'm not too concerned. |
cmyr
left a comment
There was a problem hiding this comment.
A few notes inline, but basically I think this is good; I just have two real notes about the styling.
- Anything that displays text, when disabled, should dim that text. This means the textbox, but also labels anywhere they appear, like the checkbox or the the radio button, or the text in the switch.
|
Will this resolve #143 once it merges? |
|
Yes and it also resolves #746 |
Signed-off-by: xarvic <xarvix@web.de>
Signed-off-by: xarvic <xarvix@web.de>
cmyr
left a comment
There was a problem hiding this comment.
This looks much better, visually. a few little comments and questions inline, but I think we're very close!
| pub const WINDOW_BACKGROUND_COLOR: Key<Color> = | ||
| Key::new("org.linebender.druid.theme.window_background_color"); | ||
|
|
||
| pub const LABEL_COLOR: Key<Color> = Key::new("org.linebender.druid.theme.label_color"); |
There was a problem hiding this comment.
Because this is heavily used elsewhere (including external projects) I would keep it around with a deprecation notice, like:
#[deprecated(since = "0.8.0", note = "renamed to TEXT_COLOR")]
pub const LABEL_COLOR: Key<Color> = TEXT_COLOR;
druid/src/widget/label.rs
Outdated
| layout: TextLayout<T>, | ||
| line_break_mode: LineBreaking, | ||
|
|
||
| control_text: bool, |
There was a problem hiding this comment.
I would be more explicit about this; it's really only for widget implementors, so I would give it a longer, more explicit name. "is_control_component"?
druid/src/widget/label.rs
Outdated
| self.layout.set_text(data.to_owned()); | ||
| } | ||
| LifeCycle::DisabledChanged(disabled) if self.control_text => { | ||
| dbg!("Control!"); |
There was a problem hiding this comment.
| dbg!("Control!"); |
druid/src/widget/label.rs
Outdated
| /// Builder-style method for making this label into a control-label. | ||
| /// | ||
| /// If this label is a control-label it will change its color when disabled. | ||
| pub fn control_text(mut self) -> Self { |
There was a problem hiding this comment.
ditto, I'd go with something more explicit maybe? like control_component or even dims_when_disabled?
Did you consider having labels always draw themselves dimmed when they're disabled? I could imagine there maybe being some downsides to this but they aren't totally clear to me..
There was a problem hiding this comment.
Did you consider having labels always draw themselves dimmed when they're disabled? I could imagine there maybe being some downsides to this but they aren't totally clear to me..
I don't have a strong opinion how to do this, if you want i change it. But if we do this we still should have the option to disable the color change. We probably don't need this.
Signed-off-by: xarvic <xarvix@web.de>
Signed-off-by: xarvic <xarvix@web.de>
|
Sorry to let this sit, will try to give it one more thorough look-through tomorrow. :) |
cmyr
left a comment
There was a problem hiding this comment.
Sorry for the delay, I think this looks great. If there are any remaining issues we can sort them out afterwards.
Thanks again for taking this on!
|
No problem, thanks for the review :) |



No description provided.