Class R.ui.AbstractUIControl
Extends
R.objects.Object2D.
Abstract class that provides the foundation for all UI controls which are
rendered to a graphical context.
Defined in: abstractuicontrol.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.ui.AbstractUIControl(controlName, textRenderer)
|
- Fields borrowed from class R.struct.Container:
- EMPTY
Method Attributes | Method Name and Description |
---|---|
addClass(cssClass)
Add a CSS style class to the control.
|
|
[ABSTRACT] Calculate and return the height of the control in pixels.
|
|
[ABSTRACT] Calculate and return the width of the control in pixels.
|
|
click(mouseInfo)
Called when a mouse button is pressed, then released on the control.
|
|
deserialize(obj, clazz)
Deserialize the object back into a UI control.
|
|
destroy()
Destroy the UI control.
|
|
drawBox(renderContext, width, height, fillColor)
Draw a box for the control.
|
|
drawControl(renderContext, worldTime, dt)
[ABSTRACT] Method which draws the UI control to the render context.
|
|
Get the class name of this object
|
|
Get the unique name of this UI control.
|
|
getGroup()
Get the group of controls which are in this control's group.
|
|
Returns the name of the group this UI control belongs to.
|
|
Returns a bean which represents the read or read/write properties
of the object.
|
|
Get a reference to the text renderer for the control.
|
|
hasFocus()
Returns a boolean indicating if the control has focus.
|
|
Returns
true if the mouse is in the control's world bounding box. |
|
mouseDown(mouseInfo)
Called when a mouse button is pressed on the control.
|
|
mouseMove(mouseInfo)
Called when the mouse moves over the control.
|
|
mouseOut(mouseInfo)
Called when the mouse moves out of the control.
|
|
mouseOver(mouseInfo)
Called when the mouse is over the control.
|
|
mouseUp(mouseInfo)
Called when a mouse button is released on the control.
|
|
release()
Releases the object back into the object pool.
|
|
removeClass(cssClass)
Remove a CSS style class from the control.
|
|
serialize(obj, defaults)
Get a properties object with values for the given object.
|
|
setControlName(uiName)
Set the name of the UI control which uniquely identifies it among other
UI controls.
|
|
setFocus(state)
Set the focus state of the UI control.
|
|
setGroup(groupName)
Set the control's group name.
|
- Methods borrowed from class R.objects.Object2D:
- getAABB, getBoundingBox, getBoundingCircle, getCollisionHull, getDefaultTransformComponent, getLastPosition, getOrigin, getOriginPosition, getPosition, getRenderPosition, getRenderRotation, getRotation, getScale, getScaleX, getScaleY, getTransformationMatrix, getWorldBox, getWorldCircle, getZIndex, setBoundingBox, setCollisionHull, setDefaultTransformComponent, setOrigin, setPosition, setRotation, setScale, setZIndex
- Methods borrowed from class R.engine.GameObject:
- add, componentSort, getComponent, getComponentByClass, getRenderContext, isDirty, isKeepAlive, markDirty, remove, setKeepAlive, setRenderContext, update, wasDirty
- Methods borrowed from class R.struct.HashContainer:
- cleanUp, clear, get, isInHash, removeAtIndex, removeHash
- Methods borrowed from class R.struct.Container:
- addAll, append, clone, concat, contains, filter, forEach, fromArray, getAll, getObjects, insert, iterator, reduce, replace, replaceAt, size, sort, subset, toXML
- Methods borrowed from class R.engine.BaseObject:
- addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, isDestroyed, setName, setObjectDataModel, toString
Class Detail
R.ui.AbstractUIControl(controlName, textRenderer)
- Parameters:
- controlName
- {String} The name of the control
- textRenderer
- {R.text.AbstractTextRenderer} Optional text renderer. Defaults to R.text.ContextText renderer.
Method Detail
addClass(cssClass)
Add a CSS style class to the control.
- Parameters:
- cssClass
- {String} The name of the style class to add
{Number}
calcHeight()
[ABSTRACT] Calculate and return the height of the control in pixels.
- Returns:
- {Number}
{Number}
calcWidth()
[ABSTRACT] Calculate and return the width of the control in pixels.
- Returns:
- {Number}
click(mouseInfo)
Called when a mouse button is pressed, then released on the control. Triggers the
"click" event, passing the
R.struct.MouseInfo
structure.
- Parameters:
- mouseInfo
- {R.struct.MouseInfo} The mouse info structure
{R.ui.AbstractUIControl}
deserialize(obj, clazz)
Deserialize the object back into a UI control.
- Parameters:
- obj
- {Object} The object to deserialize
- clazz Optional
- {Class} The object class to populate
- Returns:
- {R.ui.AbstractUIControl} The object which was deserialized
destroy()
Destroy the UI control.
drawBox(renderContext, width, height, fillColor)
Draw a box for the control.
- Parameters:
- renderContext
- {R.rendercontexts.RenderContext2D} The render context
- width
- {Number} The width of the box
- height
- {Number} The height of the box
- fillColor
- {String} The fill color for the box, or
null
drawControl(renderContext, worldTime, dt)
[ABSTRACT] Method which draws the UI control to the render context.
- Parameters:
- renderContext
- {R.rendercontexts.RenderContext2D} The render context where the control is drawn.
- worldTime
- {Number} The current world time, in milliseconds
- dt
- {Number} The time since the last frame was drawn by the engine, in milliseconds
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} The string "R.ui.AbstractUIControl"
{String}
getControlName()
Get the unique name of this UI control.
- Returns:
- {String}
{Array}
getGroup()
Get the group of controls which are in this control's group.
- Returns:
- {Array}
{String}
getGroupName()
Returns the name of the group this UI control belongs to. Returns an
empty string if this control isn't part of a group.
- Returns:
- {String}
{Object}
getProperties()
Returns a bean which represents the read or read/write properties
of the object.
- Returns:
- {Object} The properties object
{R.text.TextRenderer}
getTextRenderer()
Get a reference to the text renderer for the control.
- Returns:
- {R.text.TextRenderer}
{Boolean}
hasFocus()
Returns a boolean indicating if the control has focus.
- Returns:
- {Boolean}
true
if the control has focus
{Boolean}
isMouseInControl()
Returns
true
if the mouse is in the control's world bounding box.
- Returns:
- {Boolean}
mouseDown(mouseInfo)
Called when a mouse button is pressed on the control. Triggers the "mousedown" event, passing the
R.struct.MouseInfo
structure.
- Parameters:
- mouseInfo
- {R.struct.MouseInfo} The mouse info structure
mouseMove(mouseInfo)
Called when the mouse moves over the control. Triggers the "mousemove" event, passing the
R.struct.MouseInfo
structure.
- Parameters:
- mouseInfo
- {R.struct.MouseInfo} The mouse info structure
mouseOut(mouseInfo)
Called when the mouse moves out of the control. Triggers the "mouseout" event, passing the
R.struct.MouseInfo
structure.
- Parameters:
- mouseInfo
- {R.struct.MouseInfo} The mouse info structure
mouseOver(mouseInfo)
Called when the mouse is over the control. Triggers the "mouseover" event, passing the
R.struct.MouseInfo
structure.
- Parameters:
- mouseInfo
- {R.struct.MouseInfo} The mouse info structure
mouseUp(mouseInfo)
Called when a mouse button is released on the control. Triggers the "mouseup" event, passing the
R.struct.MouseInfo
structure.
- Parameters:
- mouseInfo
- {R.struct.MouseInfo} The mouse info structure
release()
Releases the object back into the object pool. See R.engine.PooledObject#release
for more information.
removeClass(cssClass)
Remove a CSS style class from the control.
- Parameters:
- cssClass
- {String} The name of the style class to remove
{Object}
serialize(obj, defaults)
Get a properties object with values for the given object.
- Parameters:
- obj
- {R.ui.AbstractUIControl} The UI control to query
- defaults Optional
- {Object} Default values that don't need to be serialized unless they are different.
- Returns:
- {Object}
setControlName(uiName)
Set the name of the UI control which uniquely identifies it among other
UI controls.
- Parameters:
- uiName
- {String} The name of the control
setFocus(state)
Set the focus state of the UI control.
- Parameters:
- state
- {Boolean}
true
if the control has focus
setGroup(groupName)
Set the control's group name.
- Parameters:
- groupName
- {String} The name of the control's group, or an empty string to clear the group.