Classes
AddedRemovedEvent
AlertElement
AnchorContainerElement
ArrowShape
ButtonElement
CanvasElement
CanvasManager
CheckboxElement
CheckboxSkinElement
CollectionChangedEvent
CollectionSort
ColorPickerButtonElement
ColorPickerElement
ContainerBaseElement
CursorDefinition
DataGridColumnDefinition
DataGridDataRenderer
DataGridElement
DataGridHeaderColumnDividerSkinElement
DataGridHeaderElement
DataGridHeaderItemRenderer
DataGridItemData
DataGridItemRendererBase
DataGridLabelItemRenderer
DataListData
DataListElement
DataRendererBaseElement
DataRendererLabelElement
DatePickerButtonElement
DatePickerElement
DispatcherEvent
DrawMetrics
DropdownArrowButtonSkinElement
DropdownBaseElement
DropdownElement
ElementEvent
ElementGridItemClickEvent
ElementKeyboardEvent
ElementListItemClickEvent
ElementMouseEvent
ElementMouseWheelEvent
EllipseShape
EventDispatcher
FillBase
GridContainerElement
GridContainerRowColumnDefinition
ImageElement
IpInputElement
LabelElement
LinearGradientFill
ListCollection
ListContainerElement
ProgressElement
RadioButtonElement
RadioButtonSkinElement
RoundedRectangleShape
ScrollBarElement
ScrollButtonSkinElement
ShapeBase
SkinnableElement
SolidFill
StyleableBase
StyleChangedEvent
StyleData
StyleDefinition
StyleProxy
TextAreaElement
TextElement
TextFieldElement
TextInputElement
TimeInputElement
ToggleButtonElement
ToggleButtonGroup
Tween
ViewportElement


CanvasElement

Base class for all Elements to be rendered to the Canvas by CanvasManager.
CanvasElement supports all basic system functions for render-able objects such
as the display chain hierarchy, user interactivity and events,
style management, vector based rendering, etc.
CanvasElement is the most basic type that can be added to CanvasManager and can be
used to automatically draw shapes or any custom rendering to the canvas.

Inheritance:     CanvasElement ➞ StyleableBaseStyleDefinitionEventDispatcher ➞ Object

Styles
Style Defined By
Alpha     :    Number CanvasElement
Alpha value to use when rendering this component. Allowable values are between 0 and 1 with
0 being transparent and 1 being opaque. This causes the element to perform composite rendering
when a value between 1 and 0 is used.
 
BackgroundFill     :    FillBase CanvasElement
Fill to use when filling the background. May be any FillBase subclass instance,
"color" string, or null for transparent.
 
BackgroundShape     :    ShapeBase CanvasElement
Shape to be used when rendering the elements background. May be any ShapeBase subclass instance.
 
BorderColor     :    String CanvasElement
Hex color value to be used when drawing the border. Format like "#FF0000" (red)
 
BorderThickness     :    Number CanvasElement
Thickness in pixels to be used when drawing the border.
 
BorderType     :    String CanvasElement
Determines the border type the CanvasElement should render. Allowable values are
"solid", "inset", "outset" or "none" / null. Note that borders are internal and drawn on the inside
of the elements bounding area.
 
Bottom     :    Number CanvasElement
The distance the element should be positioned from the lower bounds of the parent container.
This only works if the element is a child of an AnchorContainer.
 
ClipContent     :    boolean CanvasElement
Determines if out of bounds rendering is allowed. If true the element will clip all rendering
and children's rendering to the elements bounding box. This style is inheritable for container elements.
 
CompositeLayer     :    boolean CanvasElement
When true, this element renders itself and all children to a single layer and is treated
by its parent as a single element when rendering. This is necessary and automatically enabled
for styles like alpha where the component and all its children must be pre-rendered, and then
re-rendered with the appropriate effect.
This is very expensive but can also be very beneficial when used appropriately.
For example, if you have an application with a scrolling or constantly changing background
thereby always causing a full screen redraw, its beneficial to make the layer on top of the
background a composite layer. This effectively buffers the layer. Only the delta changes
will be drawn to the composite. Otherwise the entire display chain would have to be re-drawn
when the background moves. This is memory intensive as it effectively duplicates the rendering
area. Composite elements/children changing will update their region of their composite parent,
then that region of the composite parent needs to be copied up to the grandparent,
resulting in an additional buffer copy.
 
Cursor     :    CursorDefinition CanvasElement
Specifies the cursor to be displayed when the mouse is over the element. A custom CursorDefinition
may be used or a browser type String ("text", "none", etc) may be used.
 
Draggable     :    boolean CanvasElement
When true allows the element to be dragged by the user. This does not work for containers
that do not allow absolute positioning such as a ListContainer.
 
Enabled     :    boolean CanvasElement
When false disables user interaction with the element.
 
FocusColor     :    String [Inheritable] CanvasElement
Hex color value to be used when drawing the elements focus indicator. Format "#FF0000" (Red).
The focus indicator is only rendered when the element gains focus due to a tab stop.
 
FocusThickness     :    Number [Inheritable] CanvasElement
Size in pixels that the focus ring should be rendered. Note that the focus ring is rendered
outside the elements bounding area.
 
Height     :    Number CanvasElement
The Height the element should be rendered relative to its parent container. This only
works if the element is a child of a Container element.
 
HorizontalCenter     :    Number CanvasElement
The distance in pixels from the horizontal center of the parent the element should be positioned.
Negative numbers indicate left of center, positive right of center.
This only works if the element is a child of an AnchorContainer.
 
IncludeInLayout     :    boolean CanvasElement
When false, the element is no longer considered in the parent container's layout.
Typically this is used in conjunction with Visible, however sometimes you may want to
hide an element, but still have it consume container space.
 
IncludeInMeasure     :    boolean CanvasElement
When false, the element is no longer considered in the parent container's measurement.
This is useful if you do not want containers to respect this child's measured size and/or
do not care if content is clipped, such as when using MinSize, MaxSize, and percent sizing together.
This also prevents the element's _doMeasure() function from running and forces a 0x0 measured size.
However, this will not prevent the "measurecomplete" event after this element finishes its measure phase.
 
Left     :    Number CanvasElement
The distance the element should be positioned from the left most bounds of the parent container.
This only works if the element is a child of an AnchorContainer.
 
