summaryrefslogtreecommitdiffstats
path: root/native/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-12 04:37:39 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-12 04:37:39 +0200
commit7e7e66586d990788ffd77b17e98357e74252f497 (patch)
treef9be0c6e0d8f9e2af6170f4370677918c4b43a2a /native/src
parent1de794aabfaa651f021ff2e5831397d7ce9fc53c (diff)
downloadiced-7e7e66586d990788ffd77b17e98357e74252f497.tar.gz
iced-7e7e66586d990788ffd77b17e98357e74252f497.tar.bz2
iced-7e7e66586d990788ffd77b17e98357e74252f497.zip
Show `NotAllowed` as mouse icon when hovering a disabled `TextInput`
Diffstat (limited to 'native/src')
-rw-r--r--native/src/widget/text_input.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index d704692d..8627aa98 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -340,7 +340,7 @@ where
_viewport: &Rectangle,
_renderer: &Renderer,
) -> mouse::Interaction {
- mouse_interaction(layout, cursor_position)
+ mouse_interaction(layout, cursor_position, self.on_input.is_none())
}
}
@@ -1117,9 +1117,14 @@ pub fn draw<Renderer>(
pub fn mouse_interaction(
layout: Layout<'_>,
cursor_position: Point,
+ is_disabled: bool,
) -> mouse::Interaction {
if layout.bounds().contains(cursor_position) {
- mouse::Interaction::Text
+ if is_disabled {
+ mouse::Interaction::NotAllowed
+ } else {
+ mouse::Interaction::Text
+ }
} else {
mouse::Interaction::default()
}