new Element(parentopt)
"Element" is the base ui class that all other ui elements inherit from.
This class has all the basic functionality like positioning, drawing,
containing other elements, etc.
In addition, rat.ui.Element objects act as a simple container class, and are frequently used
as such to group subelements together and let them be moved around, hidden, etc., all
at once.
Parameters:
| Name |
Type |
Attributes |
Description |
parent |
Object
|
<optional>
|
optional parent object |
- Source:
Members
place
- Source:
- To Do:
-
- replace with standard position tracker object... (pos + rot)
Methods
(static) setupFromData()
- Source:
applyRecursively(func, arg)
Parameters:
| Name |
Type |
Description |
func |
?
|
|
arg |
?
|
|
- Source:
// clamp scroll offset to keep from scrolling past edges of actual content,
// based on contentSize being correct.
// todo allow optional passing in a potential value, and clamp that instead of my current value.
Parameters:
| Name |
Type |
Attributes |
Description |
offset |
Object
|
<optional>
|
|
- Source:
findSubElementByID(id, recursiveopt)
Parameters:
| Name |
Type |
Attributes |
Description |
id |
?
|
|
|
recursive |
boolean
|
<optional>
|
|
- Source:
fireCustomTrigger(triggerName, triggerArgs)
Parameters:
| Name |
Type |
Description |
triggerName |
string
|
|
triggerArgs |
?
|
|
- Source:
getGlobalPos(xopt, yopt)
// get global coordinates from local coordinates relative to me. Compare with getGlobalContentPos below.
// this involves processing the chain from parent to parent, to the top level.
// But we do that locally, instead of recursively, to avoid extra function calls and overhead.
Parameters:
| Name |
Type |
Attributes |
Description |
x |
number
|
<optional>
|
|
y |
number
|
<optional>
|
|
- Source:
getSubElement(index)
Parameters:
| Name |
Type |
Description |
index |
?
|
|
- Source:
scroll this point to center
Parameters:
| Name |
Type |
Attributes |
Description |
offset |
Object
|
<optional>
|
|
- Source:
scrollToCenterContent(offsetopt)
Scroll to center my content automatically
Parameters:
| Name |
Type |
Attributes |
Description |
offset |
Object
|
<optional>
|
|
- Source:
setBounds(x, yopt, wopt, hopt)
Set the position and size of this element
Parameters:
| Name |
Type |
Attributes |
Description |
x |
number
|
Object
|
|
|
y |
number
|
<optional>
|
|
w |
number
|
<optional>
|
|
h |
number
|
<optional>
|
|
- Source:
setCallback(callback, userInfoopt)
set function to call when triggered (see Trigger code)
callback is called with (element, userInfo) args
callback is expected to return a flag indicating if the event was handled.
if you return false, we keep looking for other ways the event can be handled.
so, generally you probably want to return true.
Parameters:
| Name |
Type |
Attributes |
Description |
callback |
function
|
|
|
userInfo |
*
|
<optional>
|
|
- Source:
setCallbackInfo(userInfo)
Set the data provided with the callbacks
Parameters:
| Name |
Type |
Description |
userInfo |
?
|
|
- Source:
setFlag()
Set (or clear) a flag in this element's flags structure
works for setting multiple flags, too.
- Source:
setFlagsChangedCallback(callback, userInfoopt)
set function to call when flags change, e.g. when element is highlighted
callback is called with (oldflags, userInfo) args (and using element as 'this')
Parameters:
| Name |
Type |
Attributes |
Description |
callback |
function
|
|
|
userInfo |
*
|
<optional>
|
|
- Source:
setFrame(frameWidth, frameColoropt, frameOutset)
Set the frame on this element
Parameters:
| Name |
Type |
Attributes |
Description |
frameWidth |
number
|
|
how wide is the frame |
frameColor |
Object
|
<optional>
|
|
frameOutset |
?
|
|
|
- Source:
Set this element as our current tooltip.
could be anything - textbox, image, whatever. For an easier text-only function, use setTextToolTip
Parameters:
| Name |
Type |
Attributes |
Description |
toolTip |
Object
|
|
|
screen |
Object
|
|
|
placement |
string
|
|
|
offset |
Object
|
<optional>
|
|
fromMouse |
boolean
|
<optional>
|
|
- Source: