pub struct WindowModal(/* private fields */);
Available on crate feature
gui
only.Expand description
An user modal window, which can handle events. Can be programmatically
created or load a dialog resource from a .res
file.
Implementations§
Source§impl WindowModal
impl WindowModal
Sourcepub fn new(opts: WindowModalOpts) -> Self
pub fn new(opts: WindowModalOpts) -> Self
Instantiates a new WindowModal
object, to be created internally with
HWND::CreateWindowEx
.
Sourcepub fn new_dlg(dlg_id: u16) -> Self
pub fn new_dlg(dlg_id: u16) -> Self
Instantiates a new WindowModal
object, to be loaded from a dialog
resource with
HINSTANCE::DialogBoxParam
.
Sourcepub fn show_modal(&self, parent: &impl GuiParent) -> AnyResult<()>
pub fn show_modal(&self, parent: &impl GuiParent) -> AnyResult<()>
Physically creates the window, then runs the modal loop. This method will block until the window is closed.
Note that, if the user clicks the “X” to close the modal, the default
behavior is to call EndDialog(0)
. To override this behavior, handle
the modal’s wm_close
yourself.
§Panics
Panics if the window is already created.
Panics if the creation process fails.
Trait Implementations§
Source§impl Clone for WindowModal
impl Clone for WindowModal
Source§fn clone(&self) -> WindowModal
fn clone(&self) -> WindowModal
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl GuiParent for WindowModal
impl GuiParent for WindowModal
Source§fn on(&self) -> &WindowEvents
fn on(&self) -> &WindowEvents
Exposes methods to handle the basic window messages, plus timer and
native control notifications. Read more
Source§fn spawn_thread<F>(&self, func: F)
fn spawn_thread<F>(&self, func: F)
This method calls
std::thread::spawn
, but it allows the returning of
an error value. This error value will be forwarded to the original UI
thread, allowing it to be caught at
WindowMain::run_main
. Read moreSource§impl GuiWindow for WindowModal
impl GuiWindow for WindowModal
impl Send for WindowModal
Auto Trait Implementations§
impl Freeze for WindowModal
impl !RefUnwindSafe for WindowModal
impl !Sync for WindowModal
impl Unpin for WindowModal
impl !UnwindSafe for WindowModal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more