pub struct Window<'video> { /* private fields */ }
Expand description

A window made by SDL2.

Implementations§

source§

impl<'video> Window<'video>

source

pub fn from_id(id: u32, video: &'video Video<'_>) -> Option<Self>

Gets a window from the window id, or None if does not exist.

source

pub fn grabbed(video: &'video Video<'_>) -> Option<Self>

Gets a grabbed window, or None if does not exist.

source

pub fn mouse_focused(video: &'video Video<'_>) -> Option<Self>

Gets a focused window, or None if does not exist.

source

pub fn state(&self) -> WindowState

Returns the state of the window.

source

pub fn display(&self) -> Option<Display<'_>>

Returns the display at the window, or None if unavailable.

source

pub fn id(&self) -> u32

Returns the window id.

source

pub fn pixel_format(&self) -> PixelFormatKind

Returns the pixel format of the window context.

source

pub fn show(&self)

Shows the window.

source

pub fn hide(&self)

Hides the window.

source

pub fn raise(&self)

Raises the window.

source

pub fn set_input_focus(&self) -> Result<()>

Explicitly sets the input focus to the window.

You almost want to use Window::raise instead of this. This might give focus to a window that is completely obscured by other windows.

source

pub fn full_screen(&self) -> Result<()>

Make the window full screen.

§Errors

Returns Err if failed to make it full screen.

source

pub fn maximize(&self)

Maximizes the window.

source

pub fn minimize(&self)

Minimizes the window.

source

pub fn restore(&self)

Restores the window from maximization/minimization.

source

pub fn set_icon(&self, icon: &impl Surface)

Sets an icon from a surface for the window.

source

pub fn is_screen_keyboard_shown(&self) -> bool

Returns whether the window is showing the screen keyboard.

source

pub fn surface(&self) -> WindowSurface<'_>

Makes the window surface.

source

pub fn subsystem_kind(&self) -> SubsystemKind

Gets a kind of the underlying subsystem.

Trait Implementations§

source§

impl BorderExt for Window<'_>

source§

fn border_widths(&self) -> Result<BorderWidths>

Returns the border widths of the window. Read more
source§

impl BrightnessExt for Window<'_>

source§

fn brightness(&self) -> Brightness

Returns the brightness of the window.
source§

fn set_brightness(&self, brightness: Brightness) -> Result<()>

Sets the brightness of the Window. Read more
source§

impl ConfigExt for Window<'_>

source§

fn max_size(&self) -> Size

Returns the maximum size of the window.
source§

fn min_size(&self) -> Size

Returns the minimum size of the window.
source§

fn size(&self) -> Size

Returns the current size of the window.
source§

fn opacity(&self) -> Opacity

Returns the opacity of the window.
source§

fn pos(&self) -> Point

Returns the position of the window.
source§

fn title(&self) -> &str

Returns the title of the window.
source§

fn set_max_size(&self, _: Size)

Sets the maximum size of the window.
source§

fn set_min_size(&self, _: Size)

Sets the minimum size of the window.
source§

fn set_size(&self, _: Size)

Sets the current size of the window.
source§

fn set_opacity(&self, opacity: Opacity) -> Result<()>

Sets the opacity of the window. Read more
source§

fn set_pos(&self, _: Position)

Sets the position of the window.
source§

fn set_title(&self, title: &str)

Sets the title of the window.
source§

fn set_resizable(&self, resizable: bool)

Sets whether the window is resizable.
source§

fn add_frame(&self)

Adds a frame to the window.
source§

fn remove_frame(&self)

Removes a frame from the window.
source§

impl<'window> ContextSwitchExt<'window> for Window<'window>

source§

fn set_context<'context: 'window>( &'window self, context: GlContext<'context> ) -> Result<()>

Sets context to the window. Read more
source§

impl Debug for Window<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'video> Drop for Window<'video>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl GammaExt for Window<'_>

source§

fn gamma(&self) -> Result<Gamma>

Returns the gamma ramps of the window. Read more
source§

fn set_gamma(&self, _: GammaParam) -> Result<()>

Sets the gamma ramps of the window. Read more
source§

impl<'video> HasRawWindowHandle for Window<'video>

source§

fn raw_window_handle(&self) -> RawWindowHandle

Downcasts into a raw window handle.

source§

impl MouseGrabExt for Window<'_>

source§

fn grab(&self)

Grabs the mouse.
source§

fn ungrab(&self)

Ungrabs the mouse.
source§

fn is_grabbed(&self) -> bool

Returns whether the window is grabbing the mouse.

Auto Trait Implementations§

§

impl<'video> !RefUnwindSafe for Window<'video>

§

impl<'video> !Send for Window<'video>

§

impl<'video> !Sync for Window<'video>

§

impl<'video> Unpin for Window<'video>

§

impl<'video> !UnwindSafe for Window<'video>

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.