Trait cushy::window::WindowBehavior
source · pub trait WindowBehavior: Sized + 'static {
type Context: Send + 'static;
// Required methods
fn initialize(
window: &mut RunningWindow<Window<'_, WindowCommand>>,
context: Self::Context,
) -> Self;
fn make_root(&mut self) -> WidgetInstance;
// Provided methods
fn initialized<W>(&mut self, window: &mut W)
where W: PlatformWindow { ... }
fn close_requested<W>(&self, window: &mut W) -> bool
where W: PlatformWindow { ... }
fn run() -> Result
where Self::Context: Default { ... }
fn run_with(context: Self::Context) -> Result { ... }
}
Expand description
The behavior of a Cushy window.
Required Associated Types§
Required Methods§
sourcefn initialize(
window: &mut RunningWindow<Window<'_, WindowCommand>>,
context: Self::Context,
) -> Self
fn initialize( window: &mut RunningWindow<Window<'_, WindowCommand>>, context: Self::Context, ) -> Self
Return a new instance of this behavior using context
.
sourcefn make_root(&mut self) -> WidgetInstance
fn make_root(&mut self) -> WidgetInstance
Create the window’s root widget. This function is only invoked once.
Provided Methods§
sourcefn initialized<W>(&mut self, window: &mut W)where
W: PlatformWindow,
fn initialized<W>(&mut self, window: &mut W)where
W: PlatformWindow,
Invoked once the window has been fully initialized.
sourcefn close_requested<W>(&self, window: &mut W) -> boolwhere
W: PlatformWindow,
fn close_requested<W>(&self, window: &mut W) -> boolwhere
W: PlatformWindow,
The window has been requested to close. If this function returns true, the window will be closed. Returning false prevents the window from closing.
Object Safety§
This trait is not object safe.