Skip to main content

RenderMouseRegion

Struct RenderMouseRegion 

Source
pub struct RenderMouseRegion { /* private fields */ }
Expand description

Calls callbacks in response to pointer events that are exclusive to mice.

It responds to events that are related to hovering, i.e. when the mouse enters, exits (with or without pressing buttons), or moves over a region without pressing buttons.

It does not respond to common events that construct gestures, such as when the pointer is pressed, moved, then released or canceled. For these events, use RenderPointerListener.

If it has a child, it defers to the child for sizing behavior.

If it does not have a child, it grows to fit the parent-provided constraints.

Flutter’s RenderMouseRegion implements MouseTrackerAnnotation: here it answers RenderObject::mouse_tracker_annotation with its current callbacks, cursor, and validity.

See also:

Implementations§

Source§

impl RenderMouseRegion

Source

pub fn new( app: &mut App, valid_for_mouse_tracker: bool, child: Option<AnyRenderBox>, ) -> RenderHandle<Self>

Creates a render object that forwards pointer events to callbacks.

Dart’s remaining constructor arguments have setters: the callbacks, cursor (MouseCursor.defer), opaque (true), and hit_test_behavior (opaque). valid_for_mouse_tracker has none, so it is a parameter (Dart’s default is true).

Source

pub fn opaque(self: RenderHandle<Self>, app: &App) -> bool

Whether this object should prevent RenderMouseRegions visually behind it from detecting the pointer, thus affecting how their on_hover, on_enter, and on_exit behave.

If opaque is true, this object will absorb the mouse pointer and prevent this object’s siblings (or any other objects that are not ancestors or descendants of this object) from detecting the mouse pointer even when the pointer is within their areas.

If opaque is false, this object will not affect how RenderMouseRegions behind it behave, which will detect the mouse pointer as long as the pointer is within their areas.

This defaults to true.

Source

pub fn set_opaque(self: RenderHandle<Self>, app: &mut App, value: bool)

Sets opaque.

Source

pub fn hit_test_behavior( self: RenderHandle<Self>, app: &App, ) -> Option<HitTestBehavior>

How to behave during hit testing.

This defaults to HitTestBehavior::Opaque if None.

Source

pub fn set_hit_test_behavior( self: RenderHandle<Self>, app: &mut App, value: Option<HitTestBehavior>, )

Source

pub fn on_enter( self: RenderHandle<Self>, app: &App, ) -> Option<PointerEnterEventListener>

Triggered when a mouse pointer, with or without buttons pressed, has entered the region and valid_for_mouse_tracker is true.

Source

pub fn set_on_enter( self: RenderHandle<Self>, app: &mut App, value: Option<PointerEnterEventListener>, )

Sets on_enter.

Source

pub fn on_hover( self: RenderHandle<Self>, app: &App, ) -> Option<PointerHoverEventListener>

Triggered when a pointer has moved onto or within the region without buttons pressed.

Source

pub fn set_on_hover( self: RenderHandle<Self>, app: &mut App, value: Option<PointerHoverEventListener>, )

Sets on_hover.

Source

pub fn on_exit( self: RenderHandle<Self>, app: &App, ) -> Option<PointerExitEventListener>

Triggered when a mouse pointer, with or without buttons pressed, has exited the region and valid_for_mouse_tracker is true.

Source

pub fn set_on_exit( self: RenderHandle<Self>, app: &mut App, value: Option<PointerExitEventListener>, )

Sets on_exit.

Source

pub fn cursor(self: RenderHandle<Self>, app: &App) -> MouseCursorRef

The mouse cursor for mouse pointers that are hovering over the region.

When a mouse enters the region, its cursor will be changed to the cursor. When the mouse leaves the region, the cursor will be set by the region found at the new location.

Defaults to MouseCursor.defer, deferring the choice of cursor to the next region behind it in hit-test order.

Source

pub fn set_cursor( self: RenderHandle<Self>, app: &mut App, value: MouseCursorRef, )

Sets cursor.

Source

