-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 <[email protected]>
Update documentation Co-authored-by: Colin Rofls <[email protected]>
Co-authored-by: Colin Rofls <[email protected]>
Signed-off-by: xarvic <[email protected]>
Signed-off-by: xarvic <[email protected]>
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 <[email protected]>
Signed-off-by: xarvic <[email protected]>
@xarvic if you like you could just squash locally? Otherwise we can squash afterwards, I'm not too concerned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Signed-off-by: xarvic <[email protected]>
Signed-off-by: xarvic <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks much better, visually. a few little comments and questions inline, but I think we're very close!
@@ -23,7 +23,9 @@ use crate::{Env, FontDescriptor, FontFamily, FontStyle, FontWeight, Insets, Key} | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -96,6 +96,9 @@ pub struct Label<T> { | |||
pub struct RawLabel<T> { | |||
layout: TextLayout<T>, | |||
line_break_mode: LineBreaking, | |||
|
|||
control_text: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Signed-off-by: xarvic <[email protected]>
Sorry to let this sit, will try to give it one more thorough look-through tomorrow. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.