diff options
| author | 2019-12-18 07:45:49 +0100 | |
|---|---|---|
| committer | 2019-12-18 07:45:49 +0100 | |
| commit | a14b39555e5c480422c24df7d708dd1addd0a67b (patch) | |
| tree | 00404b80c27f715d3739f14d882e88241d68f0c1 /native/src/widget | |
| parent | 0f2e20f5e5b1f0658ab4e6cbe6fdda9ca97f2b36 (diff) | |
| download | iced-a14b39555e5c480422c24df7d708dd1addd0a67b.tar.gz iced-a14b39555e5c480422c24df7d708dd1addd0a67b.tar.bz2 iced-a14b39555e5c480422c24df7d708dd1addd0a67b.zip | |
Allow clipboard access in `Widget::on_event`
Diffstat (limited to '')
| -rw-r--r-- | native/src/widget.rs | 5 | ||||
| -rw-r--r-- | native/src/widget/button.rs | 5 | ||||
| -rw-r--r-- | native/src/widget/checkbox.rs | 3 | ||||
| -rw-r--r-- | native/src/widget/column.rs | 5 | ||||
| -rw-r--r-- | native/src/widget/container.rs | 5 | ||||
| -rw-r--r-- | native/src/widget/radio.rs | 3 | ||||
| -rw-r--r-- | native/src/widget/row.rs | 5 | ||||
| -rw-r--r-- | native/src/widget/scrollable.rs | 6 | ||||
| -rw-r--r-- | native/src/widget/slider.rs | 5 | ||||
| -rw-r--r-- | native/src/widget/text_input.rs | 5 | 
10 files changed, 32 insertions, 15 deletions
| diff --git a/native/src/widget.rs b/native/src/widget.rs index ee7232cb..26889280 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -24,12 +24,12 @@ pub mod button;  pub mod checkbox;  pub mod column;  pub mod container; -pub mod svg;  pub mod image;  pub mod radio;  pub mod row;  pub mod scrollable;  pub mod slider; +pub mod svg;  pub mod text;  pub mod text_input; @@ -58,7 +58,7 @@ pub use text::Text;  #[doc(no_inline)]  pub use text_input::TextInput; -use crate::{layout, Event, Hasher, Layout, Length, Point}; +use crate::{layout, Clipboard, Event, Hasher, Layout, Length, Point};  /// A component that displays information and allows interaction.  /// @@ -142,6 +142,7 @@ where          _cursor_position: Point,          _messages: &mut Vec<Message>,          _renderer: &Renderer, +        _clipboard: Option<&dyn Clipboard>,      ) {      }  } diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index 67b49dc6..2881105f 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -6,8 +6,8 @@  //! [`State`]: struct.State.html  use crate::{      input::{mouse, ButtonState}, -    layout, Background, Element, Event, Hasher, Layout, Length, Point, -    Rectangle, Widget, +    layout, Background, Clipboard, Element, Event, Hasher, Layout, Length, +    Point, Rectangle, Widget,  };  use std::hash::Hash; @@ -192,6 +192,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          _renderer: &Renderer, +        _clipboard: Option<&dyn Clipboard>,      ) {          match event {              Event::Mouse(mouse::Event::Input { diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs index ca4410b9..0dcac712 100644 --- a/native/src/widget/checkbox.rs +++ b/native/src/widget/checkbox.rs @@ -3,7 +3,7 @@ use std::hash::Hash;  use crate::{      input::{mouse, ButtonState}, -    layout, row, text, Align, Color, Element, Event, Font, Hasher, +    layout, row, text, Align, Clipboard, Color, Element, Event, Font, Hasher,      HorizontalAlignment, Layout, Length, Point, Rectangle, Row, Text,      VerticalAlignment, Widget,  }; @@ -114,6 +114,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          _renderer: &Renderer, +        _clipboard: Option<&dyn Clipboard>,      ) {          match event {              Event::Mouse(mouse::Event::Input { diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs index cdcf25af..4b5d631c 100644 --- a/native/src/widget/column.rs +++ b/native/src/widget/column.rs @@ -2,7 +2,8 @@  use std::hash::Hash;  use crate::{ -    layout, Align, Element, Event, Hasher, Layout, Length, Point, Widget, +    layout, Align, Clipboard, Element, Event, Hasher, Layout, Length, Point, +    Widget,  };  use std::u32; @@ -153,6 +154,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          renderer: &Renderer, +        clipboard: Option<&dyn Clipboard>,      ) {          self.children.iter_mut().zip(layout.children()).for_each(              |(child, layout)| { @@ -162,6 +164,7 @@ where                      cursor_position,                      messages,                      renderer, +                    clipboard,                  )              },          ); diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs index 7852eecf..74f0e0ef 100644 --- a/native/src/widget/container.rs +++ b/native/src/widget/container.rs @@ -2,7 +2,8 @@  use std::hash::Hash;  use crate::{ -    layout, Align, Element, Event, Hasher, Layout, Length, Point, Widget, +    layout, Align, Clipboard, Element, Event, Hasher, Layout, Length, Point, +    Widget,  };  use std::u32; @@ -131,6 +132,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          renderer: &Renderer, +        clipboard: Option<&dyn Clipboard>,      ) {          self.content.widget.on_event(              event, @@ -138,6 +140,7 @@ where              cursor_position,              messages,              renderer, +            clipboard,          )      } diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs index a9d145db..a9995b86 100644 --- a/native/src/widget/radio.rs +++ b/native/src/widget/radio.rs @@ -1,7 +1,7 @@  //! Create choices using radio buttons.  use crate::{      input::{mouse, ButtonState}, -    layout, row, text, Align, Color, Element, Event, Font, Hasher, +    layout, row, text, Align, Clipboard, Color, Element, Event, Font, Hasher,      HorizontalAlignment, Layout, Length, Point, Rectangle, Row, Text,      VerticalAlignment, Widget,  }; @@ -113,6 +113,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          _renderer: &Renderer, +        _clipboard: Option<&dyn Clipboard>,      ) {          match event {              Event::Mouse(mouse::Event::Input { diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs index c854aff7..3de65deb 100644 --- a/native/src/widget/row.rs +++ b/native/src/widget/row.rs @@ -2,7 +2,8 @@  use std::hash::Hash;  use crate::{ -    layout, Align, Element, Event, Hasher, Layout, Length, Point, Widget, +    layout, Align, Clipboard, Element, Event, Hasher, Layout, Length, Point, +    Widget,  };  use std::u32; @@ -154,6 +155,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          renderer: &Renderer, +        clipboard: Option<&dyn Clipboard>,      ) {          self.children.iter_mut().zip(layout.children()).for_each(              |(child, layout)| { @@ -163,6 +165,7 @@ where                      cursor_position,                      messages,                      renderer, +                    clipboard,                  )              },          ); diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index 3c2625b7..872c59cb 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -2,8 +2,8 @@  use crate::{      column,      input::{mouse, ButtonState}, -    layout, Align, Column, Element, Event, Hasher, Layout, Length, Point, -    Rectangle, Size, Widget, +    layout, Align, Clipboard, Column, Element, Event, Hasher, Layout, Length, +    Point, Rectangle, Size, Widget,  };  use std::{f32, hash::Hash, u32}; @@ -143,6 +143,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          renderer: &Renderer, +        clipboard: Option<&dyn Clipboard>,      ) {          let bounds = layout.bounds();          let is_mouse_over = bounds.contains(cursor_position); @@ -247,6 +248,7 @@ where              cursor_position,              messages,              renderer, +            clipboard,          )      } diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs index f07ea7cd..f446f7e8 100644 --- a/native/src/widget/slider.rs +++ b/native/src/widget/slider.rs @@ -6,8 +6,8 @@  //! [`State`]: struct.State.html  use crate::{      input::{mouse, ButtonState}, -    layout, Element, Event, Hasher, Layout, Length, Point, Rectangle, Size, -    Widget, +    layout, Clipboard, Element, Event, Hasher, Layout, Length, Point, +    Rectangle, Size, Widget,  };  use std::{hash::Hash, ops::RangeInclusive}; @@ -133,6 +133,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          _renderer: &Renderer, +        _clipboard: Option<&dyn Clipboard>,      ) {          let mut change = || {              let bounds = layout.bounds(); diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index f0bb9f87..3890e9c6 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -6,8 +6,8 @@  //! [`State`]: struct.State.html  use crate::{      input::{keyboard, mouse, ButtonState}, -    layout, Element, Event, Hasher, Layout, Length, Point, Rectangle, Size, -    Widget, +    layout, Clipboard, Element, Event, Hasher, Layout, Length, Point, +    Rectangle, Size, Widget,  };  use unicode_segmentation::UnicodeSegmentation; @@ -172,6 +172,7 @@ where          cursor_position: Point,          messages: &mut Vec<Message>,          renderer: &Renderer, +        _clipboard: Option<&dyn Clipboard>,      ) {          match event {              Event::Mouse(mouse::Event::Input { | 
