ContextRequestedEventArgs
struct · ferroui-base · v0.5.0
struct ContextRequestedEventArgs
Provides event data for the context requested event.
Members
newfrom_pointer_event_argsfrom_context_requested_event_argstry_get_positionset_placement_recttry_get_placement_rectclear_placement_rectis_holdingpointer_type
new
fn new() -> Self
Creates args for a context request that has no position, e.g. one made with the keyboard.
from_pointer_event_args
fn from_pointer_event_args(pointer_event_args: &PointerEventArgs) -> Self
Creates args for a context request made with a pointer.
from_context_requested_event_args
fn from_context_requested_event_args(context_requested_event_args: &ContextRequestedEventArgs) -> Self
Creates args from other context requested args, keeping the position.
try_get_position
fn try_get_position(self: &Self, relative_to: Option<&InputElement>) -> Option<Point>
Gets the point on which the context was requested, relative to the
specified element (or to the root when None).
Returns None if the context was not requested with a pointer, e.g.
when it was requested with the keyboard.
set_placement_rect
fn set_placement_rect(self: &Self, relative_to: &Visual, rect: Rect)
Supplies an explicit anchor for this menu request in relative_to's
device-independent coordinates. A zero-size rectangle anchors at a point.
This does not change whether the request originated from a pointer or keyboard. The owner is weak, and shared event handles see the same anchor.
try_get_placement_rect
fn try_get_placement_rect(self: &Self, relative_to: &Visual) -> Option<Rect>
Gets this request's explicit anchor in the recipient's coordinates.
Returns None when no anchor was supplied, its owner expired, or the
recipient and owner do not share a visual coordinate system.
clear_placement_rect
fn clear_placement_rect(self: &Self)
Restores the ordinary pointer or keyboard placement for this request.
is_holding
fn is_holding(self: &Self) -> bool
Whether the context was requested by holding a pointer down.
Internal in the reference, where the controls assembly sees it.
pointer_type
fn pointer_type(self: &Self) -> Option<PointerType>
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyToOwnedErasedDestructorIntoEitherCloneDerefIRoutedEventArgsDefaultMarkupTyped
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.