Struct native_windows_gui::Window
source · [−]pub struct Window {
pub handle: ControlHandle,
}
Expand description
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. SeeWindowFlags
ex_flags
: A combination of win32 window extended flags. Unlikeflags
, ex_flags must be used straight from winapititle
: The text in the window title barsize
: The default size of the windowposition
: The default position of the window in the desktopicon
: The window iconaccept_file
: If the window should accept files by drag & dropmaximized
: If the window should be maximized at creationminimized
: If the window should be minimized at creationcenter
: Center the window in the current monitor based on its size. Iftrue
, this overridesposition
topmost
: If the window should always be on top of other system windowparent
: Logical parent of the window, unlike children controls, this is NOT required.
Control events:
OnInit
: The window was createdMousePress(_)
: Generic mouse press events on the buttonOnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel eventOnPaint
: Generic on paint eventOnKeyPress
: Generic key pressOnKeyRelease
: Generic ket releaseOnResize
: When the window is resizedOnResizeBegin
: Just before the window begins being resized by the userOnResizeEnd
: Just after the user stops resizing the windowOnWindowMaximize
: When the window is maximizedOnWindowMinimize
: When the window is minimizedOnMove
: When the window is moved by the userOnFileDrop
: 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
sourceimpl Window
impl Window
pub fn builder<'a>() -> WindowBuilder<'a>
sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Force the window to refraw iteself and all its children
sourcepub fn set_icon(&self, icon: Option<&Icon>)
pub fn set_icon(&self, icon: Option<&Icon>)
Set the icon in the window
- icon: The new icon. If None, the icon is removed
sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Return true if the control user can interact with the control, return false otherwise
sourcepub fn set_enabled(&self, v: bool)
pub fn set_enabled(&self, v: bool)
Enable or disable the control
sourcepub fn visible(&self) -> bool
pub fn visible(&self) -> bool
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))
sourcepub fn set_visible(&self, v: bool)
pub fn set_visible(&self, v: bool)
Show or hide the control to the user
sourcepub fn set_position(&self, x: i32, y: i32)
pub fn set_position(&self, x: i32, y: i32)
Set the position of the button in the parent window
sourcepub fn class_name(&self) -> &'static str
pub fn class_name(&self) -> &'static str
Winapi class name used during control creation
pub fn flags(&self) -> u32
sourcepub fn forced_flags(&self) -> u32
pub fn forced_flags(&self) -> u32
Winapi flags required by the control
Trait Implementations
sourceimpl From<&Window> for ControlHandle
impl From<&Window> for ControlHandle
sourceimpl From<&mut Window> for ControlHandle
impl From<&mut Window> for ControlHandle
sourceimpl PartialEq<ControlHandle> for Window
impl PartialEq<ControlHandle> for Window
sourcefn eq(&self, other: &ControlHandle) -> bool
fn eq(&self, other: &ControlHandle) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl PartialEq<Window> for ControlHandle
impl PartialEq<Window> for ControlHandle
sourceimpl PartialEq<Window> for Window
impl PartialEq<Window> for Window
impl Eq for Window
impl StructuralEq for Window
impl StructuralPartialEq for Window
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more