# ContextRequestedEventArgs

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/input/struct-contextrequestedeventargs/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct ContextRequestedEventArgs
```

Provides event data for the context requested event.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L9)

## Members

- [`new`](#function-new)
- [`from_pointer_event_args`](#function-from_pointer_event_args)
- [`from_context_requested_event_args`](#function-from_context_requested_event_args)
- [`try_get_position`](#function-try_get_position)
- [`set_placement_rect`](#function-set_placement_rect)
- [`try_get_placement_rect`](#function-try_get_placement_rect)
- [`clear_placement_rect`](#function-clear_placement_rect)
- [`is_holding`](#function-is_holding)
- [`pointer_type`](#function-pointer_type)

<a id="function-new"></a>

### new

```rust
fn new() -> Self
```

Creates args for a context request that has no position, e.g. one
made with the keyboard.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L27)

<a id="function-from_pointer_event_args"></a>

### from_pointer_event_args

```rust
fn from_pointer_event_args(pointer_event_args: &PointerEventArgs) -> Self
```

Creates args for a context request made with a pointer.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L37)

<a id="function-from_context_requested_event_args"></a>

### from_context_requested_event_args

```rust
fn from_context_requested_event_args(context_requested_event_args: &ContextRequestedEventArgs) -> Self
```

Creates args from other context requested args, keeping the position.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L42)

<a id="function-try_get_position"></a>

### try_get_position

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L63)

<a id="function-set_placement_rect"></a>

### set_placement_rect

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L72)

<a id="function-try_get_placement_rect"></a>

### try_get_placement_rect

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L79)

<a id="function-clear_placement_rect"></a>

### clear_placement_rect

```rust
fn clear_placement_rect(self: &Self)
```

Restores the ordinary pointer or keyboard placement for this request.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L86)

<a id="function-is_holding"></a>

### is_holding

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L93)

<a id="function-pointer_type"></a>

### pointer_type

```rust
fn pointer_type(self: &Self) -> Option<PointerType>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/context_requested_event_args.rs#L98)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Deref`
- [`IRoutedEventArgs`](/docs/0.5.0/api/ferroui-base/interactivity/trait-iroutedeventargs/)
- `Default`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