pub fn valid_for_mouse_tracker(self: RenderHandle<Self>, app: &App) -> bool

Whether this is included when a MouseTracker collects the list of annotations: true while attached to a pipeline owner.

Trait Implementations§

Source§

impl RenderBox for RenderMouseRegion

Source§

fn render_box_data(self: RenderHandle<Self>, app: &App) -> &RenderBoxData

Mixin field access.
Source§

fn render_box_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderBoxData

Source§

fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )

Installs BoxParentData unless the child already has it. Read more
Source§

fn apply_paint_transform( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )

Multiply the transform from the parent’s coordinate system to this box’s coordinate system into the given transform. Read more
Source§

fn hit_test( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool

Determines the set of render objects located at the given position. Read more
Source§

fn hit_test_self(self: RenderHandle<Self>, app: &App, position: Offset) -> bool

Override this method if this render object can be hit even if its children were not hit. Read more
Source§

fn hit_test_children( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool

Override this method to check whether any children are located at the given position. Read more
Source§

fn handle_event( self: RenderHandle<Self>, app: &mut App, event: &PointerEvent, _entry: &BoxHitTestEntry, )

Override this method to handle pointer events that hit this render object. Read more
Source§

fn compute_min_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64

Computes the value returned by get_min_intrinsic_width. Do not call this function directly, instead, call get_min_intrinsic_width. Read more
Source§

fn compute_max_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64

Computes the value returned by get_max_intrinsic_width. Do not call this function directly, instead, call get_max_intrinsic_width. Read more
Source§

fn compute_min_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64

Computes the value returned by get_min_intrinsic_height. Do not call this function directly, instead, call get_min_intrinsic_height. Read more
Source§

fn compute_max_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64

Computes the value returned by get_max_intrinsic_height. Do not call this function directly, instead, call get_max_intrinsic_height. Read more
Source§

fn compute_distance_to_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64>

Returns the distance from the y-coordinate of the position of the box to the y-coordinate of the first given baseline in the box’s contents, if any, or None otherwise. Read more
Source§

fn compute_dry_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, ) -> Option<f64>

Computes the value returned by get_dry_baseline. Read more
Source§

fn compute_dry_layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, ) -> Size

Computes the value returned by get_dry_layout. Do not call this function directly, instead, call get_dry_layout. Read more
Source§

fn constraints(self: RenderHandle<Self>, app: &App) -> BoxConstraints

The box constraints most recently supplied by the parent. Read more
Source§

fn get_min_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64

Source§

fn get_max_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64

Source§

fn get_min_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64

Source§

fn get_max_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64

Source§

fn get_dry_layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, ) -> Size

Source§

fn get_dry_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, ) -> Option<f64>

Source§

fn debug_cannot_compute_dry_layout( self: RenderHandle<Self>, failure: DryLayoutFailure<'_>, )

Called from compute_dry_layout or compute_dry_baseline if this box does not support calculating a dry layout. Read more
Source§

fn get_distance_to_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, only_real: bool, ) -> Option<f64>

Source§

fn get_distance_to_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64>

Source§

fn mark_needs_layout(self: RenderHandle<Self>, app: &mut App)

Mark this render object’s layout information as dirty. Read more
Source§

fn perform_resize(self: RenderHandle<Self>, app: &mut App)

Updates the box’s size using only the constraints. Read more
Source§

fn size(self: RenderHandle<Self>, app: &App) -> Size

The size of this box.
Source§

fn paint_bounds(self: RenderHandle<Self>, app: &App) -> Rect

An estimate of the bounds within which this render object will paint: the box’s own size.
Source§

fn has_size(self: RenderHandle<Self>, app: &App) -> bool

Whether this render object has undergone layout and has a size.
Source§

fn set_size(self: RenderHandle<Self>, app: &mut App, size: Size)

Sets the size of this box. Call from RenderObject::perform_layout or RenderObject::perform_resize.
Source§

fn layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, parent_uses_size: bool, )

Source§

fn as_box(self: RenderHandle<Self>) -> AnyRenderBox

