Package tripleplay.ui
Class MenuHost
java.lang.Object
tripleplay.ui.MenuHost
Provides a context for popping up a menu.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An event type for triggering a menu popup.static interface
Defines how to obtain the point on a trigger where a menu popup originates. -
Field Summary
Modifier and TypeFieldDescriptionfinal Interface
The interface we use to create the menu's root and do animation.The point on the menu that should be placed directly on top of the trigger point, subject to bounding constraints.final GroupLayer
The root layer that will contain all menus that pop up.static final Style<MenuHost.TriggerPoint>
The point on an element where menus should be placed, subject to boundary constraints. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MenuHost.TriggerPoint
absolute
(float x, float y) Gets a fixed trigger point for the given screen coordinates.active()
void
Deactivates the current menu, if any is showing.pythagoras.f.IRectangle
Gets the area to which menus should be confined when there isn't any other associated bounds.static MenuHost.TriggerPoint
pointer()
Gets a trigger point exactly under the pointer position.void
popup
(MenuHost.Pop pop) Displays the menu specified by the given pop, incorporating all the configured attributes therein.static MenuHost.TriggerPoint
Gets a trigger point relative to an element using the given box point.static react.Closeable
relayEvents
(Layer from, Menu to) void
setScreenArea
(pythagoras.f.IRectangle screenArea) Sets the area to which menus should be confined when there isn't any other associated bounds.setStylesheet
(Stylesheet sheet) Sets the stylesheet for menus popped by this host.
-
Field Details
-
TRIGGER_POINT
The point on an element where menus should be placed, subject to boundary constraints. This is only used if the element is set to aMenuHost.Pop.trigger
. By default, uses the top left corner of the trigger. -
POPUP_ORIGIN
The point on the menu that should be placed directly on top of the trigger point, subject to bounding constraints. This is only used if the element is set to aMenuHost.Pop.trigger
. By default, the top, left corner is the origin. -
rootLayer
The root layer that will contain all menus that pop up. It should normally be close to the top of the hierarchy so that it draws on top of everything. -
iface
The interface we use to create the menu's root and do animation.
-
-
Constructor Details
-
MenuHost
Creates a menu host using the given values. The root layer is set to the layer of the given root and the stylesheet to its stylesheet. -
MenuHost
Creates a new menu host using the given values. The stylesheet is set to an empty one and can be changed via thesetStylesheet(Stylesheet)
method.
-
-
Method Details
-
relative
Gets a trigger point relative to an element using the given box point. -
absolute
Gets a fixed trigger point for the given screen coordinates. -
pointer
Gets a trigger point exactly under the pointer position. -
relayEvents
-
setStylesheet
Sets the stylesheet for menus popped by this host. -
deactivate
public void deactivate()Deactivates the current menu, if any is showing. -
setScreenArea
public void setScreenArea(pythagoras.f.IRectangle screenArea) Sets the area to which menus should be confined when there isn't any other associated bounds. -
getScreenArea
public pythagoras.f.IRectangle getScreenArea()Gets the area to which menus should be confined when there isn't any other associated bounds. By default, the entire available area is used, as given byGraphics
. -
popup
Displays the menu specified by the given pop, incorporating all the configured attributes therein. -
activePop
-
active
-