MaxHeight     :    Number CanvasElement
The maximum height in pixels the element should consume. This only
works if the element is a child of a Container element.
 
MaxWidth     :    Number CanvasElement
The maximum width in pixels the element should consume. This only
works if the element is a child of a Container element.
 
MinHeight     :    Number CanvasElement
The minimum height in pixels the element should consume. This only
works if the element is a child of a Container element.
 
MinWidth     :    Number CanvasElement
The minimum width in pixels the element should consume. This only
works if the element is a child of a Container element.
 
MouseEnabled     :    boolean CanvasElement
When false disables mouse events for the element.
 
Padding     :    Number CanvasElement
Size in pixels that inner content should be spaced from the outer bounds of the element.
Padding effects all sides of the element. Padding may be negative under certain circumstances like
expanding an inner child to allow border collapsing with its parent.
 
PaddingBottom     :    Number CanvasElement
Size in pixels that inner content should be spaced from the lower bounds of the element.
This will override the Padding style.
 
PaddingLeft     :    Number CanvasElement
Size in pixels that inner content should be spaced from the left most bounds of the element.
This will override the Padding style.
 
PaddingRight     :    Number CanvasElement
Size in pixels that inner content should be spaced from the right most bounds of the element.
This will override the Padding style.
 
PaddingTop     :    Number CanvasElement
Size in pixels that inner content should be spaced from the upper bounds of the element.
This will override the Padding style.
 
PasswordMaskCharacter     :    String [Inheritable] CanvasElement
Character to use when masking a password field
 
PercentHeight     :    Number CanvasElement
The percentage of available height the element should consume relative to its parent container. This only
works if the element is a child of a Container element. Note that percentage height is calculated
based on the available space left over *after* static sized elements considered. Percentages
are allowed to add to more than 100 and will consume all of the available space. For containers
like ListContainers, when percents add to more than 100 the elements will share the available space
per the ratio of percent vs total percent used so it is perfectly reasonable to set 3 elements all
to 100 and allow them to split the real-estate by 3.
 
PercentWidth     :    Number CanvasElement
The percentage of available width the element should consume relative to its parent container. This only
works if the element is a child of a Container element. Note that percentage width is calculated
based on the available space left over *after* static sized elements considered. Percentages
are allowed to add to more than 100 and will consume all of the available space. For containers
like ListContainers, when percents add to more than 100 the elements will share the available space
per the ratio of percent vs total percent used so it is perfectly reasonable to set 3 elements all
to 100 and allow them to split the real-estate by 3.
 
Right     :    Number CanvasElement
The distance the element should be positioned from the right most bounds of the parent container.
This only works if the element is a child of an AnchorContainer.
 
RotateCenterX     :    Number CanvasElement
The X position of the parent container the element should be rotated around.
This only works if the element is a child of an AnchorContainer.
 
RotateCenterY     :    Number CanvasElement
The Y position of the parent container the element should be rotated around.
This only works if the element is a child of an AnchorContainer.
 
RotateDegrees     :    Number CanvasElement
The number of degrees the element should be rotated (clockwise). When no RotateCenterX or
RotateCenterY is set, the element is rotated via its center point and rotated objects are
still positioned relative to their parent's coordinate plane after the transform has occurred.
 
ShadowColor     :    String CanvasElement
Hex color value to be used when drawing the drop shadow. This may be set to null and no
shadow will be rendered. Format like "#FF0000" (red)
 
ShadowOffsetX     :    Number CanvasElement
X offset that the drop shadow will be rendered.
 
ShadowOffsetY     :    Number CanvasElement
Y offset that the drop shadow will be rendered.
 
ShadowSize     :    Number CanvasElement
Size in pixels that the drop shadow should be rendered. Note that the drop shadow may be rendered
outside the elements bounding area. This will cause the element to be composite rendered.
 
SkinState     :    String CanvasElement
This is an internal style used to toggle an element's current skin for different states such
as normal, mouse-over, mouse-down, etc. Its also commonly used by skin classes to identify their skin state.
 
TabStop     :    int CanvasElement
Determines if an element can be focused using tab stops. -1 indicates the element cannot
take focus, 0 is default and the element will be focused in the order it appears in the display chain.
Numbers higher than 0 indicate a specific order to be used (not yet implemented).
 
TextCaretColor     :    String [Inheritable] CanvasElement
Hex color value to be used when drawing blinking text caret. "#FF0000" (red)
 
TextColor     :    String [Inheritable] CanvasElement
Hex color value to be used when drawing text. Format like "#FF0000" (red)
 
TextDecoration     :    String [Inheritable] CanvasElement
Determines the text decoration used. Available values are "none" or "underline".
 
TextFillType     :    String [Inheritable] CanvasElement
Determines the fill type when rendering text. Available values are "fill" and "stroke".
Stroke draws a border around characters, while fill completely fills them.
 
TextFont     :    String [Inheritable] CanvasElement
Determines the font family to use when rendering text such as "Arial".
 
TextHighlightedColor     :    String [Inheritable] CanvasElement
Hex color value to be used when drawing highlighted text. Format like "#FF0000" (red)
 
TextHighlightedColor     :    String [Inheritable] CanvasElement
Hex color value to be used when drawing highlighted text background. Format like "#FF0000" (red)
 
TextHorizontalAlign     :    String [Inheritable] CanvasElement
Determines alignment when rendering text. Available values are "left", "center", and "right".
 
TextLinePaddingBottom     :    Number [Inheritable] CanvasElement
Padding to apply to the bottom of each line of text. This also impacts the size of the highlight background.
This is useful when using strange fonts that exceed their typical vertical bounds.
 
TextLinePaddingTop     :    Number [Inheritable] CanvasElement
Padding to apply to the top of each line of text. This also impacts the size of the highlight background.
This is useful when using strange fonts that exceed their typical vertical bounds.
 
TextLineSpacing     :    Number [Inheritable] CanvasElement
Vertical line spacing in pixels.
 
TextSize     :    int [Inheritable] CanvasElement
Determines the size in pixels to render text.
 
TextStyle     :    String [Inheritable] CanvasElement
Determines the style to render text. Available values are "normal", "bold", "italic", and "bold italic".
 
TextVerticalAlign     :    String [Inheritable] CanvasElement
Determines the baseline when rendering text. Available values are "top", "middle", or "bottom".
 
Top     :    Number CanvasElement
The distance the element should be positioned from the upper bounds of the parent container.
This only works if the element is a child of an AnchorContainer.
 
VerticalCenter     :    Number CanvasElement
The distance in pixels from the vertical center of the parent the element should be positioned.
Negative numbers indicate left of center, positive right of center.
This only works if the element is a child of an AnchorContainer.
 
Visible     :    boolean CanvasElement
When false the element will not be rendered.
 
Width     :    Number CanvasElement
The Width the element should be rendered relative to its parent container. This only
works if the element is a child of a Container element.
 
X     :    Number CanvasElement
The X position the element should be rendered relative to its parent container. This only
works if the element is a child of an AnchorContainer.
 
Y     :    Number CanvasElement
The Y position the element should be rendered relative to its parent container. This only
works if the element is a child of an AnchorContainer.
 


Events
Show Inherited
Event Defined By
added     :    AddedRemovedEvent CanvasElement
Dispatched when this element is added to the display hierarchy and becomes a descendant of CanvasManager.
 
click     :    ElementMouseEvent CanvasElement
Dispatched when the mouse is pressed and released over the same element.
 
dragging     :    ElementEvent CanvasElement
Dispatched when this element is moved due to it being dragged.
 
enterframe     :    DispatcherEvent [Broadcast] CanvasElement
Dispatched at the beginning of the frame before any life cycle processing begins.
 
exitframe     :    DispatcherEvent [Broadcast] CanvasElement
Dispatched at the end of the frame after life cycle processing ends.
 
focusin     :    ElementEvent CanvasElement
Dispatched when this element gains focus.
 
focusout     :    ElementEvent CanvasElement
Dispatched when this element loses focus.
 
keydown     :    ElementKeyboardEvent CanvasElement
Dispatched when the element has focus and a key is pressed, repeatedly dispatched if the key is held down.
 
keyup     :    ElementKeyboardEvent CanvasElement
Dispatched when the element has focus and a key is released.
 
layoutcomplete     :    DispatcherEvent CanvasElement
Typically an internal event. Dispatched when an element has completed its
layout phase. This is used when it is necessary to wait for an element to
finish its layout pass so things such as its PercentWidth calculation is complete.
This is very expensive and should only be used when absolutely necessary. Its usually
only needed when elements are not directly related via parent/child.
For example, DropdownElement uses this to adjust the height of the dropdown popup
since we do not know how much height it will need until after it has finished layout.
 
localechanged     :    DispatcherEvent [Broadcast] CanvasElement
Dispatched when CanvasManager's locale selection changes.
 
measurecomplete     :    DispatcherEvent CanvasElement
Typically an internal event. Dispatched when an element has completed its
measure phase. This is used when it is necessary to wait for an element to
finish its measure pass so that its content size or _measuredSize calculation is complete.
This is very expensive and should only be used when absolutely necessary. Its usually
only needed when elements are not directly related via parent/child.
For example, ViewportElement uses this to invoke a layout pass when its content child
changes _measuredSize. The Viewport uses an intermediate CanvasElement as a clipping container
for the content child, which does not measure children, so an event is needed to notify the Viewport.
 
mousedown     :    ElementMouseEvent CanvasElement
Dispatched when the mouse is pressed over this element.
 
mousemove     :    ElementMouseEvent CanvasElement
Dispatched when the mouse moves over this element.
 
mousemoveex     :    ElementMouseEvent [Broadcast] CanvasElement
Dispatched when the mouse moves anywhere, even outside of the browser window. Mouse coordinates are relative to CanvasManager.
 
mouseup     :    ElementMouseEvent CanvasElement
Dispatched when the mouse is released. Note that the mouse may not still be over the element.
 
removed     :    AddedRemovedEvent CanvasElement
Dispatched when this element is removed from the display hierarchy and is no longer a descendant of CanvasManager.
 
resize     :    DispatcherEvent CanvasElement
Dispatched when the element's size changes.
 
rollout     :    ElementEvent CanvasElement
Dispatched when the mouse moves outside of this element.
 
rollover     :    ElementEvent CanvasElement
Dispatched when the mouse moves over this element.
 
wheel     :    ElementMouseWheelEvent CanvasElement
Dispatched when the mouse wheel is rolled while over this element.
 


Public Functions
Show Inherited
Function Defined By
CanvasElement() [Constructor] CanvasElement
Creates new CanvasElement instance.
 
addCaptureListener(type, callback) CanvasElement
Registers an event listener function to be called during capture phase.
  type     :    String
String representing the event type.
  callback     :    Function
Function to be called when the event occurs.
 
addStyleDefinition(styleDefinition) CanvasElement
Adds a style definition to the end element's definition list. Styles in this definition
will override styles in previously added definitions (lower index). Instance styles, set
using setStyle() will override all definition styles.
Adding style definitions to elements already attached to the display chain is expensive,
for better performance add definitions before attaching the element via addElement()
  styleDefinition     :    StyleDefinition
The StyleDefinition to add and associate with the element.
  returns     :    StyleDefinition
The style definition just added.
 
addStyleDefinitionAt(styleDefinition, index) CanvasElement
Inserts a style definition to this elements definition list at the specified index.
Definitions with higher indexes (added later) are higher priority. Instance styles, set
using setStyle() will override all definition styles.
Adding style definitions to elements already attached to the display chain is expensive,
for better performance add definitions before attaching the element via addElement()
  styleDefinition     :    StyleDefinition
StyleDefinition to be added to this elements definition list.
  index     :    int
The index to insert the style definition within the elements definition list.
  returns     :    StyleDefinition
Returns StyleDefinition just added when successfull, null if the StyleDefinition could not
be added due to the index being out of range or other error.
 
adjustColorLight(color, percent) [Static] CanvasElement
Adjusts supplied color brightness.
  color     :    String
Hex color value be adjusted. Format like "#FF0000" (red)
  percent     :    Number
Value between -1 and +1. -1 will return white. +1 will return black.
  returns     :    String
Adjusted Hex color value.
 
clearStyleDefinitions() CanvasElement
Removes all style definitions from the element. This is more efficient than
removing definitions one at a time.
 
cot(radians) [Static] CanvasElement
Calculates the cotangent of supplied radians.
  radians     :    Number
Radians to calculate cotangent
  returns     :    Number
