Skip to main content

WindowClass

Enum WindowClass 

Source
pub enum WindowClass {
    Atom(ATOM),
    Name(Vec<u16>),
}
Expand description

A window class.

Variants§

§

Atom(ATOM)

§

Name(Vec<u16>)

Implementations§

Source§

impl WindowClass

Source

pub fn builder(class_name: impl AsRef<OsStr>) -> WindowClassBuilder

A builder for creating a new window class.

The class name should be unique, otherwise creation will fail.

Examples found in repository?
examples/hello-win.rs (line 38)
33fn main() {
34    unsafe {
35        let icon = LoadIconW(0 as HINSTANCE, IDI_APPLICATION);
36        let cursor = LoadCursorW(0 as HINSTANCE, IDC_ARROW);
37        let brush = CreateSolidBrush(0xff_ff_ff);
38        let win_class = WindowClass::builder("rust")
39            .icon(icon)
40            .cursor(cursor)
41            .background(brush)
42            .build()
43            .unwrap();
44        let hwnd = WindowBuilder::new(MyWindowProc, &win_class)
45            .name("win-win example")
46            .style(WS_OVERLAPPEDWINDOW)
47            .build();
48        ShowWindow(hwnd, SW_SHOWNORMAL);
49        win_win::runloop(null_mut());
50    }
51}
Source

pub fn from_name(class_name: impl AsRef<OsStr>) -> WindowClass

Create a window class reference from a name.

This function is useful if the window class has already been registered, either through a successful builder or some other means.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.