Skip to content

Commit

Permalink
Merge branch 'main' of github.com:iced-rs/iced_aw
Browse files Browse the repository at this point in the history
  • Loading branch information
genusistimelord committed Jul 31, 2023
2 parents 74a66d3 + 2c1f563 commit e01ebc5
Show file tree
Hide file tree
Showing 22 changed files with 113 additions and 93 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Selection List now will clear Selected if a new Item is added to the same ID location as the last and its Hash is different.
- Manual Override Will always be used over the internal selected if set to Some(). if the # doesnt Exist it Defaults Selected to None.
- Manual Override will always be used over the internal selected if set to Some(). If the # doesn't exist it defaults Selected to None.
- Added Helper functions for Widgets.

### Changed
Expand All @@ -21,4 +21,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Switched lazy_static to OnceCell

### Fixed
- Floating Element Position is corrected. Original position issue was due to Center_x containg both X and Width/2.
- Floating Element Position is corrected. Original position issue was due to Center_x containing both X and Width/2.
2 changes: 1 addition & 1 deletion src/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A module fitting `iced_native`.
//! A module fitting `iced_core`.

#[cfg(feature = "date_picker")]
//#[cfg(all(feature = "date_picker", not(target_arch = "wasm32")))]
Expand Down
16 changes: 8 additions & 8 deletions src/core/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl From<Time> for chrono::NaiveTime {
Period::Pm => (h + 12) % 24,
};

Self::from_hms_opt(h, m, s).expect("Time Convertion failed. H, M, or S was to large.")
Self::from_hms_opt(h, m, s).expect("Time Conversion failed. H, M, or S was too large.")
}
}