Resulting cotangent from radians
 
degreesToRadians(degrees) [Static] CanvasElement
Calculates degrees to radians.
  degrees     :    Number
Degrees to be calculated to degrees.
  returns     :    Number
Resulting radians from supplied degrees.
 
getManager() CanvasElement
Gets the CanvasManager currently associated with this element.
  returns     :    CanvasManager
The CanvasManager currently associated with this element.
 
getMetrics(relativeToElement) CanvasElement
Gets a DrawMetrics object containing the elements bounding box information
x, y, width, height, relative to the supplied element regardless of this element's transformation,
depth, or position in the display hierarchy. For example, you can call this get the elements width and height,
or to get this element's bounding box relative to the canvas or any other element.
  relativeToElement     :    CanvasElement
The element to translate this elements bounding box too. If relativeToElement equals
null or this, will return metrics relative to this element: {x:0, y:0, width:thisWidth, height:thisHeight}.
  returns     :    DrawMetrics
DrawMetrics of this element relative to the supplied element.
 
getMouseIsDown() CanvasElement
Gets the state of the mouse for this element.
  returns     :    boolean
Returns true if the mouse is currently pressed, false otherwise.
 
getName() CanvasElement
Gets the name associated with this element.
  returns     :    String
The name associated with this element.
 
getNumStyleDefinitions() CanvasElement
Gets the number of style definitions associated with this element.
  returns     :    int
The number of style definitions.
 
getParent() CanvasElement
Gets this element's parent element.
  returns     :    CanvasElement
This element's parent element.
 
getStyle(styleName) [Override] CanvasElement
Gets the style value for this element. When retrieving a style, CanvasElements look
through their associated style chain, at each step if undefined is returned, they look
at the next step until a non-undefined value is found.
1) Instance - Styles set directly to the element via setStyle()
2) StyleDefinitions - Styles associated via its assigned StyleDefinitions
3) StyleProxy - If proxy element is assigned, move to proxy element and repeat steps 1-3
4) Inheritable - If style is inheritable, move up to parent element and repeat steps 1-4
5) Default styles
  styleName     :    String
String representing the style value to be returned.
  returns     :    Any
Returns the associated style value if found, otherwise undefined.
 
getStyleDefinitionAt(index) CanvasElement
Gets the style definition at the supplied zero base index.
  index     :    int
Index of the style definition to return;
  returns     :    StyleDefinition
The style defenition at the supplied index, or null if index is out of range.
 
getStyleDefinitionIndex(styleDefinition) CanvasElement
Returns the index of the supplied style definition or -1 if the style definition
has not been added.
  styleDefinition     :    StyleDefinition
StyleDefinition to return associated index.
  returns     :    int
Index of the StyleDefinition supplied via the styleDefinition parameter, or -1 if does not exist.
 
hasCaptureListener(type, callback) CanvasElement
Checks if an event capture listener has been registered with this CanvasElement
  type     :    String
String representing the event type.
  callback     :    Function
Function callback to be called when the event occurs. This may be null to check
if the CanvasElement has any capture events registered for the provided type.
  returns     :    boolean
Returns true if the CanvasElement has the provided capture callback registered for the
provided type, or any capture callback for the provided type if the callback parameter is null.
Otherwise, returns false.
 
normalizeDegrees(value) [Static] CanvasElement
Adjusts degrees less than 0 or greater than 360 to corresponding degrees between 0 and 360.
This is useful when rotating an element by increments.
  value     :    Number
Degrees to normalize.
  returns     :    Number
Degrees between 0 and 360.
 
radiansToDegrees(radians) [Static] CanvasElement
Calculates radians to degrees.
  radians     :    Number
Radians to be calculated to degrees.
  returns     :    Number
Resulting degrees from supplied radians.
 
removeCaptureListener(type, callback) CanvasElement
Removes a capture event listener.
  type     :    String
String representing the event type.
  callback     :    Function
Function callback to be removed.
  returns     :    boolean
Returns true if the callback was successfully removed, otherwise false
such as if the function callback was not previously registered.
 
removeStyleDefinition(styleDefinition) CanvasElement
Removes the supplied style definition from the element's style chain.
  styleDefinition     :    StyleDefinition
The StyleDefinition to remove from the element.
  returns     :    StyleDefinition
The style definition just removed, or null if the supplied style
definition is not associated with this element.
 
removeStyleDefinitionAt(index) CanvasElement
Removes the style definition from the elements definition list at the supplied index.
  index     :    int
Index to be removed.
  returns     :    StyleDefinition
Returns the StyleDefinition just removed if successfull, null if the definition could
not be removed due it it not being in this elements definition list, or index out of range.
 
rotatePoint(point, reverse) CanvasElement
Rotates a point point on this element's parent relative to this element's rotation transformation.
This is used to transform a point from the parent's coordinate plane to a child's coordinate plane or vice versa.
Typically you should use translatePointFrom() or translatePointTo() rather than rotatePoint().
  point     :    Object
Point object {x:0, y:0};
  reverse     :    boolean
When true, rotates a point on the parent's plane, to the childs plane.
When false, rotates a point on the childs plane, to the parents plane.
 
roundToPrecision(value, precision) [Static] CanvasElement
Rounds a number to specified precision (decimal points).
  value     :    Number
Number to round.
  precision     :    int
Number of decimal points.
  returns     :    Number
Rounded value.
 
setName(name) CanvasElement
Sets an arbitrary name to this element. The system does not use this value,
it is for use by implementors if a way to differentiate elements is needed.
  name     :    String
A String to use as the element's name.
 
setStyleDefinitions(styleDefinitions) CanvasElement
Replaces the elements current style definition list. This is more effecient than removing or
adding style definitions one at a time.
  styleDefinitions     :    StyleDefinition
May be a StyleDefinition, or an Array of StyleDefinition, including nested Arrays.
Note that nested arrays will be flattened into a single array.
 
translateMetricsFrom(metrics, relativeFromElement) CanvasElement
Translates a DrawMetrics from another element's to this element regardless of this element's transformation,
depth, or position in the display hierarchy.
  metrics     :    DrawMetrics
Metrics to transform from the relative to this element.
  relativeFromElement     :    CanvasElement
The element to translate the supplied metrics too. If relativeToElement equals
null or this, will return metrics the same as the supplied metrics.
  returns     :    DrawMetrics