The type-erased RenderBox handle. Free: the vtable is a const, and the id is copied.
Source§

fn as_object(self: RenderHandle<Self>) -> AnyRenderObject

The type-erased RenderObject handle, through as_box.
Source§

fn adopt_child(self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject)

Source§

fn drop_child(self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject)

Source§

fn mark_needs_paint(self: RenderHandle<Self>, app: &mut App)

Source§

fn mark_needs_composited_layer_update(self: RenderHandle<Self>, app: &mut App)

Source§

fn mark_needs_compositing_bits_update(self: RenderHandle<Self>, app: &mut App)

Source§

fn schedule_initial_layout(self: RenderHandle<Self>, app: &mut App)

Source§

fn parent(self: RenderHandle<Self>, app: &App) -> Option<AnyRenderObject>

Source§

fn owner(self: RenderHandle<Self>, app: &App) -> Option<Handle<PipelineOwner>>

Source§

fn attached(self: RenderHandle<Self>, app: &App) -> bool

Source§

fn debug_needs_layout(self: RenderHandle<Self>, app: &App) -> bool

Source§

impl RenderObject for RenderMouseRegion

Source§

fn render_object_data(self: RenderHandle<Self>, app: &App) -> &RenderObjectData

Mixin field access.
Source§

fn render_object_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderObjectData

Source§

fn did_attach( self: RenderHandle<Self>, app: &mut App, owner: Handle<PipelineOwner>, )

The body of Flutter’s attach override after super.attach(owner); the base body has already run. The default attaches the children reported by visit_children.
Source§

fn did_detach(self: RenderHandle<Self>, app: &mut App)

The body of Flutter’s detach override after super.detach(). The default detaches the children reported by visit_children.
Source§

fn perform_layout(self: RenderHandle<Self>, app: &mut App)

Do the work of computing the layout for this render object. Read more
Source§

fn mouse_tracker_annotation( self: RenderHandle<Self>, app: &App, ) -> Option<MouseTrackerAnnotation>

Dart’s this is MouseTrackerAnnotation: the annotation this render object implements, read live each time the mouse tracker consults it. None for a render object that is not an annotation, which is the default.
Source§

fn paint( self: RenderHandle<Self>, app: &mut App, context: &mut PaintingContext, offset: Offset, )

Paint this render object into the given context at the given offset. Read more
Source§

fn visit_children( self: RenderHandle<Self>, app: &App, visitor: &mut dyn FnMut(AnyRenderObject), )

Calls visitor for each immediate child.
Source§

fn as_render_object(self: RenderHandle<Self>, app: &App) -> AnyRenderObject

Dart’s implicit upcast of a concrete render object to RenderObject: this object’s type-erased handle, through the vtable the protocol recorded when it created it.
Source§

fn perform_resize(self: RenderHandle<Self>, _app: &mut App)

Updates the render object’s size using only the constraints. Read more
Source§

fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )

Sets up parent data for child if it has none. Read more
Source§

fn redepth_children(self: RenderHandle<Self>, app: &mut App)

Adjusts the depth of each child reported by visit_children.
Source§

fn sized_by_parent(self: RenderHandle<Self>, _app: &App) -> bool

Whether the constraints are the only input to the sizing algorithm.
Source§

fn apply_paint_transform( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )

Applies the transform that would be applied when painting the given child to the given matrix. Read more
Source§

fn is_repaint_boundary(self: RenderHandle<Self>, _app: &App) -> bool

Whether this render object repaints separately from its parent. Read more
Source§

fn always_needs_compositing(self: RenderHandle<Self>, _app: &App) -> bool

Whether this render object always needs compositing. Read more
Source§

fn update_composited_layer( self: RenderHandle<Self>, app: &mut App, old_layer: Option<AnyOffsetLayer>, ) -> AnyOffsetLayer

Update the composited layer owned by this render object. Read more
Source§

fn show_on_screen( self: RenderHandle<Self>, app: &mut App, descendant: Option<AnyRenderObject>, rect: Option<Rect>, duration: Duration, curve: Rc<dyn Curve>, )

