use crate::{
platform::{IconApi, Wrapper},
platform_impl::IconImpl,
ContextOwner,
Error,
};
#[derive(Debug)]
pub enum IconType {
Gif,
Jpeg,
Png,
Tiff,
}
#[derive(Debug)]
pub struct Icon(IconImpl);
impl Icon {
pub fn from_data(
ctx: &impl ContextOwner,
icon_data: &Vec<u8>,
icon_type: IconType,
) -> Result<Self, Error> {
Ok(Self(IconImpl::from_data(ctx, icon_data, icon_type)?))
}
pub fn from_str<S>(ctx: &impl ContextOwner, title: S) -> Result<Self, Error>
where
S: Into<String>,
{
Ok(Self(IconImpl::from_str(ctx, &title.into())?))
}
}
impl Wrapper<IconImpl> for Icon {
#[inline]
fn get_impl(&self) -> &IconImpl { &self.0 }
#[inline]
fn get_impl_mut(&mut self) -> &mut IconImpl { &mut self.0 }
}