Translated DrawMetrics relative to the supplied element.
 
translateMetricsTo(metrics, relativeToElement) CanvasElement
Translates a DrawMetrics from this element's to another element regardless of this element's transformation,
depth, or position in the display hierarchy.
  metrics     :    DrawMetrics
Metrics to transform to from this element to the supplied relative element.
  relativeToElement     :    CanvasElement
The element to translate the supplied metrics too. If relativeToElement equals
null or this, will return metrics the same as the supplied metrics.
  returns     :    DrawMetrics
Translated DrawMetrics relative to the supplied element.
 
translatePointFrom(point, relativeFromElement) CanvasElement
Translates a point from an element to this element regardless of this element's transformation,
depth, or position in the display hierarchy. For example, you can call this to translate a point on
the canvas to the relative point on this element.
  point     :    Object
Point - object containing {x:0, y:0}.
  relativeFromElement     :    CanvasElement
The element that the supplied point is relative too.
 
translatePointTo(point, relativeToElement) CanvasElement
Translates a point from this element to another element regardless of this element's transformation,
depth, or position in the display hierarchy. For example, you can call this to translate a point on
this element to a point on the canvas.
  point     :    Object
Point - object containing {x:0, y:0}.
  relativeToElement     :    CanvasElement
The element to translate this element's point too.
 


Internal Members
Member Defined By
_height     :    Number CanvasElement
Read only - This element's actual height in pixels. This is not updated immediately, only
after our parent has finished its layout phase will this be valid.
 
_isFocused     :    boolean CanvasElement
Read only - true if this element currently has focus, otherwise false.
 
_itemData     :    Object CanvasElement
Read only - Collection item associated with this DataRenderer
 
_listData     :    DataListData CanvasElement
Read only - List data provided by parent DataList when acting as a DataRenderer
 
_listSelected     :    Any CanvasElement
Read only - DataRenderer selected state.
 
_measuredHeight     :    Number CanvasElement
Read only - This element's measured height in pixels. This is not updated immediately, only
after this element has finished its measure phase will this be valid.
 
_measuredWidth     :    Number CanvasElement
Read only - This element's measured width in pixels. This is not updated immediately, only
after this element has finished its measure phase will this be valid.
 
_mouseIsDown     :    boolean CanvasElement
Read only - true if the mouse is pressed on this element, otherwise false.
 
_mouseIsOver     :    boolean CanvasElement
Read only - true if the mouse is over this element, otherwise false.
 
_owner     :    CanvasElement CanvasElement
Read only - This elements owner element. This is set by elements that pop up other elements.
Such as DropdownBase sets this on the pop up element.
 
_parent     :    CanvasElement CanvasElement
Read only - This elements parent element.
 
_renderVisible     :    boolean CanvasElement
Read only - False if any element in the parent chain is not visible.
This is not updated immediately, only after redraw regions have been updated.
Useful for things like "enterframe" listeners to prevent processing when not necessary.
 
_rotateCenterX     :    Number CanvasElement
Read only - The X position relative to the element's parent this element is rotated around. This is not updated immediately, only
after our parent has finished its layout phase will this be valid.
 
_rotateCenterY     :    Number CanvasElement
Read only - The Y position relative to the element's parent this element is rotated around. This is not updated immediately, only
after our parent has finished its layout phase will this be valid.
 
_rotateDegrees     :    Number CanvasElement
Read only - Degrees this element is rotated. This is not updated immediately, only
after our parent has finished its layout phase will this be valid.
 
_width     :    Number CanvasElement
Read only - This element's actual width in pixels. This is not updated immediately, only
after our parent has finished its layout phase will this be valid.
 
_x     :    Number CanvasElement
Read only - X position in pixels relative to this elements parent. This is not updated immediately, only
after our parent has finished its layout phase.
 
_y     :    Number CanvasElement
Read only - Y position in pixels relative to this elements parent. This is not updated immediately, only
after our parent has finished its layout phase will this be valid.
 


Internal Functions
Show Inherited
Function Defined By
_addChild(element) CanvasElement
Adds a child element to the end of this element's child list.
  element     :    CanvasElement
CanvasElement to be added as a child of this element.
  returns     :    CanvasElement
Returns the element just added.
 
_addChildAt(element, index) CanvasElement
Inserts a child element to this elements child list at the specified index.
  element     :    CanvasElement
CanvasElement to be added as a child of this element.
  index     :    int
The index position to insert the child in the elements child list.
  returns     :    CanvasElement
Returns the element just added when successfull, null if the element could not
be added due to the index being out of range.
 
_addStyleDefinitionAt(styleDefinition, index, isDefault) CanvasElement
Inserts a style definition to this elements style definition or default definition lists.
Adding style definitions to elements already attached to the display chain is expensive,
for better performance add definitions before attaching the element via addElement().
Default definitions are used when styling sub components with sub styles.
  styleDefinition     :    StyleDefinition
StyleDefinition to be added to this elements definition list.
  index     :    int
The index to insert the style definition within the elements definition list.
  isDefault     :    bool
When true, inserts the definition into the element's default definition list.
  returns     :    StyleDefinition
Returns StyleDefinition just added when successfull, null if the StyleDefinition could not
be added due to the index being out of range or other error.
 
_applySubStylesToElement(styleName, elementToApply) [Override] CanvasElement
Convienence function for setting sub styles of sub components.
Applies appropriate sub styling from this element to the
supplied elements definition and default definition style lists.
You should call this on sub components from within the _doStylesUpdated()
function when the associated sub style changes.
  styleName     :    String
String representing the sub style to apply.
  elementToApply     :    CanvasElement
The sub component element to apply sub styles.
 
_calculateMinMaxPercentSizes(percentSizedObjects, size) [Static] CanvasElement
Used to calculate size in pixels that percent sized elements should consume given
a supplied size in pixels. Populates .actualSize field on objects in supplied
percentSizedObjects array. This function automatically rounds all sizes to the
nearest pixel to prevent anti-aliasing and fuzzy lines.
  percentSizedObjects     :    Array
Array of objects containing size data: {minSize:Number, maxSize:Number, percentSize:Number}
  size     :    Number
Available size in pixels.
 
