# PopupPositionerParameters

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/primitives/popup_positioning/struct-popuppositionerparameters/

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

```rust
struct PopupPositionerParameters
```

Provides positioning parameters to [`IPopupPositioner`](/docs/0.5.0/api/ferroui-controls/primitives/popup_positioning/trait-ipopuppositioner/).

The popup positioner provides a collection of rules for the placement of
a popup relative to its parent. Rules can be defined to ensure the popup
remains within the visible area's borders, and to specify how the popup
changes its position, such as sliding along an axis, or flipping around
a rectangle. These positioner-created rules are constrained by the
requirement that a popup must intersect with or be at least partially
adjacent to its parent surface.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L24)

## Members

- [`size`](#struct_field-size)
- [`deflate`](#struct_field-deflate)
- [`anchor_rectangle`](#struct_field-anchor_rectangle)
- [`constraint_adjustment`](#struct_field-constraint_adjustment)
- [`offset`](#struct_field-offset)
- [`anchor`](#function-anchor)
- [`set_anchor`](#function-set_anchor)
- [`gravity`](#function-gravity)
- [`set_gravity`](#function-set_gravity)

<a id="struct_field-size"></a>

### size

```rust
size: ferroui_base::Size
```

The size of the popup that is to be positioned with the positioner
object, in device-independent pixels.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L30)

<a id="struct_field-deflate"></a>

### deflate

```rust
deflate: ferroui_base::Thickness
```

How far to deflate `size` when positioning the popup.

This is normally set to the margin of the popup's child. This allows
out-of-bounds effects like drop shadows to be drawn without affecting
the final position of the child.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L37)

<a id="struct_field-anchor_rectangle"></a>

### anchor_rectangle

```rust
anchor_rectangle: ferroui_base::Rect
```

Specifies the anchor rectangle within the parent that the popup will
be placed relative to, in device-independent pixels.

The rectangle is relative to the parent geometry and may not extend
outside the window geometry of the popup's parent.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L44)

<a id="struct_field-constraint_adjustment"></a>

### constraint_adjustment

```rust
constraint_adjustment: PopupPositionerConstraintAdjustment
```

Specify how the popup should be positioned if the originally
intended position caused the popup to be constrained.

Adjusts the popup position if the intended position caused the popup
to be constrained; meaning at least partially outside positioning
boundaries set by the positioner. The adjustment is set by
constructing a bitmask describing the adjustment to be made when the
popup is constrained on that axis.

If no bit for one axis is set, the positioner will assume that the
child surface should not change its position on that axis when
constrained.

If more than one bit for one axis is set, the order of how
adjustments are applied is specified in the corresponding adjustment
descriptions.

The default adjustment is none.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L64)

<a id="struct_field-offset"></a>

### offset

```rust
offset: ferroui_base::Point
```

Specify the popup position offset relative to the position of the
anchor on the anchor rectangle and the anchor on the popup.

For example if the anchor of the anchor rectangle is at (x, y), the
popup has the gravity bottom|right, and the offset is (ox, oy), the
calculated surface position will be (x + ox, y + oy). The offset
position of the surface is the one used for constraint testing. See
`constraint_adjustment`.

An example use case is placing a popup menu on top of a user
interface element, while aligning the user interface element of the
parent surface with some user interface element placed somewhere in
the popup.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L79)

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

### anchor

```rust
fn anchor(self: &Self) -> PopupAnchor
```

Gets the anchor point for the anchor rectangle.

The specified anchor is used derive an anchor point that the popup
will be positioned relative to. If a corner anchor is set (e.g.
'TopLeft' or 'BottomRight'), the anchor point will be at the
specified corner; otherwise, the derived anchor point will be
centered on the specified edge, or in the center of the anchor
rectangle if no edge is specified.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L91)

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

### set_anchor

```rust
fn set_anchor(self: &mut Self, value: PopupAnchor)
```

Defines the anchor point for the anchor rectangle.
## Panics

Panics when opposite edges are specified.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L100)

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

### gravity

```rust
fn gravity(self: &Self) -> PopupGravity
```

Gets in what direction a popup should be positioned, relative to the
anchor point of the parent.

If a corner gravity is specified (e.g. 'BottomRight' or 'TopLeft'),
then the popup will be placed towards the specified gravity;
otherwise, the popup will be centered over the anchor point on any
axis that had no gravity specified.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L112)

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

### set_gravity

```rust
fn set_gravity(self: &mut Self, value: PopupGravity)
```

Defines in what direction a popup should be positioned, relative to
the anchor point of the parent.
## Panics

Panics when opposite edges are specified.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/primitives/popup_positioning/i_popup_positioner.rs#L122)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Copy`
- `Debug`
- `Default`
- `StructuralPartialEq`
- `PartialEq`

## Availability

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