Popup
struct · ferroui-controls · v0.5.0
struct Popup
Displays a popup window.
Members
TYPEto_refwindow_manager_add_shadow_hint_propertychild_propertyinherits_transform_propertyis_open_propertyplacement_anchor_propertyplacement_constraint_adjustment_propertyplacement_gravity_propertyplacement_propertyplacement_rect_propertyplacement_target_propertycustom_popup_placement_callback_propertyoverlay_dismiss_event_pass_through_propertyoverlay_input_pass_through_element_propertyhorizontal_offset_propertyis_light_dismiss_enabled_propertyvertical_offset_propertytopmost_propertytakes_focus_from_native_control_propertyshould_use_overlay_layer_propertyis_using_overlay_layer_propertyconstructnewclosedopenedclosingpopup_host_changedhostopened_popupswindow_manager_add_shadow_hintset_window_manager_add_shadow_hintchildset_childdependency_resolverset_dependency_resolverinherits_transformset_inherits_transformis_light_dismiss_enabledset_is_light_dismiss_enabledis_openset_is_openplacement_anchorset_placement_anchorplacement_constraint_adjustmentset_placement_constraint_adjustmentplacement_gravityset_placement_gravityplacementset_placementplacement_rectset_placement_rectplacement_targetset_placement_targetcustom_popup_placement_callbackset_custom_popup_placement_callbackoverlay_dismiss_event_pass_throughset_overlay_dismiss_event_pass_throughoverlay_input_pass_through_elementset_overlay_input_pass_through_elementhorizontal_offsetset_horizontal_offsetvertical_offsetset_vertical_offsettopmostset_topmosttakes_focus_from_native_controlset_takes_focus_from_native_controlshould_use_overlay_layerset_should_use_overlay_layeris_using_overlay_layeropencloseget_takes_focus_from_native_controlset_takes_focus_from_native_control_onset_popup_parentis_inside_popupis_pointer_over_popupto_popup_host_provideradd_opened_popupremove_opened_popup
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<Popup>
Returns a strong reference to this object.
window_manager_add_shadow_hint_property
fn window_manager_add_shadow_hint_property() -> &'static StyledProperty<bool>
Defines the WindowManagerAddShadowHint property.
child_property
fn child_property() -> &'static StyledProperty<Option<Ref<Control>>>
Defines the Child property.
inherits_transform_property
fn inherits_transform_property() -> &'static StyledProperty<bool>
Defines the InheritsTransform property.
is_open_property
fn is_open_property() -> &'static StyledProperty<bool>
Defines the IsOpen property.
placement_anchor_property
fn placement_anchor_property() -> &'static StyledProperty<PopupAnchor>
Defines the PlacementAnchor property.
placement_constraint_adjustment_property
fn placement_constraint_adjustment_property() -> &'static StyledProperty<PopupPositionerConstraintAdjustment>
Defines the PlacementConstraintAdjustment property.
placement_gravity_property
fn placement_gravity_property() -> &'static StyledProperty<PopupGravity>
Defines the PlacementGravity property.
placement_property
fn placement_property() -> &'static StyledProperty<PlacementMode>
Defines the Placement property.
placement_rect_property
fn placement_rect_property() -> &'static StyledProperty<Option<Rect>>
Defines the PlacementRect property.
placement_target_property
fn placement_target_property() -> &'static StyledProperty<Option<ElementRef<Control>>>
Defines the PlacementTarget property.
The popup does not own its placement target (it is usually an ancestor of the popup), so the value is an element reference.
custom_popup_placement_callback_property
fn custom_popup_placement_callback_property() -> &'static StyledProperty<Option<CustomPopupPlacementCallbackValue>>
Defines the CustomPopupPlacementCallback property.
overlay_dismiss_event_pass_through_property
fn overlay_dismiss_event_pass_through_property() -> &'static StyledProperty<bool>
Defines the OverlayDismissEventPassThrough property.
overlay_input_pass_through_element_property
fn overlay_input_pass_through_element_property() -> &'static StyledProperty<Option<ElementRef<InputElement>>>
Defines the OverlayInputPassThroughElement property.
horizontal_offset_property
fn horizontal_offset_property() -> &'static StyledProperty<f64>
Defines the HorizontalOffset property.
is_light_dismiss_enabled_property
fn is_light_dismiss_enabled_property() -> &'static StyledProperty<bool>
Defines the IsLightDismissEnabled property.
vertical_offset_property
fn vertical_offset_property() -> &'static StyledProperty<f64>
Defines the VerticalOffset property.
topmost_property
fn topmost_property() -> &'static StyledProperty<bool>
Defines the Topmost property.
takes_focus_from_native_control_property
fn takes_focus_from_native_control_property() -> &'static AttachedProperty<bool>
Defines the TakesFocusFromNativeControl property.
should_use_overlay_layer_property
fn should_use_overlay_layer_property() -> &'static StyledProperty<bool>
Defines the ShouldUseOverlayLayer property.
is_using_overlay_layer_property
fn is_using_overlay_layer_property() -> &'static DirectProperty<Popup, bool>
Defines the IsUsingOverlayLayer property.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
closed
fn closed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Raised when the popup closes.
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the popup.
opened
fn opened(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Raised when the popup opens.
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the popup.
closing
fn closing(self: &Self, handler: impl Fn(&CancelEventArgs) -> () + 'static) -> Subscription
Raised before the popup closes; the close can be cancelled (internal upstream).
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the popup.
popup_host_changed
fn popup_host_changed(self: &Self, handler: impl Fn(Option<&Rc<dyn IPopupHost>>) -> () + 'static) -> Subscription
Raised when the popup host changes (the popup host provider contract).
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the popup.
host
fn host(self: &Self) -> Option<Rc<dyn IPopupHost>>
The host of the open popup (internal upstream).
opened_popups
fn opened_popups(self: &Self) -> Vec<Ref<Popup>>
The popups that are currently open directly inside this popup, in the order they were opened.
window_manager_add_shadow_hint
fn window_manager_add_shadow_hint(self: &Self) -> bool
A hint to the window manager that a shadow should be added to the popup.
set_window_manager_add_shadow_hint
fn set_window_manager_add_shadow_hint(self: &Self, value: bool)
child
fn child(self: &Self) -> Option<Ref<Control>>
The control to display in the popup.
set_child
fn set_child(self: &Self, value: impl Into<Nullable<Control>>)
dependency_resolver
fn dependency_resolver(self: &Self) -> Option<Rc<dyn IFerroDependencyResolver>>
A dependency resolver for the PopupRoot.
This property allows a client to customize the behaviour of the
popup by injecting a specialized dependency resolver into the
PopupRoot's constructor.
set_dependency_resolver
fn set_dependency_resolver(self: &Self, value: Option<Rc<dyn IFerroDependencyResolver>>)
inherits_transform
fn inherits_transform(self: &Self) -> bool
Determines whether the popup inherits the render transform from its placement target. Defaults to false.
set_inherits_transform
fn set_inherits_transform(self: &Self, value: bool)
is_light_dismiss_enabled
fn is_light_dismiss_enabled(self: &Self) -> bool
Determines how the popup can be dismissed.
Light dismiss is when the user taps on any area other than the popup.
set_is_light_dismiss_enabled
fn set_is_light_dismiss_enabled(self: &Self, value: bool)
is_open
fn is_open(self: &Self) -> bool
Whether the popup is currently open.
set_is_open
fn set_is_open(self: &Self, value: bool)
placement_anchor
fn placement_anchor(self: &Self) -> PopupAnchor
The anchor point on the placement rect when the placement is
PlacementMode::AnchorAndGravity.
set_placement_anchor
fn set_placement_anchor(self: &Self, value: PopupAnchor)
placement_constraint_adjustment
fn placement_constraint_adjustment(self: &Self) -> PopupPositionerConstraintAdjustment
Describes how the popup position will be adjusted if the unadjusted position would result in the popup being partly constrained.
set_placement_constraint_adjustment
fn set_placement_constraint_adjustment(self: &Self, value: PopupPositionerConstraintAdjustment)
placement_gravity
fn placement_gravity(self: &Self) -> PopupGravity
Defines in what direction the popup should open when the placement
is PlacementMode::AnchorAndGravity.
set_placement_gravity
fn set_placement_gravity(self: &Self, value: PopupGravity)
placement
fn placement(self: &Self) -> PlacementMode
The desired placement of the popup in relation to the placement target.
set_placement
fn set_placement(self: &Self, value: PlacementMode)
placement_rect
fn placement_rect(self: &Self) -> Option<Rect>
The anchor rectangle within the parent that the popup will be placed
relative to when the placement is
PlacementMode::AnchorAndGravity.
The placement rect defines a rectangle relative to the placement target around which the popup will be opened, with the placement anchor determining which edge of the placement target is used.
If unset, the anchor rectangle will be the bounds of the placement target.
set_placement_rect
fn set_placement_rect(self: &Self, value: Option<Rect>)
placement_target
fn placement_target(self: &Self) -> Option<Ref<Control>>
The control that is used to determine the popup's position.
set_placement_target
fn set_placement_target(self: &Self, value: impl Into<Nullable<Control>>)
custom_popup_placement_callback
fn custom_popup_placement_callback(self: &Self) -> Option<CustomPopupPlacementCallback>
The callback that positions the popup when the placement is
PlacementMode::Custom.
set_custom_popup_placement_callback
fn set_custom_popup_placement_callback(self: &Self, value: Option<CustomPopupPlacementCallback>)
overlay_dismiss_event_pass_through
fn overlay_dismiss_event_pass_through(self: &Self) -> bool
Whether the event that closes the popup is passed through to the parent window.
When light dismiss is enabled, clicks outside the popup cause the popup to close. When this is false, these clicks will be handled by the popup and not be registered by the parent window. When true, the events will be passed through to the parent window.
set_overlay_dismiss_event_pass_through
fn set_overlay_dismiss_event_pass_through(self: &Self, value: bool)
overlay_input_pass_through_element
fn overlay_input_pass_through_element(self: &Self) -> Option<Ref<InputElement>>
An element that should receive pointer input events even when underneath the popup's overlay.
set_overlay_input_pass_through_element
fn set_overlay_input_pass_through_element(self: &Self, value: impl Into<Nullable<InputElement>>)
horizontal_offset
fn horizontal_offset(self: &Self) -> f64
The horizontal offset of the popup in relation to the placement target.
set_horizontal_offset
fn set_horizontal_offset(self: &Self, value: f64)
vertical_offset
fn vertical_offset(self: &Self) -> f64
The vertical offset of the popup in relation to the placement target.
set_vertical_offset
fn set_vertical_offset(self: &Self, value: f64)
topmost
fn topmost(self: &Self) -> bool
Whether this popup appears on top of all other windows.
set_topmost
fn set_topmost(self: &Self, value: bool)
takes_focus_from_native_control
fn takes_focus_from_native_control(self: &Self) -> bool
Whether the popup, on show, transfers focus from any focused native
control to the toolkit. The default is true.
This property only applies to advanced native control embedding
scenarios. By default, if a popup is shown when a native control is
focused, focus is transferred back to the toolkit in order for the
popup to receive input. If this property is set to false, then the
shown popup will not receive input until it receives an interaction
which explicitly focuses the popup, such as a mouse click.
set_takes_focus_from_native_control
fn set_takes_focus_from_native_control(self: &Self, value: bool)
should_use_overlay_layer
fn should_use_overlay_layer(self: &Self) -> bool
Whether the popup should be shown in the overlay layer of the parent window.
When this is false the implementation depends on the platform. Use
is_using_overlay_layer to get the
actual popup behavior. This is an equivalent of the overlay popups
platform option, but settable independently per each popup.
set_should_use_overlay_layer
fn set_should_use_overlay_layer(self: &Self, value: bool)
is_using_overlay_layer
fn is_using_overlay_layer(self: &Self) -> bool
Whether the popup is shown in the overlay layer of the parent window.
open
fn open(self: &Self)
Opens the popup.
close
fn close(self: &Self)
Closes the popup.
get_takes_focus_from_native_control
fn get_takes_focus_from_native_control(control: &Control) -> bool
Gets the value of the TakesFocusFromNativeControl attached
property on the specified control.
set_takes_focus_from_native_control_on
fn set_takes_focus_from_native_control_on(control: &Control, value: bool)
Sets the value of the TakesFocusFromNativeControl attached
property on the specified control.
set_popup_parent
fn set_popup_parent(self: &Self, new_parent: Option<&Ref<Control>>)
Helper method to set popup's styling and templated parent (internal upstream).
is_inside_popup
fn is_inside_popup(self: &Self, visual: &Visual) -> bool
Whether visual is inside the open popup.
is_pointer_over_popup
fn is_pointer_over_popup(self: &Self) -> bool
Whether the pointer is over the open popup.
to_popup_host_provider
fn to_popup_host_provider(self: &Self) -> Rc<dyn IPopupHostProvider>
The popup as a popup host provider (the diagnostics contract it implements upstream).
add_opened_popup
fn add_opened_popup(self: &Self, popup: &Ref<Popup>)
Records a popup opened directly inside this popup (internal upstream).
remove_opened_popup
fn remove_opened_popup(self: &Self, popup: &Ref<Popup>)
Forgets a popup opened directly inside this popup (internal upstream).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeControlImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<Popup>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleInteractiveImplInputElementImplControlImplFerroObjectImplStyledElementImplVisualImplLayoutableImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.