summaryrefslogtreecommitdiffstats
path: root/examples/component/src/main.rs
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-07-12 12:23:18 -0700
committerLibravatar Bingus <shankern@protonmail.com>2023-07-12 12:23:18 -0700
commit633f405f3f78bc7f82d2b2061491b0e011137451 (patch)
tree5ebfc1f45d216a5c14a90492563599e6969eab4d /examples/component/src/main.rs
parent41836dd80d0534608e7aedfbf2319c540a23de1a (diff)
parent21bd51426d900e271206f314e0c915dd41065521 (diff)
downloadiced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.gz
iced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.bz2
iced-633f405f3f78bc7f82d2b2061491b0e011137451.zip
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
# Conflicts: # Cargo.toml # core/src/window/icon.rs # core/src/window/id.rs # core/src/window/position.rs # core/src/window/settings.rs # examples/integration/src/main.rs # examples/integration_opengl/src/main.rs # glutin/src/application.rs # native/src/subscription.rs # native/src/window.rs # runtime/src/window/action.rs # src/lib.rs # src/window.rs # winit/Cargo.toml # winit/src/application.rs # winit/src/icon.rs # winit/src/settings.rs # winit/src/window.rs
Diffstat (limited to 'examples/component/src/main.rs')
-rw-r--r--examples/component/src/main.rs24
1 files changed, 6 insertions, 18 deletions
diff --git a/examples/component/src/main.rs b/examples/component/src/main.rs
index bbf549e7..010321a9 100644
--- a/examples/component/src/main.rs
+++ b/examples/component/src/main.rs
@@ -47,9 +47,8 @@ impl Sandbox for Component {
mod numeric_input {
use iced::alignment::{self, Alignment};
- use iced::widget::{self, button, row, text, text_input};
- use iced::{Element, Length};
- use iced_lazy::{self, Component};
+ use iced::widget::{button, component, row, text, text_input, Component};
+ use iced::{Element, Length, Renderer};
pub struct NumericInput<Message> {
value: Option<u32>,
@@ -82,13 +81,7 @@ mod numeric_input {
}
}
- impl<Message, Renderer> Component<Message, Renderer> for NumericInput<Message>
- where
- Renderer: iced_native::text::Renderer + 'static,
- Renderer::Theme: widget::button::StyleSheet
- + widget::text_input::StyleSheet
- + widget::text::StyleSheet,
- {
+ impl<Message> Component<Message, Renderer> for NumericInput<Message> {
type State = ();
type Event = Event;
@@ -141,8 +134,8 @@ mod numeric_input {
.map(u32::to_string)
.as_deref()
.unwrap_or(""),
- Event::InputChanged,
)
+ .on_input(Event::InputChanged)
.padding(10),
button("+", Event::IncrementPressed),
]
@@ -152,17 +145,12 @@ mod numeric_input {
}
}
- impl<'a, Message, Renderer> From<NumericInput<Message>>
- for Element<'a, Message, Renderer>
+ impl<'a, Message> From<NumericInput<Message>> for Element<'a, Message, Renderer>
where
Message: 'a,
- Renderer: 'static + iced_native::text::Renderer,
- Renderer::Theme: widget::button::StyleSheet
- + widget::text_input::StyleSheet
- + widget::text::StyleSheet,
{
fn from(numeric_input: NumericInput<Message>) -> Self {
- iced_lazy::component(numeric_input)
+ component(numeric_input)
}
}
}