Skip to content

Commit

Permalink
updated to the next teir of changes to Operations and Program to Appl…
Browse files Browse the repository at this point in the history
…ication
  • Loading branch information
genusistimelord committed Jun 20, 2024
1 parent 35fa694 commit b94fe1d
Show file tree
Hide file tree
Showing 23 changed files with 370 additions and 291 deletions.
585 changes: 348 additions & 237 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/WidgetIDReturn/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum Message {
}

fn main() -> iced::Result {
iced::program(
iced::application(
"NumberInput example",
NumberInputDemo::update,
NumberInputDemo::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/badge/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use iced_aw::{helpers::badge, style, style::status::Status};
const BADGE_TEXT_SIZE: u16 = 15;

fn main() -> iced::Result {
iced::program("Badge example", BadgeExample::update, BadgeExample::view).run()
iced::application("Badge example", BadgeExample::update, BadgeExample::view).run()
}

#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion examples/card/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use iced::{
use iced_aw::{helpers::card, style};

fn main() -> iced::Result {
iced::program("Card example", CardExample::update, CardExample::view)
iced::application("Card example", CardExample::update, CardExample::view)
.font(iced_aw::BOOTSTRAP_FONT_BYTES)
.run()
}
Expand Down
2 changes: 1 addition & 1 deletion examples/color_picker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use iced::{
use iced_aw::helpers::color_picker;

fn main() -> iced::Result {
iced::program(
iced::application(
"Color Picker example",
ColorPickerExample::update,
ColorPickerExample::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/date_picker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use iced::{
use iced_aw::{date_picker::Date, helpers::date_picker};

fn main() -> iced::Result {
iced::program(
iced::application(
"DatePicker example",
DatePickerExample::update,
DatePickerExample::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/drop_down/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use iced::{
use iced_aw::{drop_down, DropDown};

fn main() -> iced::Result {
iced::program(
iced::application(
"ContextMenu example",
DropDownExample::update,
DropDownExample::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/grid/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn string_to_vertical_align(input: &str) -> Vertical {
}

fn main() -> iced::Result {
iced::program("Grid example", App::update, App::view)
iced::application("Grid example", App::update, App::view)
.font(iced_aw::BOOTSTRAP_FONT_BYTES)
.run()
}
2 changes: 1 addition & 1 deletion examples/number_input/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub enum Message {
}

fn main() -> iced::Result {
iced::program(
iced::application(
"Number Input example",
NumberInputDemo::update,
NumberInputDemo::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/selection_list/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use iced::{
use iced_aw::{selection_list::SelectionList, style::selection_list::primary};

pub fn main() -> iced::Result {
iced::program("Selection list example", Example::update, Example::view)
iced::application("Selection list example", Example::update, Example::view)
.font(iced_aw::BOOTSTRAP_FONT_BYTES)
.run()
}
Expand Down
2 changes: 1 addition & 1 deletion examples/sliderbar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use iced::{
use iced_aw::SlideBar;

fn main() -> iced::Result {
iced::program(
iced::application(
"Slider Bar example",
SlideBarExample::update,
SlideBarExample::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/spinner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl SpinnerExample {
}

fn main() -> iced::Result {
iced::program(
iced::application(
"Spinner example",
SpinnerExample::update,
SpinnerExample::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/tab_bar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use iced::{
use iced_aw::{TabBar, TabLabel};

fn main() -> iced::Result {
iced::program(
iced::application(
"Tab Bar example",
TabBarExample::update,
TabBarExample::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/time_picker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use iced::{
use iced_aw::{time_picker::Time, TimePicker};

fn main() -> iced::Result {
iced::program(
iced::application(
"TimePicker example",
TimePickerExample::update,
TimePickerExample::view,
Expand Down
2 changes: 1 addition & 1 deletion examples/wrap/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use iced_aw::{NumberInput, Wrap};
use rand::Rng;

fn main() -> iced::Result {
iced::program("Wrap example", RandStrings::update, RandStrings::view)
iced::application("Wrap example", RandStrings::update, RandStrings::view)
.font(iced_aw::BOOTSTRAP_FONT_BYTES)
.run()
}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ where
state: &'b mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
operation: &mut dyn Operation<()>,
) {
let mut children = layout.children();
let head_layout = children.next().expect("Missing Head Layout");
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/drop_down.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ where
state: &'b mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
operation: &mut dyn Operation<()>,
) {
self.underlay
.as_widget()
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/grid/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ where
state: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
operation: &mut dyn Operation<()>,
) {
for ((element, state), layout) in self
.elements_iter()
Expand Down
32 changes: 0 additions & 32 deletions src/widgets/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,21 +245,6 @@ where
crate::TimePicker::new(show_picker, time, underlay, on_cancel, on_submit)
}

#[cfg(feature = "floating_element")]
/// Shortcut helper to create a [`FloatingElement`] Widget.
///
/// [`FloatingElement`]: crate::FloatingElement
pub fn floating_element<'a, Message, Theme, Renderer>(
underlay: impl Into<Element<'a, Message, Theme, Renderer>>,
element: impl Into<Element<'a, Message, Theme, Renderer>>,
) -> crate::FloatingElement<'a, Message, Theme, Renderer>
where
Message: 'a + Clone,
Renderer: renderer::Renderer,
{
crate::FloatingElement::new(underlay, element)
}

#[cfg(feature = "grid")]
/// Shortcut helper to create a [`Grid`] Widget.
///
Expand Down Expand Up @@ -317,23 +302,6 @@ where
crate::Wrap::with_elements_vertical(children)
}

#[cfg(feature = "modal")]
/// Shortcut helper to create a [`Modal`] Widget.
///
/// [`Modal`]: crate::Modal
#[must_use]
pub fn modal<'a, Message, Theme, Renderer>(
underlay: impl Into<Element<'a, Message, Theme, Renderer>>,
overlay: Option<impl Into<Element<'a, Message, Theme, Renderer>>>,
) -> crate::Modal<'a, Message, Theme, Renderer>
where
Message: Clone,
Renderer: renderer::Renderer,
Theme: crate::style::modal::StyleSheet,
{
crate::Modal::new(underlay, overlay)
}

#[cfg(feature = "number_input")]
/// Shortcut helper to create a [`NumberInput`] Widget.
///
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/number_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ where
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
operation: &mut dyn Operation<()>,
) {
operation.container(None, layout.bounds(), &mut |operation| {
self.content.operate(
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/slide_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ where
/// * an inclusive range of possible values
/// * the current value of the [`SliderBar`]
/// * a function that will be called when the [`SliderBar`] is dragged.
/// It receives the new value of the [`SliderBar`] and must produce a
/// `Message`.
/// * the new value of the [`SliderBar`] and must produce a `Message`.
///
pub fn new<F>(range: RangeInclusive<T>, value: T, on_change: F) -> Self
where
F: 'a + Fn(T) -> Message,
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ where

let bounds = layout.bounds();

if let Event::Window(_id, window::Event::RedrawRequested(now)) = event {
if let Event::Window(window::Event::RedrawRequested(now)) = event {
if is_visible(&bounds) {
let state = state.state.downcast_mut::<SpinnerState>();
let duration = (now - state.last_update).as_secs_f32();
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ where
state: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
operation: &mut dyn Operation<()>,
) {
for ((element, state), layout) in self
.elements
Expand Down

0 comments on commit b94fe1d

Please sign in to comment.