[][src]Struct native_windows_gui::Window

pub struct Window {
    pub handle: ControlHandle,
}

A basic top level window. At least one top level window is required to make a NWG application.

Windows can be heavily customized using the window flags. If your application don't need a visible window (ex: a system tray app), use MessageWindow instead.

Builder parameters:

  • flags: The window flags. See WindowFlags
  • title: The text in the window title bar
  • size: The default size of the window
  • position: The default position of the window in the desktop
  • icon: The window icon
  • accept_file: If the window should accept files by drag & drop
  • topmost: If the window should always be on top of other system window
  • parent: Logical parent of the window, unlike children controls, this is NOT required.

Control events:

  • OnInit: The window was created
  • MousePress(_): Generic mouse press events on the button
  • OnMouseMove: Generic mouse mouse event
  • OnMouseWheel: Generic mouse wheel event
  • OnPaint: Generic on paint event
  • OnKeyPress: Generic key press
  • OnKeyRelease: Generic ket release
  • OnResize: When the window is resized
  • OnResizeBegin: Just before the window begins being resized by the user
  • OnResizeEnd: Just after the user stops resizing the window
  • OnWindowMaximize: When the window is maximized
  • OnWindowMinimize: When the window is minimized
  • OnMove: When the window is moved by the user
  • OnFileDrop: When a file is dropped in the window (only raised if accept_file is set)
  • OnMinMaxInfo: When the size or position of the window is about to change and the size of the windows must be restricted

Fields

handle: ControlHandle

Implementations

impl Window[src]

pub fn builder<'a>() -> WindowBuilder<'a>[src]

pub fn invalidate(&self)[src]

Force the window to refraw iteself and all its children

pub fn close(&self)[src]

Close the window as if the user clicked the X button.

pub fn icon(&self) -> Option<Icon>[src]

Return the icon of the window

pub fn set_icon(&self, icon: Option<&Icon>)[src]

Set the icon in the window

  • icon: The new icon. If None, the icon is removed

pub fn focus(&self) -> bool[src]

Return true if the control currently has the keyboard focus

pub fn set_focus(&self)[src]

Set the keyboard focus on the button

pub fn enabled(&self) -> bool[src]

Return true if the control user can interact with the control, return false otherwise

pub fn set_enabled(&self, v: bool)[src]

Enable or disable the control

pub fn visible(&self) -> bool[src]

Return true if the control is visible to the user. Will return true even if the control is outside of the parent client view (ex: at the position (10000, 10000))

pub fn set_visible(&self, v: bool)[src]

Show or hide the control to the user

pub fn size(&self) -> (u32, u32)[src]

Return the size of the button in the parent window

pub fn set_size(&self, x: u32, y: u32)[src]

Set the size of the button in the parent window

pub fn position(&self) -> (i32, i32)[src]

Return the position of the button in the parent window

pub fn set_position(&self, x: i32, y: i32)[src]

Set the position of the button in the parent window

pub fn text(&self) -> String[src]

Return window title

pub fn set_text<'a>(&self, v: &'a str)[src]

Set the window title

pub fn class_name(&self) -> &'static str[src]

Winapi class name used during control creation

pub fn flags(&self) -> u32[src]

pub fn forced_flags(&self) -> u32[src]

Winapi flags required by the control

Trait Implementations

impl Default for Window[src]

impl Drop for Window[src]

impl Eq for Window[src]

impl<'_> From<&'_ Window> for ControlHandle[src]

impl PartialEq<ControlHandle> for Window[src]

impl PartialEq<Window> for Window[src]

impl PartialEq<Window> for ControlHandle[src]

impl StructuralEq for Window[src]

impl StructuralPartialEq for Window[src]

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

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.