diff options
Diffstat (limited to '')
| -rw-r--r-- | src/icons.rs | 127 | 
1 files changed, 127 insertions, 0 deletions
| diff --git a/src/icons.rs b/src/icons.rs new file mode 100644 index 0000000..934a0c8 --- /dev/null +++ b/src/icons.rs @@ -0,0 +1,127 @@ +use iced::widget::svg; +use iced::widget::{svg::Handle, Svg}; +use iced::Element; + +pub enum Icon { +    AddContact24, +    Attachment24, +    Away16, +    Away16Color, +    Bubble16, +    Bubble16Color, +    Bubble24, +    Contact24, +    Delivered16, +    Dnd16, +    Dnd16Color, +    Error16Color, +    Forward24, +    Heart24, +    NewBubble24, +    Reply24, +    Sending16, +    Sent16, +} + +impl From<Icon> for Svg<'_> { +    fn from(value: Icon) -> Self { +        match value { +            Icon::AddContact24 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/addcontact24.svg" +            ))) +            .width(24) +            .height(24), +            Icon::Attachment24 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/attachment24.svg" +            ))) +            .width(24) +            .height(24), +            Icon::Away16 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/away16.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Away16Color => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/away16color.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Bubble16 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/bubble16.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Bubble16Color => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/bubble16color.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Bubble24 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/bubble24.svg" +            ))) +            .width(24) +            .height(24), +            Icon::Contact24 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/contact24.svg" +            ))) +            .width(24) +            .height(24), +            Icon::Delivered16 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/delivered16.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Dnd16 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/dnd16.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Dnd16Color => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/dnd16color.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Error16Color => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/error16color.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Forward24 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/forward24.svg" +            ))) +            .width(24) +            .height(24), +            Icon::Heart24 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/heart24.svg" +            ))) +            .width(24) +            .height(24), +            Icon::NewBubble24 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/newbubble24.svg" +            ))) +            .width(24) +            .height(24), +            Icon::Reply24 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/reply24.svg" +            ))) +            .width(24) +            .height(24), +            Icon::Sending16 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/sending16.svg" +            ))) +            .width(16) +            .height(16), +            Icon::Sent16 => svg(Handle::from_memory(include_bytes!( +                "../assets/icons/sent16.svg" +            ))) +            .width(16) +            .height(16), +        } +    } +} + +impl<Message> From<Icon> for Element<'_, Message> { +    fn from(value: Icon) -> Self { +        Into::<Svg>::into(value).into() +    } +} | 
