Class AnchorPopup<T>
Base class for Popup that can be anchored to another UI Element.
Inherited Members
Namespace: UnityEngine.Dt.App.UI
Syntax
public abstract class AnchorPopup<T> : Popup<T> where T : AnchorPopup<T>
Type Parameters
Name | Description |
---|---|
T | The sealed anchor popup class type. |
Constructors
AnchorPopup(VisualElement, ApplicationContext, VisualElement, VisualElement)
Default constructor.
Declaration
protected AnchorPopup(VisualElement parentView, ApplicationContext context, VisualElement view, VisualElement contentView = null)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | parentView | The popup container. |
ApplicationContext | context | The application context attached to this popup. |
VisualElement | view | The popup visual element itself. |
VisualElement | contentView | The content that will appear inside this popup. |
Properties
anchor
The popup's anchor.
Declaration
public VisualElement anchor { get; }
Property Value
Type | Description |
---|---|
VisualElement |
arrowVisible
True
if the small arrow used next to the anchor should be visible, False
otherwise.
Declaration
public bool arrowVisible { get; }
Property Value
Type | Description |
---|---|
Boolean |
containerPadding
The padding in pixels, inside the popup panel's container.
Declaration
public int containerPadding { get; }
Property Value
Type | Description |
---|---|
Int32 |
crossOffset
The offset in pixels, in the direction of the secondary placement vector.
Declaration
public int crossOffset { get; }
Property Value
Type | Description |
---|---|
Int32 |
currentPlacement
The current placement.
Declaration
public PopoverPlacement currentPlacement { get; }
Property Value
Type | Description |
---|---|
PopoverPlacement |
offset
The offset in pixels, in the direction of the primary placement vector.
Declaration
public int offset { get; }
Property Value
Type | Description |
---|---|
Int32 |
outsideClickDismissEnabled
True
if the the popup can be dismissed by clicking outside of it, False
otherwise.
Declaration
public bool outsideClickDismissEnabled { get; protected set; }
Property Value
Type | Description |
---|---|
Boolean |
placement
The desired placement.
Declaration
public PopoverPlacement placement { get; }
Property Value
Type | Description |
---|---|
PopoverPlacement |
shouldFlip
True
if the popup will be displayed at the opposite position if there's not enough
place using the preferred placement, False
otherwise.
Declaration
public bool shouldFlip { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
AnimateViewIn()
Start the animation for this popup.
Declaration
protected override void AnimateViewIn()
Overrides
AnimateViewOut(DismissType)
Start the hide animation for this popup.
Declaration
protected override void AnimateViewOut(DismissType reason)
Parameters
Type | Name | Description |
---|---|---|
DismissType | reason |
Overrides
ComputePosition(VisualElement, VisualElement, Panel, PopoverPlacement, Int32, Int32, Boolean, Boolean)
This method will return the possible position of UI element based on a specific context.
Declaration
public static PositionResult ComputePosition(VisualElement element, VisualElement anchor, Panel panel, PopoverPlacement favoritePlacement = PopoverPlacement.Bottom, int offset = 0, int crossOffset = 0, bool shouldFlip = true, bool crossSnap = true)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | element | The element which needs to be positioned |
VisualElement | anchor | The element used as an anchor for the element. |
Panel | panel | The panel containing elements. |
PopoverPlacement | favoritePlacement | The preferred placement. |
Int32 | offset | An offset in the direction of the primary placement vector. |
Int32 | crossOffset | An offset in the direction of the secondary placement vector. |
Boolean | shouldFlip |
|
Boolean | crossSnap |
|
Returns
Type | Description |
---|---|
PositionResult | The computed position. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The provided |
GetMovableElement()
Method which must return the visual element that needs to be moved, based on the anchor position and size.
Declaration
protected virtual VisualElement GetMovableElement()
Returns
Type | Description |
---|---|
VisualElement | The visual element which will be moved. The default value is view. |
HideView(DismissType)
Called when the popup's Handler has received a k_PopupDismiss message.
Declaration
protected override void HideView(DismissType reason)
Parameters
Type | Name | Description |
---|---|---|
DismissType | reason | The reason why the popup should be dismissed. |
Overrides
InvokeDismissedEventHandlers(DismissType)
Called when the popup has been dismissed. This method will invoke any handlers attached to the dismissed event.
Declaration
protected override void InvokeDismissedEventHandlers(DismissType reason)
Parameters
Type | Name | Description |
---|---|---|
DismissType | reason | The reason for the dismissal. |
Overrides
RefreshPosition()
Recompute the position of the popup based on the anchor's position and size, but also others properties such as the offset, crossOffset, shouldFlip and placement.
Declaration
protected void RefreshPosition()
SetAnchor(VisualElement)
Set a new value for the anchor property.
Declaration
public T SetAnchor(VisualElement value)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | value | The new value. |
Returns
Type | Description |
---|---|
T | The popup. |
SetArrowVisible(Boolean)
Set a new value for the arrowVisible property.
Declaration
public T SetArrowVisible(bool visible)
Parameters
Type | Name | Description |
---|---|---|
Boolean | visible | The new value. |
Returns
Type | Description |
---|---|
T | The popup. |
SetContainerPadding(Int32)
Set a new value for the containerPadding property.
Declaration
public T SetContainerPadding(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The new value. |
Returns
Type | Description |
---|---|
T | The popup. |
SetCrossOffset(Int32)
Set a new value for the crossOffset property.
Declaration
public T SetCrossOffset(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The new value. |
Returns
Type | Description |
---|---|
T | The popup. |
SetOffset(Int32)
Set a new value for the offset property.
Declaration
public T SetOffset(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The new value. |
Returns
Type | Description |
---|---|
T | The popup. |
SetOutsideClickDismiss(Boolean)
Activate the possibility to dismiss the popup by clicking outside of it.
Declaration
public T SetOutsideClickDismiss(bool dismissEnabled)
Parameters
Type | Name | Description |
---|---|---|
Boolean | dismissEnabled |
|
Returns
Type | Description |
---|---|
T | The popup of type |
SetPlacement(PopoverPlacement)
Set the preferred placement value.
Declaration
public T SetPlacement(PopoverPlacement popoverPlacement)
Parameters
Type | Name | Description |
---|---|---|
PopoverPlacement | popoverPlacement | The new value. |
Returns
Type | Description |
---|---|
T | The popup. |
SetShouldFlip(Boolean)
Set a new value for the shouldFlip property.
Declaration
public T SetShouldFlip(bool value)
Parameters
Type | Name | Description |
---|---|---|
Boolean | value | The new value. |
Returns
Type | Description |
---|---|
T | The popup. |
ShouldDismiss(DismissType)
Returns True
if the popup should be dismissed, False
otherwise.
Declaration
protected override bool ShouldDismiss(DismissType reason)
Parameters
Type | Name | Description |
---|---|---|
DismissType | reason | The reason for the dismissal. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
ShowView()
Called when the popup's Handler has received a k_PopupShow message.
Declaration
protected override void ShowView()