Expand Down Expand Up @@ -199,7 +199,7 @@ mod tests {
let naive: NaiveTime = time.into();
assert_eq!(
naive,
NaiveTime::from_hms_opt(8, 52, 17).expect("Time Convertion failed")
NaiveTime::from_hms_opt(8, 52, 17).expect("Time Conversion failed")
);

let time = Time::Hms {
Expand All @@ -212,7 +212,7 @@ mod tests {
let naive: NaiveTime = time.into();
assert_eq!(
naive,
NaiveTime::from_hms_opt(23, 48, 39).expect("Time Convertion failed")
NaiveTime::from_hms_opt(23, 48, 39).expect("Time Conversion failed")
);

let time = Time::Hms {
Expand All @@ -225,7 +225,7 @@ mod tests {
let naive: NaiveTime = time.into();
assert_eq!(
naive,
NaiveTime::from_hms_opt(8, 52, 17).expect("Time Convertion failed")
NaiveTime::from_hms_opt(8, 52, 17).expect("Time Conversion failed")
);

let time = Time::Hms {
Expand All @@ -238,7 +238,7 @@ mod tests {
let naive: NaiveTime = time.into();
assert_eq!(
naive,
NaiveTime::from_hms_opt(20, 52, 17).expect("Time Convertion failed")
NaiveTime::from_hms_opt(20, 52, 17).expect("Time Conversion failed")
);

let time = Time::Hms {
Expand All @@ -251,7 +251,7 @@ mod tests {
let naive: NaiveTime = time.into();
assert_eq!(
naive,
NaiveTime::from_hms_opt(0, 52, 17).expect("Time Convertion failed")
NaiveTime::from_hms_opt(0, 52, 17).expect("Time Conversion failed")
);

let time = Time::Hms {
Expand All @@ -264,7 +264,7 @@ mod tests {
let naive: NaiveTime = time.into();
assert_eq!(
naive,
NaiveTime::from_hms_opt(12, 52, 17).expect("Time Convertion failed")
NaiveTime::from_hms_opt(12, 52, 17).expect("Time Conversion failed")
);

let time = Time::Hm {
Expand All @@ -276,7 +276,7 @@ mod tests {
let naive: NaiveTime = time.into();
assert_eq!(
naive,
NaiveTime::from_hms_opt(17, 52, 0).expect("Time Convertion failed")
NaiveTime::from_hms_opt(17, 52, 0).expect("Time Conversion failed")
);
}
}
4 changes: 2 additions & 2 deletions src/native/badge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ where
vertical_alignment: Alignment,
/// The style of the [`Badge`](Badge).
style: <Renderer::Theme as StyleSheet>::Style,
/// The content [`Element`](iced_native::Element) of the [`Badge`](Badge).
/// The content [`Element`] of the [`Badge`](Badge).
content: Element<'a, Message, Renderer>,
}

Expand All @@ -58,7 +58,7 @@ where
/// Creates a new [`Badge`](Badge) with the given content.
///
/// It expects:
/// * the content [`Element`](iced_native::Element) to display in the [`Badge`](Badge).
/// * the content [`Element`] to display in the [`Badge`](Badge).
pub fn new<T>(content: T) -> Self
where
T: Into<Element<'a, Message, Renderer>>,
Expand Down
15 changes: 7 additions & 8 deletions src/native/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ where
max_width: f32,
/// The maximum height of the [`Card`](Card).
max_height: f32,
/// The padding of teh head fo the [`Card`](Card).
/// The padding of the head of the [`Card`](Card).
padding_head: f32,
/// The padding of the body of the [`Card`](Card).
padding_body: f32,
Expand All @@ -67,11 +67,11 @@ where
close_size: Option<f32>,
/// The optional message that is send if the close icon of the [`Card`](Card) is pressed.
on_close: Option<Message>,
/// The head [`Element`](iced_native::Element) of the [`Card`](Card).
/// The head [`Element`] of the [`Card`](Card).
head: Element<'a, Message, Renderer>,
/// The body [`Element`](iced_native::Element) of the [`Card`](Card).
/// The body [`Element`] of the [`Card`](Card).
body: Element<'a, Message, Renderer>,
/// The optional foot [`Element`](iced_native::Element) of the [`Card`](Card).
/// The optional foot [`Element`] of the [`Card`](Card).
foot: Option<Element<'a, Message, Renderer>>,
/// The style of the [`Card`](Card).
style: <Renderer::Theme as StyleSheet>::Style,
Expand All @@ -85,9 +85,9 @@ where
/// Creates a new [`Card`](Card) containing the given head and body.
///
/// It expects:
/// * the head [`Element`](iced_native::Element) to display at the top of
/// * the head [`Element`] to display at the top of
/// the [`Card`](Card).
/// * the body [`Element`](iced_native::Element) to display at the middle
/// * the body [`Element`] to display at the middle
/// of the [`Card`](Card).
pub fn new<H, B>(head: H, body: B) -> Self
where
Expand All @@ -111,8 +111,7 @@ where
}
}

/// Sets the [`Element`](iced_native::Element) of the foot of the
/// [`Card`](Card).
/// Sets the [`Element`] of the foot of the [`Card`](Card).
#[must_use]
pub fn foot<F>(mut self, foot: F) -> Self
where
Expand Down
6 changes: 3 additions & 3 deletions src/native/color_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where
underlay: Element<'a, Message, Renderer<Theme>>,
/// The message that is send if the cancel button of the [`ColorPickerOverlay`](ColorPickerOverlay) is pressed.
on_cancel: Message,
/// The function thet produces a message when the submit button of the [`ColorPickerOverlay`](ColorPickerOverlay) is pressed.
/// The function that produces a message when the submit button of the [`ColorPickerOverlay`](ColorPickerOverlay) is pressed.
on_submit: Box<dyn Fn(Color) -> Message>,
/// The style of the [`ColorPickerOverlay`](ColorPickerOverlay).
style: <Theme as StyleSheet>::Style,
Expand All @@ -80,12 +80,12 @@ where
/// It expects:
/// * if the overlay of the color picker is visible.
/// * the initial color to show.
/// * the underlay [`Element`](iced_pure::Element) on which this [`ColorPicker`](ColorPicker)
/// * the underlay [`Element`] on which this [`ColorPicker`](ColorPicker)
/// will be wrapped around.
/// * a message that will be send when the cancel button of the [`ColorPicker`](ColorPicker)
/// is pressed.
/// * a function that will be called when the submit button of the [`ColorPicker`](ColorPicker)
/// is pressed, which takes the picked [`Color`](iced_native::Color) value.
/// is pressed, which takes the picked [`Color`] value.
pub fn new<U, F>(
show_picker: bool,
color: Color,
Expand Down
2 changes: 1 addition & 1 deletion src/native/date_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ where
/// It expects:
/// * if the overlay of the date picker is visible.
/// * the initial date to show.
/// * the underlay [`Element`](iced_native::Element) on which this [`DatePicker`](DatePicker)
/// * the underlay [`Element`] on which this [`DatePicker`](DatePicker)
/// will be wrapped around.
/// * a message that will be send when the cancel button of the [`DatePicker`](DatePicker)
/// is pressed.
Expand Down
9 changes: 4 additions & 5 deletions src/native/floating_element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ where
Renderer: core::Renderer,
{
/// Creates a new [`FloatingElement`](FloatingElement) over some content,
/// showing the given [`Element`](iced_native::Element).
/// showing the given [`Element`].
///
/// It expects:
/// * the underlay [`Element`](iced_native::Element) on which this [`FloatingElement`](FloatingElement)
/// * the underlay [`Element`] on which this [`FloatingElement`](FloatingElement)
/// will be wrapped around.
/// * a function that will lazy create the [`Element`](iced_native::Element) for the overlay.
/// * a function that will lazily create the [`Element`] for the overlay.
pub fn new<U, B>(underlay: U, element: B) -> Self
where
U: Into<Element<'a, Message, Renderer>>,
Expand Down Expand Up @@ -98,8 +98,7 @@ where
self
}

/// Hide or unhide the [`Element`](iced_native::Element) on the
/// [`FloatingElement`](FloatingElement).
/// Hide or unhide the [`Element`] on the [`FloatingElement`](FloatingElement).
#[must_use]
pub fn hide(mut self, hide: bool) -> Self {
self.hidden = hide;
Expand Down
30 changes: 11 additions & 19 deletions src/native/floating_element/anchor.rs
Original file line number Diff line number Diff line change
@@ -1,47 +1,39 @@
//! Use a floating button to overlay a button over some content
//! Use a floating element to overlay a button over some content
//!
//! *This API requires the following crate features to be activated: `floating_button`*
//! *This API requires the following crate features to be activated: `floating_element`*

/// Positional [`Anchor`](Anchor) for the [`FloatingButton`](super::FloatingButton).
/// Positional [`Anchor`](Anchor) for the [`FloatingElement`](super::FloatingElement).
#[derive(Copy, Clone, Debug, Hash)]
pub enum Anchor {
/// NorthWest [`Anchor`](Anchor) for positioning the
/// [`Button`](iced_native::widget::button::Button) on the top left of the
/// underlying element.
/// [`Button`](iced_widget::Button) on the top left of the underlying element.
NorthWest,

/// NorthEast [`Anchor`](Anchor) for positioning the
/// [`Button`](iced_native::widget::button::Button) on the top right of the
/// underlying element.
/// [`Button`](iced_widget::Button) on the top right of the underlying element.
NorthEast,

/// SouthWest [`Anchor`](Anchor) for positioning the
/// [`Button`](iced_native::widget::button::Button) on the bottom left of the
/// underlying element.
/// [`Button`](iced_widget::Button) on the bottom left of the underlying element.
SouthWest,

/// SouthEast [`Anchor`](Anchor) for positioning the
/// [`Button`](iced_native::widget::button::Button) on the bottom right of the
/// underlying element.
/// [`Button`](iced_widget::Button) on the bottom right of the underlying element.
SouthEast,

/// North [`Anchor`](Anchor) for positioning the
/// [`Button`](iced_native::widget::button::Button) on the top of the
/// underlying element.
/// [`Button`](iced_widget::Button) on the top of the underlying element.
North,

/// East [`Anchor`](Anchor) for positioning the
/// [`Button`](iced_native::widget::button::Button) on the right of the
/// underlying element.
/// [`Button`](iced_widget::Button) on the right of the underlying element.
East,

/// South [`Anchor`](Anchor) for positioning the
/// [`Button`](iced_native::widget::button::Button) on the bottom of the
/// underlying element.
/// [`Button`](iced_widget::Button) on the bottom of the underlying element.
South,

/// West [`Anchor`](Anchor) for positioning the
/// [`Button`](iced_native::widget::button::Button) on the left of the
/// underlying element.
/// [`Button`](iced_widget::Button) on the left of the underlying element.
West,
}
6 changes: 3 additions & 3 deletions src/native/floating_element/offset.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Use a floating button to overlay a button over some content
//! Use a floating element to overlay a button over some content
//!
//! *This API requires the following crate features to be activated: `floating_button`*
//! *This API requires the following crate features to be activated: `floating_element`*

use iced_widget::core::Point;

/// The [`Offset`](Offset) for the [`FloatingButton`](super::FloatingButton).
/// The [`Offset`](Offset) for the [`FloatingElement`](super::FloatingElement).
#[derive(Copy, Clone, Debug)]
pub struct Offset {
/// Offset on the x-axis from the [`Anchor`](super::Anchor)
Expand Down
Loading

0 comments on commit e01ebc5

Please sign in to comment.