pub struct Window { /* private fields */ }Expand description
A window with a layer container for adding sublayers.
Implementations§
Source§impl Window
impl Window
Sourcepub fn container(&self) -> &CALayer
pub fn container(&self) -> &CALayer
Get the container layer.
Add your layers as sublayers of this container.
Sourcepub fn window_id(&self) -> u64
pub fn window_id(&self) -> u64
Returns the CGWindowID for this window.
This is useful for screen recording with t-rec’s HeadlessRecorder.
§Example
use core_animation::prelude::*;
use t_rec::HeadlessRecorder;
let window = WindowBuilder::new()
.title("Demo")
.size(400.0, 300.0)
.build();
let mut recorder = HeadlessRecorder::builder()
.window_id(window.window_id())
.fps(30)
.output_gif("demo.gif")
.build()?;Sourcepub fn show(&self)
pub fn show(&self)
Show the window and bring it to the front.
If the window was created with .non_activating(), it will appear
without stealing focus from the currently active application.
Sourcepub fn hide(&self)
pub fn hide(&self)
Hide the window.
The window is removed from the screen but not destroyed.
It can be shown again with show().
This method runs a brief event loop tick after ordering out to ensure the hide takes effect immediately, which is important when called from within another run loop (like t-rec’s presenter).
Sourcepub fn close(&self)
pub fn close(&self)
Close and release the window.
After calling this, the window should not be used again. Runs an event loop tick to ensure the close takes effect immediately.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Returns whether the window is currently visible.
Sourcepub fn run_loop_tick(&self)
pub fn run_loop_tick(&self)
Run a single iteration of the event loop.
This processes pending events and returns immediately. Useful for custom animation loops.