Attempt to make (a portion of) this or a descendant RenderObject visible on screen. Read more
Source§

fn interface(self: RenderHandle<Self>, id: TypeId) -> Option<Box<dyn Any>>

Dart’s object is RenderAbstractViewport for any interface: the erased handle of the interface id names, if this type implements it. Read more
Source§

fn dispose(self: RenderHandle<Self>, app: &mut App)

Release any resources held by this render object. Read more
Source§

impl RenderObjectWithChildMixin for RenderMouseRegion

Source§

type ChildType = AnyRenderBox

Flutter’s ChildType: the protocol of this render object’s child.
Source§

fn child_data( self: RenderHandle<Self>, app: &App, ) -> &RenderObjectWithChildData<AnyRenderBox>

Mixin field access.
Source§

fn child_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderObjectWithChildData<AnyRenderBox>

Source§

fn child(self: RenderHandle<Self>, app: &App) -> Option<Self::ChildType>

The render object’s unique child.
Source§

fn set_child( self: RenderHandle<Self>, app: &mut App, value: Option<Self::ChildType>, )

Sets the unique child, adopting or dropping as Flutter’s setter does.
Source§

impl RenderProxyBoxMixin for RenderMouseRegion

Source§

fn compute_size_for_no_child( self: RenderHandle<Self>, _app: &App, constraints: BoxConstraints, ) -> Size

Calculate the size the proxy box would have when it has no child.
Source§

fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )

A proxy child gets plain parent data, not crate::BoxParentData.
Source§

fn apply_paint_transform( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )

A proxy paints its child at its own offset: no transform to apply.
Source§

fn compute_min_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64

The child’s minimum intrinsic width, or 0 without a child.
Source§

fn compute_max_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64

The child’s maximum intrinsic width, or 0 without a child.
Source§

fn compute_min_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64

The child’s minimum intrinsic height, or 0 without a child.
Source§

fn compute_max_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64

The child’s maximum intrinsic height, or 0 without a child.
Source§

fn compute_distance_to_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64>

The child’s baseline, or none without a child.
Source§

fn compute_dry_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, ) -> Option<f64>

The child’s dry baseline, or none without a child.
Source§

fn compute_dry_layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, ) -> Size

The child’s dry layout at this box’s constraints, or compute_size_for_no_child.
Source§

fn perform_layout(self: RenderHandle<Self>, app: &mut App)

Lays the child out with this box’s constraints and takes its size.
Source§

fn hit_test_children( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool

Hit tests the child at this box’s position.
Source§

fn paint( self: RenderHandle<Self>, app: &mut App, context: &mut PaintingContext, offset: Offset, )

Paints the child at this box’s offset.
Source§

impl RenderProxyBoxWithHitTestBehavior for RenderMouseRegion

Source§

fn behavior(self: RenderHandle<Self>, app: &App) -> HitTestBehavior

How to behave during hit testing when deciding how the hit test propagates to children and whether to consider targets behind this one.
Source§

fn hit_test( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool

Flutter’s hitTest: a translucent box is added even when nothing was hit.
Source§

fn hit_test_self(self: RenderHandle<Self>, app: &App, _position: Offset) -> bool

Flutter’s hitTestSelf: an opaque box is hit by itself.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> RenderObjectBase for T
where T: RenderObject,

Source§

fn dispose(self: RenderHandle<Self>, app: &mut App)

Flutter’s RenderObject.dispose body: releases the layer handle. An override calls it last, where Dart writes super.dispose().
Source§

fn mark_needs_layout(self: RenderHandle<Self>, app: &mut App)

Flutter’s RenderObject.markNeedsLayout body; an override calls it where Dart writes super.markNeedsLayout().
Source§

fn show_on_screen( self: RenderHandle<Self>, app: &mut App, descendant: Option<AnyRenderObject>, rect: Option<Rect>, duration: Duration, curve: Rc<dyn Curve>, )

Flutter’s RenderObject.showOnScreen.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>