new RootElement(uiManager)
Creates an instance of RootElement
.
Parameters:
Name | Type | Description |
---|---|---|
uiManager |
olympe.ui.Manager | The UI manager. |
- Implements:
- See:
-
olympe.ui.Manager#getRootElement
Extends
Methods
-
addCSSLink(url)
-
Adds a CSS link to the document.
Parameters:
Name Type Description url
string The URL pointing to the CSS.
Returns:
This RootElement.
-
appendChild(child, childId [, position])
-
Adds a child to this
RootElement
.Parameters:
Name Type Argument Description child
olympe.ui.std.DockableElement The child element.
childId
string The ID of the child.
position
olympe.df.PVector2 <optional>
The position of the child in pixel. (0, 0) if omitted.
Returns:
This
RootElement
. -
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.
- Inherited From:
- Overrides:
-
clear()
-
Removes all the children of this
RootElement
.Returns:
This
RootElement
. -
getAbsolutePosition()
-
Returns the absolute position of this
Element
.This method must be implemented by Element descendants.
- Inherited From:
- Overrides:
Returns:
Absolute position of this Element.
- Type
- olympe.df.PVector2
-
getDimension()
-
Gets the dimension of this
RootElement
.- Overrides:
Returns:
The dimension (w, h).
- Type
- olympe.df.PVector2
-
getEventKeyDown()
-
Gets the 'Key Down' events. i.e. the key has been pressed down.
- Implements:
Returns:
Key event
-
getEventKeyPressed()
-
Gets the 'Key Pressed' events. i.e. a key has been pressed then released.
- Implements:
Returns:
Key event
-
getEventKeyUp()
-
Gets the 'Key Up' events. i.e. when a key is released back after being pressed.
- Implements:
Returns:
Key event
-
getFocus()
-
Checks whether this
Element
has the focus.Warning: Focus may not be applicable on some elements, depending on the platform.
- Inherited From:
- Overrides:
Returns:
true
if Element has focus.- Type
- olympe.df.POBoolean
-
<protected> getGestureEvent()
-
Gets the gesture event manager attached to this element
- Inherited From:
- Overrides:
Returns:
-
getHeight()
-
Gets the height of this
RootElement
.Returns:
The height, in pixels.
- Type
- olympe.df.PONumber
-
getHTMLElement()
-
Return the DOM HTMLElement if exists (may be null)
- Inherited From:
- Overrides:
Returns:
- Type
- Element
-
<protected> getMouseEvent()
-
Gets the mouse event manager attached to this element.
- Inherited From:
- Overrides:
Returns:
the mouse event manager.
-
getScreenOrientation()
-
Gets the screen orientation (Landscape or Portrait).
Returns:
The screen orientation.
-
<protected> getUIProxyElement()
-
Returns the native UI element associated with this
Element
.- Inherited From:
- Overrides:
Returns:
The proxy element from the UI thread.
- Type
- olympe.uiapi.std.Element
-
<package> getUIProxyRootElement()
-
Returns:
The proxy element from the UI thread
- Type
- olympe.uiapi.std.RootElement
-
getWidth()
-
Gets the width of this
RootElement
.Returns:
The width, in pixels.
- Type
- olympe.df.PONumber
-
hideTooltip()
-
Hides the tooltip if it was showing.
Returns:
This
RootElement
. -
isHidden()
-
Checks whether this
Element
is hidden.- Inherited From:
- Overrides:
Returns:
true
is this element is hidden.- Type
- olympe.df.POBoolean
-
loadFont(fontDef)
-
Loads a font.
Parameters:
Name Type Description fontDef
olympe.ui.FontDef The font definition.
Returns:
This
RootElement
. -
offKeyDown(id)
-
Unregisters a callback from 'Key Down' events.
Parameters:
Name Type Description id
string id the Id of the callback (returned by
onKeyDown
)- Implements:
-
offKeyPressed(id)
-
Unregisters a callback from 'Key Pressed' events.
Parameters:
Name Type Description id
string id the Id of the callback (returned by
onKeyPressed
)- Implements:
-
offKeyUp(id)
-
Unregisters a callback from 'Key Up' events.
Parameters:
Name Type Description id
string id the Id of the callback (returned by
onKeyUp
)- Implements:
-
onKeyDown(callback [, id] [, priority])
-
Registers a callback for 'Key Down' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnKeyEventCallback the callback to register
id
string <optional>
Id of event auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onKeyPressed(callback [, id] [, priority])
-
Registers a callback for 'Key Pressed' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnKeyEventCallback the callback to register
id
string <optional>
Id of event auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
onKeyUp(callback [, id] [, priority])
-
Registers a callback for 'Key Up' events.
Parameters:
Name Type Argument Default Description callback
olympe.ui.events.OnKeyEventCallback the callback to register
id
string <optional>
Id of event auto-generated if omitted
priority
number <optional>
0 Priority of event (higher number = higher priority)
- Implements:
Returns:
Id of the callback
- Type
- string
-
removeChild(childId)
-
Removes a child from this
RootElement
.Parameters:
Name Type Description childId
string The child's ID.
Returns:
This
RootElement
. -
removeTooltip()
-
Removes the tooltip from this element.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
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.- Inherited From:
- Overrides:
Returns:
this
Element
. -
setFavicon(url)
-
Set the favicon of the page.
Parameters:
Name Type Description url
string Returns:
-
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.
- Inherited From:
- Overrides:
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.- Inherited From:
- Overrides:
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.- Inherited From:
- Overrides:
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).
- Inherited From:
- Overrides:
Returns:
this
Element
. -
setStyle(style, value)
-
Parameters:
Name Type Description style
string CSS style name
value
string | number CSS style value
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
Returns:
this
Element
. -
setTitle(title)
-
Sets then title for that
RootElement
.Parameters:
Name Type Description title
string | olympe.df.POString | olympe.df.Node The title.
Returns:
This
RootElement
. -
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.
- Inherited From:
- Overrides:
Returns:
This Element.
-
showTooltip(text [, options])
-
Shows a tooltip label containing the specified text. By default it will hover next to the mouse position.
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. Default is following the mouse.
background
olympe.df.PColor <optional>
The background color. Default is white.
foreground
olympe.df.PColor <optional>
The text color. Default is black.
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.
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
RootElement
.