Skip to content

Commit

Permalink
remove mod.rs files and convert to the newer style.
Browse files Browse the repository at this point in the history
Migrate widgets to a Widget branch instead of native.
Move fonts to core and clean them up a bit.
Fix Examples to show new changes.
  • Loading branch information
genusistimelord committed Mar 5, 2024
1 parent 740c683 commit 89ed86d
Show file tree
Hide file tree
Showing 81 changed files with 115 additions and 108 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ badge = []
card = []
date_picker = ["chrono", "once_cell", "icons"]
color_picker = ["icons", "iced/canvas"]
cupertino = ["time", "iced/canvas"]
cupertino = ["time", "iced/canvas", "icons"]
floating_element = []
grid = ["itertools"]
glow = [] # TODO
Expand Down
2 changes: 1 addition & 1 deletion examples/WidgetIDReturn/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Application for NumberInputDemo {
(
NumberInputDemo::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
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 @@ -44,7 +44,7 @@ impl Application for CardExample {
(
CardExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
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 @@ -47,7 +47,7 @@ impl Application for ColorPickerExample {
(
ColorPickerExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
Expand Down
4 changes: 2 additions & 2 deletions examples/cupertino/cupertino_button/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use iced::{
Application, Command, Element, Length, Settings, Theme,
};

use iced_aw::native::cupertino::cupertino_button::CupertinoButton;
use iced_aw::widgets::cupertino::cupertino_button::CupertinoButton;

pub fn main() -> iced::Result {
ButtonApp::run(Settings {
Expand Down Expand Up @@ -42,7 +42,7 @@ impl Application for ButtonApp {

fn new(_flags: ()) -> (Self, Command<Message>) {
(ButtonApp::Loading, Command::batch(vec![
font::load(iced_aw::graphics::SF_UI_ROUNDED_BYTES).map(Message::FontLoaded),
font::load(iced_aw::SF_UI_ROUNDED_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]))
}
Expand Down
2 changes: 1 addition & 1 deletion examples/cupertino/cupertino_spinner/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use iced::alignment;
use iced::widget::{column, container, text};
use iced::{executor, Application, Command, Element, Length, Settings, Theme};
use iced_aw::native::cupertino::cupertino_spinner::CupertinoSpinner;
use iced_aw::widgets::cupertino::cupertino_spinner::CupertinoSpinner;

pub fn main() -> iced::Result {
Spinner::run(Settings {
Expand Down
2 changes: 1 addition & 1 deletion examples/cupertino/cupertino_switch/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use iced::widget::{column, container, row, text};
use iced::{alignment, executor, Application, Color, Command, Element, Length, Settings, Theme};
use iced_aw::native::cupertino::cupertino_switch::CupertinoSwitch;
use iced_aw::widgets::cupertino::cupertino_switch::CupertinoSwitch;

pub fn main() -> iced::Result {
Switch::run(Settings {
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 @@ -44,7 +44,7 @@ impl Application for DatePickerExample {
(
DatePickerExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
Expand Down
4 changes: 2 additions & 2 deletions examples/floating_element multioverlay/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use iced::{
Application, Command, Element, Length, Settings, Theme,
};

use iced_aw::core::icons::bootstrap::icon_to_string;
use iced_aw::floating_element::Anchor;
use iced_aw::graphics::icons::bootstrap::icon_to_string;
use iced_aw::Bootstrap;
use iced_aw::{helpers::floating_element, BOOTSTRAP_FONT};

Expand Down Expand Up @@ -49,7 +49,7 @@ impl Application for FloatingElementExample {
(
FloatingElementExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
Expand Down
4 changes: 2 additions & 2 deletions examples/floating_element/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use iced::{
Application, Command, Element, Length, Settings, Theme,
};

use iced_aw::core::icons::bootstrap::icon_to_string;
use iced_aw::floating_element::Anchor;
use iced_aw::graphics::icons::bootstrap::icon_to_string;
use iced_aw::Bootstrap;
use iced_aw::{helpers::floating_element, BOOTSTRAP_FONT};

Expand Down Expand Up @@ -48,7 +48,7 @@ impl Application for FloatingElementExample {
(
FloatingElementExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
Expand Down
4 changes: 2 additions & 2 deletions examples/menu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use iced::widget::{
use iced::widget::{column as col, vertical_space};
use iced::{alignment, theme, Application, Border, Color, Element, Length, Pixels, Size};

use iced_aw::graphics::icons::{Bootstrap, BOOTSTRAP_FONT, BOOTSTRAP_FONT_BYTES};
use iced_aw::menu::{self, Item, Menu, StyleSheet};
use iced_aw::style::MenuBarStyle;
use iced_aw::{menu_bar, menu_items};
use iced_aw::{native::InnerBounds, quad};
use iced_aw::{quad, widgets::InnerBounds};
use iced_aw::{Bootstrap, BOOTSTRAP_FONT, BOOTSTRAP_FONT_BYTES};

pub fn main() -> iced::Result {
// std::env::set_var("RUST_BACKTRACE", "full");
Expand Down
2 changes: 1 addition & 1 deletion examples/modal/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Application for ModalExample {
(
ModalExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/modal_component/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Application for ModalExample {
(
ModalExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple_modals/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Application for MultipleModalsExample {
state: State::Start,
button_pressed: None,
},
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/number_input/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Application for NumberInputDemo {
(
NumberInputDemo::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/segmented_button/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use iced::widget::container;
use iced::widget::{column, row, text};
use iced::{Element, Length, Sandbox, Settings};

use iced_aw::native::segmented_button;
use iced_aw::widgets::segmented_button;
use segmented_button::SegmentedButton;

pub fn main() -> iced::Result {
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 @@ -52,7 +52,7 @@ impl Application for TabBarExample {
(
TabBarExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
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 @@ -46,7 +46,7 @@ impl Application for TimePickerExample {
(
TimePickerExample::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
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 @@ -90,7 +90,7 @@ impl Application for RandStrings {
(
Self::Loading,
Command::batch(vec![
font::load(iced_aw::graphics::icons::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
font::load(iced_aw::BOOTSTRAP_FONT_BYTES).map(Message::FontLoaded),
Command::perform(load(), Message::Loaded),
]),
)
Expand Down
34 changes: 34 additions & 0 deletions src/core.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//! `iced_aw_core`.
use cfg_if::cfg_if;

#[cfg(feature = "date_picker")]
pub mod date;

#[cfg(feature = "time_picker")]
pub mod clock;

#[cfg(feature = "color_picker")]
pub mod color;

pub mod overlay;

pub mod renderer;

#[cfg(feature = "time_picker")]
pub mod time;

#[cfg(feature = "drop_down")]
pub mod offset;

#[cfg(feature = "drop_down")]
pub mod alignment;

pub mod icons;

cfg_if! {
if #[cfg(feature = "icons")] {
pub use icons::{BOOTSTRAP_FONT, BOOTSTRAP_FONT_BYTES, NERD_FONT, NERD_FONT_BYTES, SF_UI_ROUNDED_BYTES, SF_UI_ROUNDED, Bootstrap, Nerd};
} else {
pub use icons::{BOOTSTRAP_FONT, BOOTSTRAP_FONT_BYTES, Bootstrap};
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/graphics/icons.rs → src/core/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ cfg_if! {
}

}

/// The default cupertino font bytes for loading the font into the system.
#[cfg(feature = "cupertino")]
pub const SF_UI_ROUNDED_BYTES: &[u8] = include_bytes!("./fonts/SFUIRounded.ttf");

/// The default cupertino font for alerts and button.
#[cfg(feature = "cupertino")]
pub const SF_UI_ROUNDED: iced::Font = iced::Font::with_name(".SF UI Rounded");
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 0 additions & 24 deletions src/core/mod.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/graphics/mod.rs

This file was deleted.

Loading

0 comments on commit 89ed86d

Please sign in to comment.