_doLayout(paddingMetrics) CanvasElement
Lifecycle method for custom component development. Never call this function directly. The system
calls this function in response to changes that effect layout or elements being added to the display hierarchy.
Override this function to layout its children. You should call layout functions such as _setActualPosition() and
_setActualSize() on child elements from within this function. Sometimes you may need to add/remove additional elements
during layout such as when a Datagrid or Viewport adds/removes scroll bars. Keep in mind that adding/removing elements
automatically re-invalidates layout, so its best to bail out and wait for the next layout pass for best performance
under this scenario.
  paddingMetrics     :    DrawMetrics
Contains metrics to use after considering the element's padding. Simply a convienence as padding typically
effects layout (but not always) depending on the component. Use any supporting functions such as _getBorderMetrics()
that are needed to layout the element.
 
_doMeasure(padWidth, padHeight) CanvasElement
Lifecycle method for custom component development. Never call this function directly. The system
calls this function in response to changes that effect measurement or elements being added to the display hierarchy.
Override this function to calculate the measured size of the element based on its styling, children, etc.
You should set the elements measured size by calling _setMeasuredSize() from within this function.
  padWidth     :    Number
Simply a convienence as padding typically effects measurement (but not always) depending on the component.
Use any supporting functions such as _getBorderThickness that are needed to measure the element.
  padHeight     :    Number
Simply a convienence as padding typically effects measurement (but not always) depending on the component.
Use any supporting functions such as _getBorderThickness that are needed to measure the element.
 
_doRender() CanvasElement
Lifecycle method for custom component development. Never call this function directly. The system
calls this function in response to changes that effect rendering or elements being added to the display hierarchy.
Override this function to render the element. Keep in mind that any child elements are rendered on top of this
element. This function is typically not needed unless rendering a very primitive object such as a custom skin or
a display object that cannot be handled via a BackgroundShape class and/or _fillBackground() function.
Most advanced objects should use skins and other means to render themselves.
CanvasElement draws its background and border via supplied shape and gradient settings.
 
_doStylesUpdated(stylesMap) CanvasElement
Lifecycle method for custom component development. Never call this function directly. The system
calls this function in response to style changes or elements being added to the display hierarchy.
Override this function to handle style changes to the element. Style changes may impact other styles,
event listeners, layout, measurement, rendering, etc. You should call appropriate _invalidate() method per style.
Note that style handling should not be dependent on the *current* state of a style. This function
should be able to run repeatedly with the same values. An example of when this may happen is if
an element is temporarily removed from the display hierarchy then added back. Whenever an element is added
all of its styles are invalidated. This is necessary as when an element is *not* part of the display chain
style changes are not tracked. So when an element is added there is no way to know which styles may have changed
hence all of them are invalidated.
  stylesMap     :    Object
An Object map containing all the style names that have been updated. Map contains entries {styleName:true}.
Elements should typically check this map before assuming a style has changed for performance reasons.
You should always call the base method. If you wish to override the style handling behavior of a specific style,
you can simply delete it from the map before passing it to the base function.
 
_drawBackgroundShape(ctx, borderMetrics) CanvasElement
Used to draw the path to the Canvas2DContext that is to be used to render the focus ring,
fill the background, and draw the border. You should never need to explicitly call this.
The system calls this during render phase.
Typically you should use the BackgroundShape style
for this, but may override it under more complex scenarios.
  ctx     :    Canvas2DContext
Canvas2DContext to draw the background shape path.
  borderMetrics     :    DrawMetrics
The DrawMetrics containing x,y,width,height used to draw the background. These
metrics should be the same as the ones used to stroke a solid border.
 
_drawBorder(ctx, borderMetrics) CanvasElement
Used to render the elements border according to the element's style settings.
You should never need to explicitly call this. The system calls this during
the render phase. You may override if you need to do a more complex border. The border
is rendered last, on top of the focus ring and background fill.
  ctx     :    Canvas2DContext
Canvas2DContext to render the border.
  borderMetrics     :    DrawMetrics
The DrawMetrics containing x,y,width,height used to draw the background. These
metrics should be the same as the ones used to stroke a solid border.
 
_drawFocusRing(ctx, borderMetrics) CanvasElement
Used to draw the focus ring when a tab-able element gains focus due to a tab stop per the elements styles.
You should never need to explicitly call this. The system calls this during
the render phase. You may override if you wish to draw a more complex focus indicator.
Focus ring is drawn *outside* the elements bounding box. Focus ring is rendered
before the background and border.
  ctx     :    Canvas2DContext
Canvas2DContext to render the focus ring.
  borderMetrics     :    DrawMetrics
The DrawMetrics containing x,y,width,height used to draw the background. These
metrics should be the same as the ones used to stroke a solid border.
 
_fillBackground(ctx, borderMetrics) CanvasElement
Used to fill the elements background shape according to the element's BackgroundShape and BackgroundFill styles.
You should never need to explicitly call this. The system calls this during
the render phase. You may override if you need to do a more complex background fill. The background fill
is rendered after the focus ring and before the border.
  ctx     :    Canvas2DContext
Canvas2DContext to fill the background shape.
  borderMetrics     :    DrawMetrics
The DrawMetrics containing x,y,width,height used to draw the background. These
metrics should be the same as the ones used to stroke a solid border.
 
_fillText(ctx, text, x, y, fontString, color, baseline) [Static] CanvasElement
Renders text on a character by character basis. Unfortunately, browsers will give
different widths for strings of text, than text measured character by character. It appears
text width changes depending on which characters are next to which characters. This behavior
cannot be used for text that requires highlighting or editing. This function records character
bitmaps per font in a map, and then uses that map to render characters. This surprisingly turns out to be
just as fast as rendering full text via the canvas context (since canvas sucks so bad at text rendering).
  ctx     :    Canvas2DContext
The canvas context to render the text.
  text     :    String
The text string to render.
  x     :    Number
The X coordinate to render the text.
  y     :    Number
The Y coordinate to render the text.
  fontString     :    String
Font styling to use when measuring. Use _getFontString()
  color     :    String
Hex color value to be used to render the text. Format like "#FF0000" (red).
  baseline     :    String
Text Y position relative to Y coordinate. ("top", "middle", or "bottom")
 
_getBorderMetrics() CanvasElement
Helper function that returns a DrawMetrics object whose bounding area is inside this elements border.
  returns     :    DrawMetrics
Returns DrawMetrics that define a bounding area inside this elements border.
 
