Interface Popup
- All Superinterfaces:
Proxy
- All Known Implementing Classes:
Popup.Popup$Impl
The GdkPopup is positioned relative to its parent surface.
GdkPopups are typically used to implement menus and similar popups.
They can be modal, which is indicated by the Gdk.Popup:autohide
property.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacePopup.Builder<B extends Builder<B>>static classThe Popup$Impl type represents a native instance of the Popup interface.static class -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanReturns whether this popup is set to hide on outside clicks.default @Nullable SurfaceReturns the parent surface of a popup.default intObtains the position of the popup relative to its parent.default intObtains the position of the popup relative to its parent.default GravityGets the current popup rectangle anchor.default GravityGets the current popup surface anchor.static @Nullable TypegetType()Get the GType of the Popup classdefault booleanpresent(int width, int height, PopupLayout layout) Present this Popup after having processed theGdkPopupLayoutrules.
-
Method Details
-
getType
-
getAutohide
default boolean getAutohide()Returns whether this popup is set to hide on outside clicks.- Returns:
trueif this Popup will autohide
-
getParent
Returns the parent surface of a popup.- Returns:
- the parent surface
-
getPositionX
default int getPositionX()Obtains the position of the popup relative to its parent.- Returns:
- the X coordinate of this Popup position
-
getPositionY
default int getPositionY()Obtains the position of the popup relative to its parent.- Returns:
- the Y coordinate of this Popup position
-
getRectAnchor
Gets the current popup rectangle anchor.The value returned may change after calling
present(int, int, org.gnome.gdk.PopupLayout), or after theGdk.Surface::layoutsignal is emitted.- Returns:
- the current rectangle anchor value of this Popup
-
getSurfaceAnchor
Gets the current popup surface anchor.The value returned may change after calling
present(int, int, org.gnome.gdk.PopupLayout), or after theGdk.Surface::layoutsignal is emitted.- Returns:
- the current surface anchor value of this Popup
-
present
Present this Popup after having processed theGdkPopupLayoutrules.If the popup was previously not showing, it will be shown, otherwise it will change position according to
layout.After calling this function, the result should be handled in response to the
Gdk.Surface::layoutsignal being emitted. The resulting popup position can be queried usinggetPositionX(),getPositionY(), and the resulting size will be sent as parameters in the layout signal. UsegetRectAnchor()andgetSurfaceAnchor()to get the resulting anchors.Presenting may fail, for example if the this Popup is set to autohide and is immediately hidden upon being presented. If presenting failed, the
Gdk.Surface::layoutsignal will not me emitted.- Parameters:
width- the unconstrained popup width to layoutheight- the unconstrained popup height to layoutlayout- theGdkPopupLayoutobject used to layout- Returns:
falseif it failed to be presented, otherwisetrue.
-