<abstract> new Element(uiProxyObject)
Creates an Element
instance.
Parameters:
Name | Type | Description |
---|---|---|
uiProxyObject |
olympe.df.Proxy.<olympe.uiapi.std.Element> | olympe.uiapi.std.Element | the proxy element to associate with. |
Extends
- olympe.ui.UIElement
Members
-
<non-null> mouseEventManager :olympe.ui.events.MouseEventManager
-
Type:
Methods
-
applyTheme(theme)
-
Changes the theme to use with this
Element
.Convenience method for classes which inherit from
Element
and use a theme so they don't need to apply Element theme properties themselves. Good practice is to override this method in all classes which support theme and may be subclassed.Parameters:
Name Type Description theme
olympe.ui.std.theme.ElementTheme The theme.
-
<abstract> getAbsolutePosition()
-
Returns the absolute position of this
Element
.This method must be implemented by Element descendants.
Returns:
Absolute position of this Element.
- Type
- olympe.df.PVector2
-
<abstract> getDimension()
-
Gets the dimension (width, height) of this
Element
.Returns:
Dimension of element.
- Type
- olympe.df.PVector2
-
getEventClickOrTap()
-
Gets the 'Click' or 'Tap' events.
Returns:
Data flow for mouse events.
-
getEventDoubleClick()
-
Gets the 'Double click' events. These events are generated when the mouse button is clicked twice in rapid succession.
Returns:
Dataflow for double click events
-
getEventHorizontalPan()
-
Gets the 'Horizontal Pan' events.
Horizontal Pan is a touch move / mousedown+mousemove performed horizontally
Returns:
Data flow of gesture events
-
getEventHorizontalSwipe()
-
Gets the 'Horizontal Swipe' events.
Horizontal Swipe is quick touch move + released / mouse move + released performed horizontally.
Returns:
Data flow of gesture events
-
getEventLongPress( [time])
-
Gets the 'Long Press' events.
LongPress gesture is a long mouse down or a long touch down (250ms).
Parameters:
Name Type Argument Default Description time
number <optional>
250 Time needed to press before emitting the event.
Returns:
Data flow of gesture events
-
getEventLongPressUp()
-
Gets the 'Long Press Up' events.
Long Press Up event is a touch down performed during 250ms on this element and released.
Returns:
Data flow of gesture events
-
getEventMouseDown()
-
Gets then 'Mouse Down' events.
Returns:
Dataflow of mouse down events
-
getEventMouseEnter()
-
Gets the 'Mouse Enter' events. These events are generated when the pointer enters the bounding box of the element.
Returns:
Dataflow of mouse enter events
-
getEventMouseLeave()
-
Gets the 'Mouse Leave' events. These events are generated when the pointer leaves the bounding box of the element.
Returns:
Dataflow of mouse leave events
-
getEventMouseMove()
-
Gets the 'Mouse Move' events.
Returns:
Dataflow of mouse moves events
-
getEventMouseOver()
-
Gets the 'Mouse Over' events.
Returns:
Dataflow of mouse moves events
-
getEventMouseUp()
-
Gets the 'Mouse Up' events.
- Implements:
Returns:
Dataflow of mouse up events
-
getEventMouseWheel()
-
Gets the 'Mouse Wheel' events.
Returns:
Dataflow of mouse wheel events
-
getEventPinch()
-
Gets the 'Pinch' events.
Pinch gesture is a two fingers touchdown typically used to zoom in or out.
- Implements:
Returns:
Data flow of gesture events
-
getEventRotate()
-
Gets the 'Rotate' events.
Rotate gesture is a two fingers touchdown rotation.
- Implements:
Returns:
Data flow of gesture events
-
getEventTouchCancel()
-
Gets the 'Touch Cancel' events.
Returns:
Dataflow of touch cancel events
-
getEventTouchEnd()
-
Gets the 'Touch End' events.
- Implements:
Returns:
Dataflow of touch end events
-
getEventTouchMove()
-
Gets the 'Touch Move' events.
Returns:
Dataflow of touch move events
-
getEventTouchStart()
-
Gets the 'Touch Start' events.
Returns:
Dataflow of touch start events
-
getEventVerticalPan()
-
Gets the 'Vertical Pan' events.
Vertical Pan is a touch move / mousedown+mousemove performed vertically
Returns:
Data flow of gesture events
-
getEventVerticalSwipe()
-
Gets the 'Vertical Swipe' events.
Vertical Swipe is quick touch move + released / mouse move + released performed vertically.
Returns:
Data flow of gesture events
-
getFocus()
-
Checks whether this
Element
has the focus.Warning: Focus may not be applicable on some elements, depending on the platform.
Returns:
true
if Element has focus.- Type
- olympe.df.POBoolean
-
<protected> getGestureEvent()
-
Gets the gesture event manager attached to this element
Returns:
-
getHTMLElement()
-
Return the DOM HTMLElement if exists (may be null)
Returns:
- Type
- Element
-
<protected> getMouseEvent()
-
Gets the mouse event manager attached to this element.
Returns:
the mouse event manager.
-
getMoveEvent()
-
Gets the 'Move' events. These events are generated when the mouse moves.
- Implements:
Returns:
-
<protected> getUIProxyElement()
-
Returns the native UI element associated with this
Element
.Returns:
The proxy element from the UI thread.
- Type
- olympe.uiapi.std.Element
-
isHidden()
-
Checks whether this
Element
is hidden.Returns:
true
is this element is hidden.- Type
- olympe.df.POBoolean
-
isMouseDown()
-
Checks whether the mouse button is pressed down.
- Implements:
Returns:
True if a mouse button is down on this object
- Type
- olympe.df.POBoolean
-
isMouseOver()
-
Checks whether the pointer is over this element.
- Implements:
Returns:
True if mouse is over object
- Type
- olympe.df.POBoolean
-
isMouseUp()
-
Checks whether the mouse button is not pressed down.
- Implements:
Returns:
True if a mouse button is up on this object
- Type
- olympe.df.POBoolean
-
offClickOrTap(id)
-
Unregisters a callback for 'click or tap' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onClickOrTap
)- Implements:
-
offDoubleClick(id)
-
Unregisters a callback for 'Double Click' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onClickOrTap
)- Implements:
-
offHorizontalPan(id)
-
Unregisters a callback from the 'Horizontal Pan' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onHorizontalPan
) -
offHorizontalSwipe(id)
-
Unregisters a callback from the 'Horizontal Swipe' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onHorizontalSwipe
) -
offLongPress(id)
-
Unregisters a callback from the 'Long Press' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onLongPress
)- Implements:
-
offLongPressUp(id)
-
Unregisters a callback from the 'Long Press Up' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onLongPressUp
)- Implements:
-
offMouseDown(id)
-
Unregisters a callback for 'Mouse Down' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMouseDown
)- Implements:
-
offMouseEnter(id)
-
Unregisters a callback for 'Mouse Enter' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMouseEnter
)- Implements:
-
offMouseLeave(id)
-
Unregisters a callback for 'Mouse Leave' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMouseLeave
)- Implements:
-
offMouseMove(id)
-
Unregisters a callback for 'Mouse Move' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMouseMove
)- Implements:
-
offMouseOver(id)
-
Unregisters a callback for 'Mouse Over' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMouseOver
)- Implements:
-
offMouseUp(id)
-
Unregisters a callback for 'Mouse Up' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMouseUp
)- Implements:
-
offMouseWheel(id)
-
Unregisters a callback for 'Mouse Wheel' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMouseWheel
)- Implements:
-
offMoveEnd(id)
-
Unregisters a callback for 'Move End' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMoveEnd
)- Implements:
-
offMoveStart(id)
-
Unregisters a callback for 'Move Start' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onMoveStart
)- Implements:
-
offPinch(id)
-
Unregisters a callback from the 'Pinch' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onPinch
)- Implements:
-
offRotate(id)
-
Unregisters a callback from the 'Rotate' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onRotate
)- Implements:
-
offTouchCancel(id)
-
Unregisters a callback for 'Touch Cancel' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onTouchCancel
)- Implements:
-
offTouchEnd(id)
-
Unregisters a callback for 'Touch End' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onTouchEnd
)- Implements:
-
offTouchMove(id)
-
Unregisters a callback for 'Touch Move' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onTouchMove
)- Implements:
-
offTouchStart(id)
-
Unregisters a callback for 'Touch Start' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onTouchStart
)- Implements:
-
offVerticalPan(id)
-
Unregisters a callback from the 'Vertical Pan' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onVerticalPan
)- Implements:
-
offVerticalSwipe(id)
-
Unregisters a callback from the 'Vertical Swipe' events.
Parameters:
Name Type Description id
string ID of callback (returned by
onVerticalSwipe
) -
onClickOrTap(callback [, id] [, priority])
-
Registers a callback for 'click or tap' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMouseEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onDoubleClick(callback [, id] [, priority])
-
Registers a callback for 'Double Click' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMouseEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onHorizontalPan(callback [, id] [, priority])
-
Registers a callback for the 'Horizontal Pan' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnGestureEventCallback id
string <optional>
Id of event auto-generated if omitted, necessary to unregister
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
- See:
Returns:
Id of the callback
- Type
- string
-
onHorizontalSwipe(callback [, id] [, priority])
-
Registers a callback for the 'Horizontal Swipe' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnGestureEventCallback id
string <optional>
Id of event auto-generated if omitted, necessary to unregister
priority
number <optional>
0 Priority of event (higher number = higher priority)
Returns:
Id of the callback
- Type
- string
-
onLongPress(callback [, id] [, priority] [, time])
-
Registers a callback for 'Long Press' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnGestureEventCallback id
string <optional>
Id of event auto-generated if omitted, necessary to unregister
priority
number <optional>
0 Priority of event (higher number = higher priority)
time
number <optional>
250 Time needed to press before emitting the event.
- Implements:
- See:
Returns:
Id of the callback
- Type
- string
-
onLongPressUp(callback [, id] [, priority])
-
Registers a callback for 'Long Press Up' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnGestureEventCallback id
string <optional>
Id of event auto-generated if omitted, necessary to unregister
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
- See:
Returns:
Id of the callback
- Type
- string
-
onMouseDown(callback [, id] [, priority])
-
Registers a callback for the 'Mouse Down' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMouseEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onMouseEnter(callback [, id] [, priority])
-
Registers a callback for the 'Mouse Enter' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMouseEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onMouseLeave(callback [, id] [, priority])
-
Registers a callback for the 'Mouse Leave' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMouseEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onMouseMove(callback [, id] [, priority])
-
Registers a callback for the 'Mouse Move' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMouseEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onMouseOver(callback [, id] [, priority])
-
Registers a callback for the 'Mouse Over' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMouseEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onMouseUp(callback [, id] [, priority])
-
Registers a callback for the 'Mouse Up' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMouseEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onMouseWheel(callback [, id] [, priority])
-
Registers a callback for the 'Mouse Wheel' events.
Parameters:
Name Type Argument Default Description callback
function the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onMoveEnd(callback [, id] [, priority])
-
Registers a callback for the 'Move End' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMoveEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onMoveStart(callback [, id] [, priority])
-
Registers a callback for the 'Move Start' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnMoveEventCallback the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onPinch(callback [, id] [, priority])
-
Registers a callback for 'Pinch' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnGestureEventCallback id
string <optional>
Id of event auto-generated if omitted, necessary to unregister
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
- See:
Returns:
Id of the callback
- Type
- string
-
onRotate(callback [, id] [, priority])
-
Registers a callback for 'Rotate' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnGestureEventCallback id
string <optional>
Id of event auto-generated if omitted, necessary to unregister
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
- See:
Returns:
Id of the callback
- Type
- string
-
onTouchCancel(callback [, id] [, priority])
-
Registers a callback for the 'Touch Cancel' events.
Parameters:
Name Type Argument Default Description callback
function the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onTouchEnd(callback [, id] [, priority])
-
Registers a callback for the 'Touch End' events.
Parameters:
Name Type Argument Default Description callback
function the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onTouchMove(callback [, id] [, priority])
-
Registers a callback for the 'Touch Move' events.
Parameters:
Name Type Argument Default Description callback
function the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onTouchStart(callback [, id] [, priority])
-
Registers a callback for the 'Touch Start' events.
Parameters:
Name Type Argument Default Description callback
function the function to call
id
string <optional>
Id of callback, auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onVerticalPan(callback [, id] [, priority])
-
Registers a callback for the 'Vertical Pan' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnGestureEventCallback id
string <optional>
Id of event auto-generated if omitted, necessary to unregister
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
- See:
Returns:
Id of the callback
- Type
- string
-
onVerticalSwipe(callback [, id] [, priority])
-
Registers a callback for the 'Vertical Swipe' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnGestureEventCallback id
string <optional>
Id of event auto-generated if omitted, necessary to unregister
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
- See:
-
getEventVerticalSwipe
Returns:
Id of the callback
- Type
- string
-
removeTooltip()
-
Removes the tooltip from this element.
Returns:
This element.
-
setBackgroundColor(color)
-
Sets the background color for this
Element
.Parameters:
Name Type Description color
olympe.df.Proxy | olympe.df.Node | olympe.df.Color The background color.
Returns:
this
Element
. -
setBackgroundImage(url [, sizingMode] [, positioningMode] [, size] [, position])
-
Sets the background image for this
Element
.Notes:
Parameters:
Name Type Argument Default Description url
olympe.df.POString | olympe.df.Node | string URL for the image.
sizingMode
olympe.ui.common.BackgroundImageSize | olympe.df.Proxy | olympe.df.Node <optional>
AUTO The sizing mode for the image.
positioningMode
olympe.ui.common.BackgroundImagePosition | olympe.df.Proxy | olympe.df.Node <optional>
TOPLEFT The positioning mode for this image.
size
olympe.df.Vector2 | olympe.df.Proxy | olympe.df.Node <optional>
Size, in pixel.
position
olympe.df.Vector2 | olympe.df.Proxy | olympe.df.Node <optional>
Position of the image, in pixel. (0,0) if omitted.
Returns:
this
Element
. -
setBackgroundImagePosition(position)
-
Sets the background image position for this
Element
.Parameters:
Name Type Description position
olympe.df.Vector2 | olympe.df.Proxy | olympe.df.Node The position.
Returns:
this
Element
. -
setBackgroundImagePositionMode(positionMode)
-
Sets the position mode for the background image of this
Element
.Parameters:
Name Type Description positionMode
olympe.ui.common.BackgroundImagePosition | olympe.df.Proxy | olympe.df.Node The positioning mode for this image.
Returns:
this
Element
. -
setBackgroundImageSize(size)
-
Sets the background image size for the this
Element
.Parameters:
Name Type Description size
olympe.df.Vector2 | olympe.df.Proxy | olympe.df.Node The image size, in pixels.
Returns:
this
Element
. -
setBackgroundImageSizeMode(sizeMode)
-
Sets the sizing mode for the background image of this
Element
.Parameters:
Name Type Description sizeMode
olympe.ui.common.BackgroundImageSize | olympe.df.Proxy | olympe.df.Node The sizing mode.
Returns:
this
Element
. -
setBackgroundImageSrc(src)
-
Sets the URL (or source) for the background image.
Parameters:
Name Type Description src
olympe.df.POString | olympe.df.Node | string URL for the image.
Returns:
this
Element
. -
setBlur()
-
Removes focus from this Element.
Warnings:
- Focus may not be applicable on some elements, depending on the platform.
- Elements not inside a container (screen, etc.) can't get the focus.
Returns:
this
Element
. -
setContextMenuEnabled(enabled)
-
Enable/disable context menu on this element.
Parameters:
Name Type Description enabled
boolean true
to enable the context menu,false
to disable it.Returns:
this
Element
. -
setFocus()
-
Gives the focus to this Element.
Warnings:
- Focus may not be applicable on some elements, depending on the platform.
- Elements not inside a container (screen, etc.) can't get the focus.
Returns:
this
Element
. -
setHidden(hidden)
-
Sets whether this
Element
is hidden or not. A hidden element will not appear on the screen.Parameters:
Name Type Description hidden
olympe.df.POBoolean | boolean | olympe.df.Node true
if content must be hidden,false
otherwise.Returns:
this
Element
. -
setIgnoreUserInteraction( [ignore])
-
Disables mouse events for this element. However, mouse events will target its descendants unless they are manually set to also ignore user interactions.
Parameters:
Name Type Argument Default Description ignore
boolean | olympe.df.POBoolean <optional>
false ignore
true
to make this element ignore mouse events and pass them to its children.Returns:
this
Element
. -
setOpacity(opacity)
-
Sets the opacity, or alpha channel, for this
Element
. This is a float value between 0 and 1. 0 being transparent and 1 being opaque.Parameters:
Name Type Description opacity
olympe.df.ONumber | number | olympe.df.Proxy | olympe.df.Node the opacity (between 0 and 1).
Returns:
this
Element
. -
setStyle(style, value)
-
Parameters:
Name Type Description style
string CSS style name
value
string | number CSS style value
Returns:
this
Element
. -
setTabIndex(tabIndex)
-
Sets the tab index to this
Element
. Tab Index defines the tabulation or 'next' order while going through a form.Parameters:
Name Type Description tabIndex
olympe.df.PONumber | olympe.df.ONumber | number | olympe.df.Node The tab index.
Returns:
this
Element
. -
setTooltip(text [, options])
-
Assigns a tooltip to that element that will show up when the mouse hovers over it.
Parameters:
Name Type Argument Description text
olympe.df.POString The text of the tooltip.
options
Object <optional>
Various options for displaying the tooltip.
Properties
Name Type Argument Description position
olympe.df.PVector2 <optional>
The absolute position of the tooltip.
background
olympe.df.PColor <optional>
The background color.
foreground
olympe.df.PColor <optional>
The text color.
fontSize
olympe.df.PONumber <optional>
The font size.
borderSize
olympe.df.PONumber <optional>
The size of the border. Default is 1.
borderColor
olympe.df.PColor <optional>
The color of the border. Default is black.
delay
olympe.df.ONumber | number <optional>
The delay, in milliseconds, before showing the tooltip. Default is 500.
startingPos
olympe.df.Vector2 <optional>
The starting position of the mouse. Default is (0,0).
theme
olympe.df.POString <optional>
The theme class to apply to this tooltip.
Returns:
This Element.