_getBorderThickness() CanvasElement
Helper function that returns the elements border thickness per its applied styles.
  returns     :    Number
The elements border thickness.
 
_getChildAt(index) CanvasElement
Gets the child element at the supplied index.
  index     :    int
Index of child element to return;
  returns     :    CanvasElement
The element at the supplied index, or null if index is out of range.
 
_getChildIndex(element) CanvasElement
Returns the index of the supplied child element.
  element     :    CanvasElement
Child element to return the index.
  returns     :    int
Returns the child index or -1 if the element is not
a child of this element.
 
_getDefaultStyleList(styleName) CanvasElement
Gets the style values for the supplied style name in this elements
default style definition list and class list styles for the supplied style name.
This is used for sub styles as all stub styles in the list are applied to sub components.
This list should be supplied to the sub components default style definition list.
  styleName     :    String
String representing the default style list to return.
  returns     :    Array
Returns an array of all styles in this elements default definition and class list styles
for the associated style name.
 
_getFontString() CanvasElement
Gets a font string that can be applied to the canvas's Context2D via the element's text styles.
This is just a helper to gather and format the styles for the canvas context.
  returns     :    String
String to be applied to the canvas contex's font. "bold 14px Arial".
 
_getGraphicsCtx() CanvasElement
Returns the canvas context used when rendering this element. This should typically
only be called from within the element's _doRender() phase, and only if you intend
to actually draw. Calling this will impact the canvas redraw regions.
  returns     :    Canvas2DContext
Canvas context used when rendering this element.
 
_getNumChildren() CanvasElement
Gets this elements number of children.
  returns     :    int
The number of child elements.
 
_getNumStyleDefinitions(isDefault) CanvasElement
Gets the number of style definitions or default definitions associated with this element.
  isDefault     :    bool
When true, returns the number of default definitions.
  returns     :    int
The number of style definitions.
 
_getPaddingMetrics() CanvasElement
Helper function that returns a DrawMetrics object whose bounding area is inside this elements padding area.
  returns     :    DrawMetrics
Returns DrawMetrics that define a bounding area inside this elements padding area.
 
_getPaddingSize() CanvasElement
Helper function that returns the elements total padding width and height per its applied styles.
  returns     :    Object
Returns an object containing
{width:paddingWidth, height:paddingHeight,
paddingBottom:paddingBottom, paddingTop:paddingTop,
paddingLeft:paddingLeft, paddingRight:paddingRight}.
 
_getStyleDefinitionAt(index, isDefault) CanvasElement
Gets the style definition or default definition at the supplied zero base index.
  index     :    int
Index of the style definition to return;
  isDefault     :    bool
When true, returns the default definition at the supplied index.
  returns     :    StyleDefinition
The style defenition at the supplied index, or null if index is out of range.
 
_getStyledOrMeasuredHeight() CanvasElement
Helper function that returns this elements styled height, or measured height if no style is set. Typically
called from within a parent containers layout phase.
  returns     :    Number
The elements height.
 
_getStyledOrMeasuredWidth() CanvasElement
Helper function that returns this elements styled width, or measured width if no style is set. Typically
called from within a parent containers layout phase.
  returns     :    Number
The elements width.
 
_getStyleList(styleName) CanvasElement
Gets the style values for the supplied style name in this elements
style definition list and instance styles for the supplied style name.
This is used for sub styles as all stub styles in the list are applied to sub components.
This list should be supplied to the sub components style definition list.
  styleName     :    String
String representing the style list to return.
  returns     :    Array
Returns an array of all styles in this elements definition list and instance styles
for the associated style name.
 
_invalidateLayout() CanvasElement
Invalidates the elements child layout and causes the system to invoke doLayout() on
the next layout phase. The system calls this automatically for all existing components,
this is only necessary for custom component development.
This should only be called when a change is made to the element that will impact its layout.
Such as property changes or from within the elements doStylesUpdated() when a style change impacts
the element's layout (such as Padding). On rare occasions you may need to re-invalidate layout
from within the doLayout() function. An example is when a DataList adds a new DataRenderer it
re-invalidates layout to allow the renderer to measure before continuing layout.
Do not override this function.
 
_invalidateMeasure() CanvasElement
Invalidates the element's measured sizes and causes the system to invoke
doMeasure() on the next measure phase. The system calls this automatically for all
existing components, this is only necessary for custom component development.
This should only be called when a change is made
to the element that will impact its measurement. Such as property changes or from within the elements doStylesUpdated()
when a style change impacts the elements measurement (such as Padding). On rare occasions
you may need to re-invalidate measurement from within the doMeasure() function (such as wrapping text).
This will cause a 2nd measurement pass for that element which is valid (but expensive).
Do not override this function.
 
_invalidateRender() CanvasElement
Invalidates the elements child render and causes the system to invoke doRender() on
the next render phase. The system calls this automatically for all existing components,
this is only necessary for custom component development.
This should only be called when a change is made to the element that will impact its rendering.
Such as property changes or from within the elements doStylesUpdated() when a style change impacts
the element's rendering (such as BackgroundFill).
Do not override this function.
 
_invalidateStyle(styleName) CanvasElement
Invalidates the supplied style and causes the system to invoke the _doStylesChanged() function.
This should never concievably be called and is exclusively handled by the system.
This is the starting point for the element lifecycle. If you're program is dependent on
_doStylesChanged() when no styles have actually changed, you might have a design issue.
Do not override this function.
  styleName     :    String
String representing the style to be invalidated.
 
_measureText(text, fontString) [Static] CanvasElement
Measures text on a character by character basis. Unfortunately, browsers will give
different widths for strings of text, than text measured character by character. It appears
text width changes depending on which characters are next to which characters. This behavior
cannot be used for text that requires highlighting or editing. This function records the character
width per font in a map, and then uses that map to measure text widths. This surprisingly turns out to be
just as fast as measuring full text via the canvas context (since canvas sucks so bad at text rendering).
  text     :    String
The text string to measure.
  fontString     :    String
Font styling to use when measuring. Use _getFontString()
  returns     :    Number
Width of the text as measured via characters.
 
_onCanvasElementAdded(addedRemovedEvent) CanvasElement
Invoked when the element is added to the canvas. Every CanvasElement already adds its own
"added" event listener so overriding this is identical but more efficient than adding your own "added" event listener.
You should *always* call the base class function.
  addedRemovedEvent     :    AddedRemovedEvent
