summaryrefslogtreecommitdiffstats
path: root/native/src/widget/button.rs
diff options
context:
space:
mode:
authorLibravatar Nick Senger <dev@nsenger.com>2023-02-10 14:46:03 -0800
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-16 16:15:45 +0100
commitd05ac38159dc2828b6e5b0d416802d8ef4be80d2 (patch)
treeb13d070cb136346a837bfdc81ff5984837804ddc /native/src/widget/button.rs
parent84a6038961a5ebd1366ae8c6ba9e44be07d37f16 (diff)
downloadiced-d05ac38159dc2828b6e5b0d416802d8ef4be80d2.tar.gz
iced-d05ac38159dc2828b6e5b0d416802d8ef4be80d2.tar.bz2
iced-d05ac38159dc2828b6e5b0d416802d8ef4be80d2.zip
Revert "provide ID to operation.container in applicable widgets"
This reverts commit 8f9550bcf7c1cebbf90e80683761375406ca6139.
Diffstat (limited to '')
-rw-r--r--native/src/widget/button.rs53
1 files changed, 9 insertions, 44 deletions
diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs
index d1537b10..b4276317 100644
--- a/native/src/widget/button.rs
+++ b/native/src/widget/button.rs
@@ -8,7 +8,7 @@ use crate::overlay;
use crate::renderer;
use crate::touch;
use crate::widget::tree::{self, Tree};
-use crate::widget::{self, Operation};
+use crate::widget::Operation;
use crate::{
Background, Clipboard, Color, Element, Layout, Length, Padding, Point,
Rectangle, Shell, Vector, Widget,
@@ -56,7 +56,6 @@ where
Renderer: crate::Renderer,
Renderer::Theme: StyleSheet,
{
- id: Option<Id>,
content: Element<'a, Message, Renderer>,
on_press: Option<Message>,
width: Length,
@@ -73,7 +72,6 @@ where
/// Creates a new [`Button`] with the given content.
pub fn new(content: impl Into<Element<'a, Message, Renderer>>) -> Self {
Button {
- id: None,
content: content.into(),
on_press: None,
width: Length::Shrink,
@@ -83,12 +81,6 @@ where
}
}
- /// Sets the [`Id`] of the [`Button`].
- pub fn id(mut self, id: Id) -> Self {
- self.id = Some(id);
- self
- }
-
/// Sets the width of the [`Button`].
pub fn width(mut self, width: Length) -> Self {
self.width = width;
@@ -180,17 +172,14 @@ where
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
) {
- operation.container(
- self.id.as_ref().map(|id| &id.0),
- &mut |operation| {
- self.content.as_widget().operate(
- &mut tree.children[0],
- layout.children().next().unwrap(),
- renderer,
- operation,
- );
- },
- );
+ operation.container(None, &mut |operation| {
+ self.content.as_widget().operate(
+ &mut tree.children[0],
+ layout.children().next().unwrap(),
+ renderer,
+ operation,
+ );
+ });
}
fn on_event(
@@ -464,27 +453,3 @@ pub fn mouse_interaction(
mouse::Interaction::default()
}
}
-
-/// The identifier of a [`Button`].
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
-pub struct Id(widget::Id);
-
-impl Id {
- /// Creates a custom [`Id`].
- pub fn new(id: impl Into<std::borrow::Cow<'static, str>>) -> Self {
- Self(widget::Id::new(id))
- }
-
- /// Creates a unique [`Id`].
- ///
- /// This function produces a different [`Id`] every time it is called.
- pub fn unique() -> Self {
- Self(widget::Id::unique())
- }
-}
-
-impl From<Id> for widget::Id {
- fn from(id: Id) -> Self {
- id.0
- }
-}