pub trait HasFocus {
// Required methods
fn focus(&self) -> FocusFlag;
fn area(&self) -> Rect;
// Provided methods
fn build(&self, builder: &mut FocusBuilder) { ... }
fn z_areas(&self) -> &[ZRect] { ... }
fn navigable(&self) -> Navigation { ... }
fn is_focused(&self) -> bool { ... }
fn lost_focus(&self) -> bool { ... }
fn gained_focus(&self) -> bool { ... }
}Expand description
Trait for a widget that has a focus flag.
Required Methods§
Provided Methods§
sourcefn build(&self, builder: &mut FocusBuilder)
fn build(&self, builder: &mut FocusBuilder)
Build the focus-structure for the container.
sourcefn z_areas(&self) -> &[ZRect]
fn z_areas(&self) -> &[ZRect]
The widget might have several disjointed/overlapping areas. This is the case if it is showing a popup, but there might be other causes.
If z_areas() returns an empty slice it defaults to area()+z-index 0.
z_areas() are a higher resolution image of the widgets areas.
If a widget returns anything but an empty slice here:
area()must be the union of all z_areas. Hit detection will fail for anything outsidearea()- z_areas may overlap other areas. The area with the higher z-index will win the hit-test. If there are still overlapping areas after that, they will be used in the order of addition.
Declares how the widget interacts with focus.
Default is Navigation::Regular.
sourcefn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Focused?
sourcefn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
Just lost focus.
sourcefn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
Just gained focus.