The AddedRemovedEvent to process.
 
_onCanvasElementRemoved(addedRemovedEvent) CanvasElement
Invoked when the element is removed to the canvas. Every CanvasElement already adds its own
"removed" event listener so overriding this is identical but more efficient than adding your own "removed" event listener.
You should *always* call the base class function.
  addedRemovedEvent     :    AddedRemovedEvent
The AddedRemovedEvent to process.
 
_removeChild(element) CanvasElement
Removes a child element from this elements child list.
  element     :    CanvasElement
Child to be removed.
  returns     :    CanvasElement
Returns the element just removed if successfull, null if the
element could not be removed due to it not being a child of this element.
 
_removeChildAt(index) CanvasElement
Removes a child element at specified index.
  index     :    int
Index to be removed.
  returns     :    CanvasElement
Returns the element just removed if successfull, null if the element could
not be removed due it it not being a child of this element, or index out of range.
 
_removeStyleDefinitionAt(index, isDefault) CanvasElement
Removes a style definition from this elements style definition or default definitions at the supplied index.
Default definitions are used when styling sub components with sub styles.
  index     :    int
Index to be removed.
  isDefault     :    bool
When true, removes the definition from the element's default definition list.
  returns     :    StyleDefinition
Returns the StyleDefinition just removed if successfull, null if the definition could
not be removed due it it not being in this elements definition list, or index out of range.
 
_setActualPosition(x, y) CanvasElement
Sets the elements position within its parent. Note that if the element is transformed or rotated,
this sets the elements position within its transformed plane. If you wish to position a transformed
element relative to its parents coordinate plane, use _setRelativePosition(). This should typically
only be called from within the parents layout phase.
  x     :    int
The X position to move the element.
  y     :    int
The Y position to move the element.
 
_setActualRotation(degrees, centerX, centerY) CanvasElement
Sets this elements rotation degrees and rotation point relative to its parent. This should typically
only be called from within the parent's layout phase.
  degrees     :    Number
Degrees to rotate the element (clockwise).
  centerX     :    Number
The X position relative to the elements parent to rotate around.
  centerY     :    Number
The Y position relative to the elements parent to rotate around.
 
_setActualSize(width, height) CanvasElement
Sets this element's size in pixels prior to any transformation or rotation.
This should typically only be called from within the parents layout phase.
  width     :    Number
The width in pixels to size this element.
  height     :    Number
The height in pixels to size this element.
 
_setChildIndex(element, index) CanvasElement
Changes a child element's index.
  element     :    CanvasElement
Child element to change index.
  index     :    int
New index of the child element.
  returns     :    boolean
Returns true if the child's index is successfully changed, false if the element
is not a child of this element or the index is out of range.
 
_setListData(listData, itemData) CanvasElement
This function is called when the element is being used as a DataRenderer for containers
like DataList and DataGrid. Override this function to make any changes to the DataRenderer
per the supplied DataListData and itemData objects. Update any styles, states, add/remove children, call any
necessary _invalidate() functions, etc.
  listData     :    DataListData
A DataListData or subclass object passed by the parent DataList or subclass with data necessary
to update the DataRender like the parent DataList reference and row/column index being rendered.
  itemData     :    Object
The data Object (such as row data) supplied by the implementor's ListCollection to render the row/column DataRenderer.
 
_setListSelected(selectedData) CanvasElement
This function is called when the element is being used as a DataRenderer for containers
like DataList and DataGrid to change the DataRenderer's selection state.
Override this function to make any changes to the DataRenderer per the selection state.
Update any styles, states, add/remove children, call any necessary _invalidate() functions, etc.
  selectedData     :    Any
Selected data, differs per container.
 
_setRelativePosition(x, y, relativeToElement) CanvasElement
Sets the elements position relative to a supplied element regardless of this element's transformation,
depth, or position in the display hierarchy or relation to the supplied relativeToElement. This should typically
only be called during the parent element's layout phase. Setting relativeToElement to null has an identical
effect to calling _setActualPosition(). This is used by some containers to position the element relative
to a parent's coordinate plane rather than the child's transformed plane.
  x     :    Number
The relative X position to move this element's position.
  y     :    Number
The relative Y position to move this element's position.
  relativeToElement     :    CanvasElement
The CanvasElement to move this element relative too.
 
_setStyleDefinitions(styleDefinitions, isDefault, styleNamesChangedMap) CanvasElement
Replaces the elements current style definition or default definition lists.
This is more effecient than removing or adding style definitions one at a time.
Default definitions are used when styling sub components with sub styles.
  styleDefinitions     :    StyleDefinition
May be a StyleDefinition, or an Array of StyleDefinition
  isDefault     :    bool
When true, replaces the default definition list.
  styleNamesChangedMap     :    Object
Optional - A empty map object - Object.create(null) to populate style changes
due to swapping definitions while this element is attached to the display chain.
When specified (not null), does not automatically invoke style changed events.
 
_setStyleProxy(styleProxy) CanvasElement
Sets the element which is to proxy styles to this element. See getStyle() and StyleProxy.
This should be set prior to added this element to the display hierarchy via addElement() or _addChild().
  styleProxy     :    StyleProxy
The StyleProxy element wrapper to use to proxy styles from the proxy element to this element.
 
_strokeText(ctx, text, x, y, fontString, color, baseline) [Static] CanvasElement
Renders text on a character by character basis. Unfortunately, browsers will give
different widths for strings of text, than text measured character by character. It appears
text width changes depending on which characters are next to which characters. This behavior
cannot be used for text that requires highlighting or editing. This function records character
bitmaps per font in a map, and then uses that map to render characters. This surprisingly turns out to be
just as fast as rendering full text via the canvas context (since canvas sucks so bad at text rendering).
  ctx     :    Canvas2DContext
The canvas context to render the text.
  text     :    String
The text string to render.
  x     :    Number
The X coordinate to render the text (Upper left).
  y     :    Number
The Y coordinate to render the text (Uppder left).
  fontString     :    String
Font styling to use when measuring. Use _getFontString()
  color     :    String
Hex color value to be used to render the text. Format like "#FF0000" (red).
  baseline     :    String
Text Y position relative to Y coordinate. ("top", "middle", or "bottom")