[][src]Struct native_windows_gui::EmbedResource

pub struct EmbedResource {
    pub hinst: HINSTANCE,
}

EmbedResource represent an embed resource file (".rc") inside on the executable module.

By default (without any arguments), the embed resources wraps the executable. If the embed resources are in a dll, it's also possible to load them by setting the "module" parameter to the dll name.

Builder parameters: * module: The name of the module that owns the embed resources. If None, use the executable name.

use native_windows_gui as nwg;
fn build_embed1() -> nwg::EmbedResource {
    nwg::EmbedResource::load(None).unwrap()
}

fn build_embed2() -> nwg::EmbedResource {
    nwg::EmbedResource::load(Some("external.dll")).unwrap()
}

Fields

hinst: HINSTANCE

Implementations

impl EmbedResource[src]

pub fn load(name: Option<&str>) -> Result<EmbedResource, NwgError>[src]

Returns an embed resource that wraps the current executable. Shortcut for the builder API.

pub fn builder() -> EmbedResourceBuilder[src]

Creates a EmbedResourceBuilder. EmbedResource::load can also be used to skip the builder api

pub fn string(&self, id: u32) -> Option<String>[src]

Load a string the the RC file STRINGTABLE. Returns None if id does not map to a string.

pub fn icon(&self, id: usize, size: Option<(u32, u32)>) -> Option<Icon>[src]

Load an icon from the rc file. Returns None if id does not map to a icon. For more feature, use the Icon::builder with the embed parameter.

pub fn icon_str(&self, id: &str, size: Option<(u32, u32)>) -> Option<Icon>[src]

Load an icon identified by a string in a resource file. Returns None if id does not map to a icon.

pub fn bitmap(&self, id: usize, size: Option<(u32, u32)>) -> Option<Bitmap>[src]

Load a bitmap file from the rc file. Returns None if id does not map to a bitmap.

pub fn bitmap_str(&self, id: &str, size: Option<(u32, u32)>) -> Option<Bitmap>[src]

Load a bitmap file from the rc file. Returns None if id does not map to a bitmap.

pub fn image(&self, id: usize, size: Option<(u32, u32)>) -> Option<Bitmap>[src]

Load an image from the embed files and returns a bitmap. An image is defined this way: IMAGE_NAME IMAGE "../path/my_image.bmp" This method can load any image type supported by the image decoder.

pub fn image_str(&self, id: &str, size: Option<(u32, u32)>) -> Option<Bitmap>[src]

Load a image using a string name. See EmbedResource::image

pub fn cursor(&self, id: usize) -> Option<Cursor>[src]

Load a cursor file from the rc file. Returns None if id does not map to a cursor.

pub fn cursor_str(&self, id: &str) -> Option<Cursor>[src]

Load a cursor file from the rc file. Returns None if id does not map to a cursor.

pub fn raw(&self, id: usize, ty: RawResourceType) -> Option<RawResource>[src]

Return a wrapper over the data of an embed resource. Return None id does not map to a resource.

pub fn raw_str(&self, id: &str, ty: RawResourceType) -> Option<RawResource>[src]

Return a wrapper over the data of an embed resource. Return None id does not map to a resource.

Trait Implementations

impl Default for EmbedResource[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.