Struct ul_next::window::Window

source ·
pub struct Window { /* private fields */ }
Expand description

Window struct, represents a platform window.

Implementations§

source§

impl Window

source

pub fn screen_width(&self) -> u32

Get the window width (in screen coordinates).

source

pub fn width(&self) -> u32

Get the window width (in pixels).

source

pub fn screen_height(&self) -> u32

Get the window height (in screen coordinates).

source

pub fn height(&self) -> u32

Get the window height (in pixels).

source

pub fn move_to(&self, x: i32, y: i32)

Move the window to a new position (in screen coordinates) relative to the top-left of the monitor area.

source

pub fn move_to_center(&self)

Move the window to the center of the monitor.

source

pub fn x(&self) -> i32

Get the x-position of the window (in screen coordinates) relative to the top-left of the monitor area.

source

pub fn y(&self) -> i32

Get the y-position of the window (in screen coordinates) relative to the top-left of the monitor area.

source

pub fn is_fullscreen(&self) -> bool

Whether or not the window is fullscreen.

source

pub fn scale(&self) -> f64

The DPI scale of the window.

source

pub fn set_title(&self, title: &str)

Set the window title.

source

pub fn set_cursor(&self, cursor: Cursor)

Set the cursor.

source

pub fn show(&self)

Show the window (if it was previously hidden).

source

pub fn hide(&self)

Hide the window.

source

pub fn is_visible(&self) -> bool

Whether or not the window is currently visible (not hidden).

source

pub fn close(&self)

Close the window.

source

pub fn screen_to_pixels(&self, val: i32) -> i32

Convert screen coordinates to pixels using the current DPI scale.

source

pub fn pixels_to_screen(&self, val: i32) -> i32

Convert pixels to screen coordinates using the current DPI scale.

source

pub fn set_close_callback<F>(&self, callback: F)
where F: FnMut(&Window) + 'static,

Called when the Window is closed.

§Callback Arguments
  • window: &Window - The window that fired the event (eg. self)
source

pub fn set_resize_callback<F>(&self, callback: F)
where F: FnMut(&Window, u32, u32) + 'static,

Called when the Window is resized.

§Callback Arguments
  • window: &Window - The window that fired the event (eg. self)
  • width: u32 - The new width of the window (in pixels)
  • height: u32 - The new height of the window (in pixels)
source§

impl Window

source

pub fn create_overlay( &self, width: u32, height: u32, x: i32, y: i32 ) -> Option<Overlay>

Create a new Overlay.

§Arguments
  • width - The width in pixels.
  • height - The height in pixels.
  • x - The x-position (offset from the left of this Window), in pixels.
  • y - The y-position (offset from the top of this Window), in pixels.

Returns None if failed to create Overlay.

source

pub fn create_overlay_with_view( &self, view: View, x: i32, y: i32 ) -> Option<Overlay>

Create a new Overlay, wrapping an existing view.

§Arguments
  • view - The view to wrap (will use its width and height).
  • x - The x-position (offset from the left of this Window), in pixels.
  • y - The y-position (offset from the top of this Window), in pixels.

Returns None if failed to create Overlay.

Trait Implementations§

source§

impl Drop for Window

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl UnwindSafe for Window

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.