FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    PopupPositionerParameters

    struct · ferroui-controls · v0.5.0

    struct PopupPositionerParameters
    

    Provides positioning parameters to 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

    Members

    size

    size: ferroui_base::Size
    

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

    Source

    deflate

    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

    anchor_rectangle

    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

    constraint_adjustment

    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

    offset

    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

    anchor

    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

    set_anchor

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

    Defines the anchor point for the anchor rectangle.

    Panics

    Panics when opposite edges are specified.

    Source

    gravity

    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

    set_gravity

    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

    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
    • AnyValue
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • Clone
    • Copy
    • Debug
    • Default
    • StructuralPartialEq
    • PartialEq

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.