summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Clark Moody <clark@clarkmoody.com>2021-05-24 16:37:47 -0500
committerLibravatar Clark Moody <clark@clarkmoody.com>2021-05-24 16:37:47 -0500
commitd4c5f3ee950262c578c7b9b2a4aab60d3c5edaed (patch)
tree8659fb678d989a2f97876b20aa501d5415af4b02 /native
parent1a2fd4e743fe2b5237a4b51fa0ab2ddc660dfd5a (diff)
downloadiced-d4c5f3ee950262c578c7b9b2a4aab60d3c5edaed.tar.gz
iced-d4c5f3ee950262c578c7b9b2a4aab60d3c5edaed.tar.bz2
iced-d4c5f3ee950262c578c7b9b2a4aab60d3c5edaed.zip
Enable event handling within the title elements
Shrink the pick area to avoid both the controls and the title elements. Handle events and merge title area event status with control events.
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/pane_grid/title_bar.rs33
1 files changed, 23 insertions, 10 deletions
diff --git a/native/src/widget/pane_grid/title_bar.rs b/native/src/widget/pane_grid/title_bar.rs
index a1e5107e..8e42ce38 100644
--- a/native/src/widget/pane_grid/title_bar.rs
+++ b/native/src/widget/pane_grid/title_bar.rs
@@ -129,15 +129,16 @@ where
if layout.bounds().contains(cursor_position) {
let mut children = layout.children();
let padded = children.next().unwrap();
+ let mut children = padded.children();
+ let title_layout = children.next().unwrap();
if self.controls.is_some() {
- let mut children = padded.children();
- let _ = children.next().unwrap();
let controls_layout = children.next().unwrap();
!controls_layout.bounds().contains(cursor_position)
+ && !title_layout.bounds().contains(cursor_position)
} else {
- true
+ !title_layout.bounds().contains(cursor_position)
}
} else {
false
@@ -205,16 +206,17 @@ where
clipboard: &mut dyn Clipboard,
messages: &mut Vec<Message>,
) -> event::Status {
- if let Some(controls) = &mut self.controls {
- let mut children = layout.children();
- let padded = children.next().unwrap();
+ let mut children = layout.children();
+ let padded = children.next().unwrap();
- let mut children = padded.children();
- let _ = children.next();
+ let mut children = padded.children();
+ let title_layout = children.next().unwrap();
+
+ let control_status = if let Some(controls) = &mut self.controls {
let controls_layout = children.next().unwrap();
controls.on_event(
- event,
+ event.clone(),
controls_layout,
cursor_position,
renderer,
@@ -223,6 +225,17 @@ where
)
} else {
event::Status::Ignored
- }
+ };
+
+ let title_status = self.content.on_event(
+ event,
+ title_layout,
+ cursor_position,
+ renderer,
+ clipboard,
+ messages,
+ );
+
+ control_status.merge(title_status)
}
}