pub struct Window { /* private fields */ }Expand description
A live window: the tree of nodes built from a PanelWindow.
The platform owns one per layer surface. Each event-loop iteration it
runs the reactive flush, then calls layout if
needs_layout, then draws
take_damage from view. When
nothing changed, there is nothing to lay out or draw.
Dropping the window disposes its owner, which frees every node, binding and handler in it.
Implementations§
Source§impl Window
impl Window
Sourcepub fn pointer_motion(&self, position: Point) -> CursorShape
pub fn pointer_motion(&self, position: Point) -> CursorShape
The pointer entered the window or moved, to position in logical
pixels. Returns the cursor to show.
Sourcepub fn pointer_leave(&self)
pub fn pointer_leave(&self)
The pointer left the window.
A pointer button went down or up. Releasing it over the button it
went down on runs that button’s on_click, on_right_click or
on_middle_click.
Sourcepub fn pointer_scroll(&self, delta: ScrollDelta)
pub fn pointer_scroll(&self, delta: ScrollDelta)
The pointer scrolled. Once whole steps add up, the on_scroll of the
button under the pointer runs with them.
Sourcepub fn pointer_scroll_end(&self)
pub fn pointer_scroll_end(&self)
A touchpad scroll gesture ended (wl_pointer.axis_stop): scrolling
that hasn’t added up to a whole step is dropped, so it doesn’t carry
into the next gesture. A wheel’s partial notch is kept.
Sourcepub fn cursor(&self) -> CursorShape
pub fn cursor(&self) -> CursorShape
The cursor to show.
Source§impl Window
impl Window
Sourcepub fn take_popups(&self) -> Vec<Window>
pub fn take_popups(&self) -> Vec<Window>
Takes the popups this window’s widgets opened since the last call.
Sourcepub fn anchor(&self) -> Option<Rect>
pub fn anchor(&self) -> Option<Rect>
For a popup, the rectangle of the widget that opened it, at its
window’s last layout, in that window’s logical pixels. The platform
places the popup next to it. None for a panel, once the widget is
gone, or before its first layout.
Sourcepub fn wants_close(&self) -> bool
pub fn wants_close(&self) -> bool
Whether this popup should close: Cx::close_popup asked, or the
widget that opened it is gone. Always false for a panel.
Source§impl Window
impl Window
Sourcepub fn new(cx: &Cx, panel: PanelWindow) -> Window
pub fn new(cx: &Cx, panel: PanelWindow) -> Window
Builds panel under a new child owner of cx.
Properties set to values take effect now. Bindings are effects, so
they first run at the next Runtime::flush; run it before the
first layout.
Sourcepub fn surface(&self) -> SurfaceConfig
pub fn surface(&self) -> SurfaceConfig
The layer-surface settings. Read them only after the first
Runtime::flush: settings given as closures are bindings, which
first run then, and until they do these are the defaults.
Sourcepub fn take_surface_changed(&self) -> bool
pub fn take_surface_changed(&self) -> bool
Sourcepub fn size(&self) -> Size
pub fn size(&self) -> Size
The window’s size in logical pixels: the size the compositor gave a panel, or the size a popup’s content wants, from its last layout.
Sourcepub fn set_size(&self, size: Size)
pub fn set_size(&self, size: Size)
Sets the size the compositor gave the window, from a configure event. A new size needs a layout.
Sourcepub fn needs_layout(&self) -> bool
pub fn needs_layout(&self) -> bool
Whether something changed that needs layout.
Sourcepub fn layout(&self, text: &mut TextSystem)
pub fn layout(&self, text: &mut TextSystem)
Lays the window out at its size, measuring text with text, and
records the areas that moved or changed as damage.
Sourcepub fn has_damage(&self) -> bool
pub fn has_damage(&self) -> bool
Whether any area needs repainting.
Sourcepub fn take_damage(&self) -> Vec<Rect>
pub fn take_damage(&self) -> Vec<Rect>
Takes the areas to repaint since the last call, in logical pixels. They may overlap.
Sourcepub fn view(&self) -> WindowView<'_>
pub fn view(&self) -> WindowView<'_>
A read-only view of the laid-out tree, for drawing. Release it before the next flush or pointer event.