libRocket
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Friends | List of all members
Rocket::Core::Element Class Reference

#include <Element.h>

Inheritance diagram for Rocket::Core::Element:
Rocket::Core::ScriptInterface Rocket::Core::ReferenceCountable Rocket::Controls::ElementDataGrid Rocket::Controls::ElementDataGridCell Rocket::Controls::ElementDataGridExpandButton Rocket::Controls::ElementDataGridRow Rocket::Controls::ElementForm Rocket::Controls::ElementFormControl Rocket::Controls::ElementTabSet Rocket::Core::ElementDocument Rocket::Core::ElementText

Public Member Functions

 Element (const String &tag)
 
virtual ~Element ()
 
void Update ()
 
void Render ()
 
Element * Clone () const
 Clones this element, returning a new, unparented element. More...
 
virtual StyleSheet * GetStyleSheet () const
 
const ElementDefinition * GetDefinition ()
 
String GetAddress (bool include_pseudo_classes=false) const
 
void SetOffset (const Vector2f &offset, Element *offset_parent, bool offset_fixed=false)
 
Vector2f GetRelativeOffset (Box::Area area=Box::CONTENT)
 
Vector2f GetAbsoluteOffset (Box::Area area=Box::CONTENT)
 
void SetClientArea (Box::Area client_area)
 
Box::Area GetClientArea () const
 
void SetContentBox (const Vector2f &content_offset, const Vector2f &content_box)
 
void SetBox (const Box &box)
 
void AddBox (const Box &box)
 
const Box & GetBox (int index=0)
 
int GetNumBoxes ()
 
virtual float GetBaseline () const
 
virtual bool GetIntrinsicDimensions (Vector2f &dimensions)
 
virtual bool IsPointWithinElement (const Vector2f &point)
 
bool IsVisible () const
 
float GetZIndex () const
 
FontFaceHandle * GetFontFaceHandle () const
 
Element * GetFocusLeafNode ()
 
Context * GetContext ()
 
int GetClippingIgnoreDepth ()
 Returns true if this element requires clipping. More...
 
bool IsClippingEnabled ()
 Returns true if this element has clipping enabled. More...
 
RenderInterface * GetRenderInterface ()
 
void SetInstancer (ElementInstancer *instancer)
 
virtual void ProcessEvent (Event &event)
 
void UpdateLayout ()
 Update the element's layout if required. More...
 
Classes
void SetClass (const String &class_name, bool activate)
 
bool IsClassSet (const String &class_name) const
 
void SetClassNames (const String &class_names)
 
String GetClassNames () const
 
Properties
bool SetProperty (const String &name, const String &value)
 
bool SetProperty (const String &name, const Property &property)
 
void RemoveProperty (const String &name)
 
const Property * GetProperty (const String &name)
 
template<typename T >
T GetProperty (const String &name)
 
const Property * GetLocalProperty (const String &name)
 
float ResolveProperty (const String &name, float base_value)
 
float ResolveProperty (const Property *property, float base_value)
 
void GetBorderWidthProperties (const Property **border_top_width, const Property **border_bottom_width, const Property **border_left_width, const Property **border_right_width)
 Returns 'border-width' properties from element's style or local cache. More...
 
void GetMarginProperties (const Property **margin_top, const Property **margin_bottom, const Property **margin_left, const Property **margin_right)
 Returns 'margin' properties from element's style or local cache. More...
 
void GetPaddingProperties (const Property **padding_top, const Property **padding_bottom, const Property **padding_left, const Property **padding_right)
 Returns 'padding' properties from element's style or local cache. More...
 
void GetDimensionProperties (const Property **width, const Property **height)
 Returns 'width' and 'height' properties from element's style or local cache. More...
 
void GetLocalDimensionProperties (const Property **width, const Property **height)
 
void GetOverflow (int *overflow_x, int *overflow_y)
 Returns 'overflow' properties' values from element's style or local cache. More...
 
int GetPosition ()
 Returns 'position' property value from element's style or local cache. More...
 
int GetFloat ()
 Returns 'float' property value from element's style or local cache. More...
 
int GetDisplay ()
 Returns 'display' property value from element's style or local cache. More...
 
int GetWhitespace ()
 Returns 'white-space' property value from element's style or local cache. More...
 
const Property * GetLineHeightProperty ()
 Returns 'line-height' property value from element's style or local cache. More...
 
int GetTextAlign ()
 Returns 'text-align' property value from element's style or local cache. More...
 
int GetTextTransform ()
 Returns 'text-transform' property value from element's style or local cache. More...
 
const Property * GetVerticalAlignProperty ()
 Returns 'vertical-align' property value from element's style or local cache. More...
 
bool IterateProperties (int &index, PseudoClassList &pseudo_classes, String &name, const Property *&property) const
 
Pseudo-classes
void SetPseudoClass (const String &pseudo_class, bool activate)
 
bool IsPseudoClassSet (const String &pseudo_class) const
 
bool ArePseudoClassesSet (const PseudoClassList &pseudo_classes) const
 
const PseudoClassList & GetActivePseudoClasses () const
 
Attributes
template<typename T >
void SetAttribute (const String &name, const T &value)
 
Variant * GetAttribute (const String &name) const
 
template<typename T >
T GetAttribute (const String &name, const T &default_value) const
 
bool HasAttribute (const String &name)
 
void RemoveAttribute (const String &name)
 
void SetAttributes (const ElementAttributes *attributes)
 
template<typename T >
bool IterateAttributes (int &index, String &name, T &value) const
 
int GetNumAttributes () const
 
Decorators
bool IterateDecorators (int &index, PseudoClassList &pseudo_classes, String &name, Decorator *&decorator, DecoratorDataHandle &decorator_data)
 
DOM Properties
const String & GetTagName () const
 
const String & GetId () const
 
void SetId (const String &id)
 
float GetAbsoluteLeft ()
 
float GetAbsoluteTop ()
 
float GetClientLeft ()
 
float GetClientTop ()
 
float GetClientWidth ()
 
float GetClientHeight ()
 
Element * GetOffsetParent ()
 
float GetOffsetLeft ()
 
float GetOffsetTop ()
 
float GetOffsetWidth ()
 
float GetOffsetHeight ()
 
float GetScrollLeft ()
 
void SetScrollLeft (float scroll_left)
 
float GetScrollTop ()
 
void SetScrollTop (float scroll_top)
 
float GetScrollWidth ()
 
float GetScrollHeight ()
 
ElementStyle * GetStyle ()
 
virtual ElementDocument * GetOwnerDocument ()
 
Element * GetParentNode () const
 
Element * GetNextSibling () const
 
Element * GetPreviousSibling () const
 
Element * GetFirstChild () const
 
Element * GetLastChild () const
 
Element * GetChild (int index) const
 
int GetNumChildren (bool include_non_dom_elements=false) const
 
virtual void GetInnerRML (String &content) const
 
String GetInnerRML () const
 
void SetInnerRML (const String &rml)
 
DOM Methods
bool Focus ()
 
void Blur ()
 Removes focus from from this element. More...
 
void Click ()
 Fakes a mouse click on this element. More...
 
void AddEventListener (const String &event, EventListener *listener, bool in_capture_phase=false)
 
void RemoveEventListener (const String &event, EventListener *listener, bool in_capture_phase=false)
 
bool DispatchEvent (const String &event, const Dictionary &parameters, bool interruptible=false)
 
void ScrollIntoView (bool align_with_top=true)
 
void AppendChild (Element *element, bool dom_element=true)
 
void InsertBefore (Element *element, Element *adjacent_element)
 
bool ReplaceChild (Element *inserted_element, Element *replaced_element)
 
bool RemoveChild (Element *element)
 
bool HasChildNodes () const
 
Element * GetElementById (const String &id)
 
void GetElementsByTagName (ElementList &elements, const String &tag)
 
void GetElementsByClassName (ElementList &elements, const String &class_name)
 
Internal Functions
EventDispatcher * GetEventDispatcher () const
 
ElementBackground * GetElementBackground () const
 
ElementBorder * GetElementBorder () const
 
ElementDecoration * GetElementDecoration () const
 
ElementScroll * GetElementScroll () const
 
- Public Member Functions inherited from Rocket::Core::ScriptInterface
virtual ~ScriptInterface ()
 
virtual ScriptObject GetScriptObject () const
 
- Public Member Functions inherited from Rocket::Core::ReferenceCountable
 ReferenceCountable (int initial_count=1)
 
virtual ~ReferenceCountable ()
 Destructor. The reference count must be 0 when this is invoked. More...
 
virtual int GetReferenceCount ()
 Returns the number of references outstanding against this object. More...
 
virtual void AddReference ()
 Increases the reference count. If this pushes the count above 0, OnReferenceActivate() will be called. More...
 
virtual void RemoveReference ()
 Decreases the reference count. If this pushes the count to 0, OnReferenceDeactivate() will be called. More...
 
ReferenceCountable & operator= (const ReferenceCountable &copy)
 Catches incorrect copy attempts. More...
 

Protected Member Functions

void ForceLocalStackingContext ()
 
virtual void OnUpdate ()
 Called during the update loop after children are updated. More...
 
virtual void OnRender ()
 Called during render after backgrounds, borders, decorators, but before children, are rendered. More...
 
virtual void OnLayout ()
 Called during a layout operation, when the element is being positioned and sized. More...
 
virtual void OnAttributeChange (const AttributeNameList &changed_attributes)
 
virtual void OnPropertyChange (const PropertyNameList &changed_properties)
 
virtual void OnChildAdd (Element *child)
 Called when a child node has been added somewhere in the hierarchy. More...
 
virtual void OnChildRemove (Element *child)
 Called when a child node has been removed somewhere in the hierarchy. More...
 
virtual void DirtyLayout ()
 Forces a re-layout of this element, and any other elements required. More...
 
virtual bool IsLayoutDirty ()
 Returns true if the element has been marked as needing a re-layout. More...
 
virtual void LockLayout (bool lock)
 Increment/Decrement the layout lock. More...
 
virtual void DirtyFont ()
 Forces a reevaluation of applicable font effects. More...
 
virtual void GetRML (String &content)
 
virtual void OnReferenceDeactivate ()
 A hook method called when the reference count drops to 0. More...
 
- Protected Member Functions inherited from Rocket::Core::ReferenceCountable
virtual void OnReferenceActivate ()
 A hook method called when the reference count climbs from 0. More...
 

Friends

class Context
 
class ElementStyle
 
class LayoutEngine
 
class LayoutInlineBox
 

Additional Inherited Members

- Static Public Member Functions inherited from Rocket::Core::ReferenceCountable
static void DumpLeakReport ()
 If any reference countable objects are still allocated, this function will write a leak report to the log. More...
 

Detailed Description

A generic element in the DOM tree.

Author
Peter Curry

Constructor & Destructor Documentation

Rocket::Core::Element::Element ( const String &  tag)

Constructs a new libRocket element. This should not be called directly; use the Factory instead.

Parameters
[in]tagThe tag the element was declared as in RML.
virtual Rocket::Core::Element::~Element ( )
virtual

Member Function Documentation

void Rocket::Core::Element::AddBox ( const Box &  box)

Adds a box to the end of the list describing this element's geometry.

Parameters
[in]boxThe auxiliary box for the element.
void Rocket::Core::Element::AddEventListener ( const String &  event,
EventListener *  listener,
bool  in_capture_phase = false 
)

Adds an event listener to this element.

Parameters
[in]eventEvent to attach to.
[in]listenerThe listener object to be attached.
[in]in_capture_phaseTrue to attach in the capture phase, false in bubble phase.
void Rocket::Core::Element::AppendChild ( Element *  element,
bool  dom_element = true 
)

Append a child to this element.

Parameters
[in]elementThe element to append as a child.
[in]dom_elementTrue if the element is to be part of the DOM, false otherwise. Only set this to false if you know what you're doing!
bool Rocket::Core::Element::ArePseudoClassesSet ( const PseudoClassList &  pseudo_classes) const

Checks if a complete set of pseudo-classes are set on the element.

Parameters
[in]pseudo_classesThe set of pseudo-classes to check for.
Returns
True if all of the pseudo-classes are set, false if not.
void Rocket::Core::Element::Blur ( )

Removes focus from from this element.

void Rocket::Core::Element::Click ( )

Fakes a mouse click on this element.

Element* Rocket::Core::Element::Clone ( ) const

Clones this element, returning a new, unparented element.

virtual void Rocket::Core::Element::DirtyFont ( )
protectedvirtual

Forces a reevaluation of applicable font effects.

virtual void Rocket::Core::Element::DirtyLayout ( )
protectedvirtual

Forces a re-layout of this element, and any other elements required.

Reimplemented in Rocket::Core::ElementDocument.

bool Rocket::Core::Element::DispatchEvent ( const String &  event,
const Dictionary &  parameters,
bool  interruptible = false 
)

Sends an event to this element.

Parameters
[in]eventName of the event in string form.
[in]parametersThe event parameters.
[in]interruptibleTrue if the propagation of the event be stopped.
Returns
True if the event was not consumed (ie, was prevented from propagating by an element), false if it was.
bool Rocket::Core::Element::Focus ( )

Gives focus to the current element.

Returns
True if the change focus request was successful
void Rocket::Core::Element::ForceLocalStackingContext ( )
protected

Forces the element to generate a local stacking context, regardless of the value of its z-index property.

float Rocket::Core::Element::GetAbsoluteLeft ( )

Gets the horizontal offset from the context's left edge to element's left border edge.

Returns
The horizontal offset of the element within its context, in pixels.
Vector2f Rocket::Core::Element::GetAbsoluteOffset ( Box::Area  area = Box::CONTENT)

Returns the position of the top-left corner of one of the areas of this element's primary box, relative to the element root.

Parameters
[in]areaThe desired area position.
Returns
The absolute offset.
float Rocket::Core::Element::GetAbsoluteTop ( )

Gets the vertical offset from the context's top edge to element's top border edge.

Returns
The vertical offset of the element within its context, in pixels.
const PseudoClassList& Rocket::Core::Element::GetActivePseudoClasses ( ) const

Gets a list of the current active pseudo-classes.

Returns
The list of active pseudo-classes.
String Rocket::Core::Element::GetAddress ( bool  include_pseudo_classes = false) const

Fills a string with the full address of this element.

Parameters
[in]include_pseudo_classesTrue if the address is to include the pseudo-classes of the leaf element.
Returns
The address of the element, including its full parentage.
Variant* Rocket::Core::Element::GetAttribute ( const String &  name) const

Gets the specified attribute.

Parameters
[in]nameName of the attribute to retrieve.
Returns
A variant representing the attribute, or NULL if the attribute doesn't exist.
template<typename T >
T Rocket::Core::Element::GetAttribute ( const String &  name,
const T &  default_value 
) const

Gets the specified attribute, with default value.

Parameters
[in]nameName of the attribute to retrieve.
[in]default_valueValue to return if the attribute doesn't exist.
virtual float Rocket::Core::Element::GetBaseline ( ) const
virtual

Returns the baseline of the element, in pixels offset from the bottom of the element's content area.

Returns
The element's baseline. A negative baseline will be further 'up' the element, a positive on further 'down'. The default element will return 0.
void Rocket::Core::Element::GetBorderWidthProperties ( const Property **  border_top_width,
const Property **  border_bottom_width,
const Property **  border_left_width,
const Property **  border_right_width 
)

Returns 'border-width' properties from element's style or local cache.

const Box& Rocket::Core::Element::GetBox ( int  index = 0)

Returns one of the boxes describing the size of the element.

Parameters
[in]indexThe index of the desired box. If this is outside of the bounds of the element's list of boxes, it will be clamped.
Returns
The requested box.
Element* Rocket::Core::Element::GetChild ( int  index) const

Get the child element at the given index.

Parameters
[in]indexIndex of child to get.
Returns
The child element at the given index.
String Rocket::Core::Element::GetClassNames ( ) const

Return the active class list.

Returns
The space-separated list of classes active on the element.
Box::Area Rocket::Core::Element::GetClientArea ( ) const

Returns the area the element uses as its client area.

Returns
The box area used as the element's client area.
float Rocket::Core::Element::GetClientHeight ( )

Gets the height of the element's client area. This is usually the padded area less the horizontal scrollbar height, but may be the content area for some replaced elements.

Returns
The inner height of the element, usually including padding but not the horizontal scrollbar height, border or margin.
float Rocket::Core::Element::GetClientLeft ( )

Gets the horizontal offset from the element's left border edge to the left edge of its client area. This is usually the edge of the padding, but may be the content area for some replaced elements.

Returns
The horizontal offset of the element's client area, in pixels.
float Rocket::Core::Element::GetClientTop ( )

Gets the vertical offset from the element's top border edge to the top edge of its client area. This is usually the edge of the padding, but may be the content area for some replaced elements.

Returns
The vertical offset of the element's client area, in pixels.
float Rocket::Core::Element::GetClientWidth ( )

Gets the width of the element's client area. This is usually the padded area less the vertical scrollbar width, but may be the content area for some replaced elements.

Returns
The width of the element's client area, usually including padding but not the vertical scrollbar width, border or margin.
int Rocket::Core::Element::GetClippingIgnoreDepth ( )

Returns true if this element requires clipping.

Context* Rocket::Core::Element::GetContext ( )

Returns the element's context.

Returns
The context this element's document exists within.
const ElementDefinition* Rocket::Core::Element::GetDefinition ( )

Returns the element's definition, updating if necessary.

Returns
The element's definition.
void Rocket::Core::Element::GetDimensionProperties ( const Property **  width,
const Property **  height 
)

Returns 'width' and 'height' properties from element's style or local cache.

int Rocket::Core::Element::GetDisplay ( )

Returns 'display' property value from element's style or local cache.

ElementBackground* Rocket::Core::Element::GetElementBackground ( ) const

Access the element background.

Returns
The element's background.
ElementBorder* Rocket::Core::Element::GetElementBorder ( ) const

Access the element border.

Returns
The element's boder.
Element* Rocket::Core::Element::GetElementById ( const String &  id)

Get a child element by its ID.

Parameters
[in]idId of the the child element
Returns
The child of this element with the given ID, or NULL if no such child exists.
ElementDecoration* Rocket::Core::Element::GetElementDecoration ( ) const

Access the element decorators.

Returns
The element decoration.
void Rocket::Core::Element::GetElementsByClassName ( ElementList &  elements,
const String &  class_name 
)

Get all descendant elements with the given class set on them.

Parameters
[out]elementsResulting elements.
[in]tagTag to search for.
void Rocket::Core::Element::GetElementsByTagName ( ElementList &  elements,
const String &  tag 
)

Get all descendant elements with the given tag.

Parameters
[out]elementsResulting elements.
[in]tagTag to search for.
ElementScroll* Rocket::Core::Element::GetElementScroll ( ) const

Returns the element's scrollbar functionality.

Returns
The element's scrolling functionality.
EventDispatcher* Rocket::Core::Element::GetEventDispatcher ( ) const

Access the event dispatcher for this element.

Returns
The element's dispatcher.
Element* Rocket::Core::Element::GetFirstChild ( ) const

Returns the first child of this element.

Returns
This element's first child, or NULL if it contains no children.
int Rocket::Core::Element::GetFloat ( )

Returns 'float' property value from element's style or local cache.

Element* Rocket::Core::Element::GetFocusLeafNode ( )

Gets the outer-most focus element down the tree from this node.

Returns
Outer-most focus element.
FontFaceHandle* Rocket::Core::Element::GetFontFaceHandle ( ) const

Returns the element's font face handle.

Returns
The element's font face handle.
const String& Rocket::Core::Element::GetId ( ) const

Gets the id of the element.

Returns
The element's id.
virtual void Rocket::Core::Element::GetInnerRML ( String &  content) const
virtual

Gets the markup and content of the element.

Parameters
[out]contentThe content of the element.

Reimplemented in Rocket::Controls::ElementDataGrid, and Rocket::Controls::ElementFormControlTextArea.

String Rocket::Core::Element::GetInnerRML ( ) const

Gets the markup and content of the element.

Returns
The content of the element.
virtual bool Rocket::Core::Element::GetIntrinsicDimensions ( Vector2f &  dimensions)
virtual

Gets the intrinsic dimensions of this element, if it is of a type that has an inherent size. This size will only be overriden by a styled width or height.

Parameters
[in]dimensionsThe dimensions to size, if appropriate.
Returns
True if the element has intrinsic dimensions, false otherwise. The default element will return false.

Reimplemented in Rocket::Controls::ElementFormControlSelect, Rocket::Controls::ElementFormControlTextArea, and Rocket::Controls::ElementFormControlInput.

Element* Rocket::Core::Element::GetLastChild ( ) const

Gets the last child of this element.

Returns
This element's last child, or NULL if it contains no children.
const Property* Rocket::Core::Element::GetLineHeightProperty ( )

Returns 'line-height' property value from element's style or local cache.

void Rocket::Core::Element::GetLocalDimensionProperties ( const Property **  width,
const Property **  height 
)

Returns local 'width' and 'height' properties from element's style or local cache, ignoring default values.

const Property* Rocket::Core::Element::GetLocalProperty ( const String &  name)

Returns one of this element's properties. If this element is not defined this property, NULL will be returned.

Parameters
[in]nameThe name of the property to fetch the value for.
Returns
The value of this property for this element, or NULL if this property has not been explicitly defined for this element.
void Rocket::Core::Element::GetMarginProperties ( const Property **  margin_top,
const Property **  margin_bottom,
const Property **  margin_left,
const Property **  margin_right 
)

Returns 'margin' properties from element's style or local cache.

Element* Rocket::Core::Element::GetNextSibling ( ) const

Gets the element immediately following this one in the tree.

Returns
This element's next sibling element, or NULL if there is no sibling element.
int Rocket::Core::Element::GetNumAttributes ( ) const

Returns the number of attributes on the element.

Returns
The number of attributes on the element.
int Rocket::Core::Element::GetNumBoxes ( )

Returns the number of boxes making up this element's geometry.

Returns
the number of boxes making up this element's geometry.
int Rocket::Core::Element::GetNumChildren ( bool  include_non_dom_elements = false) const

Get the current number of children in this element

Parameters
[in]include_non_dom_elementsTrue if the caller wants to include the non DOM children. Only set this to true if you know what you're doing!
Returns
The number of children.
float Rocket::Core::Element::GetOffsetHeight ( )

Gets the height of the element, including the client area, padding, borders and scrollbars, but not margins.

Returns
The height of the rendered element, in pixels.
float Rocket::Core::Element::GetOffsetLeft ( )

Gets the distance from this element's left border to its offset parent's left border.

Returns
The horizontal distance (in pixels) from this element's offset parent to itself.
Element* Rocket::Core::Element::GetOffsetParent ( )

Returns the element from which all offset calculations are currently computed.

Returns
This element's offset parent.
float Rocket::Core::Element::GetOffsetTop ( )

Gets the distance from this element's top border to its offset parent's top border.

Returns
The vertical distance (in pixels) from this element's offset parent to itself.
float Rocket::Core::Element::GetOffsetWidth ( )

Gets the width of the element, including the client area, padding, borders and scrollbars, but not margins.

Returns
The width of the rendered element, in pixels.
void Rocket::Core::Element::GetOverflow ( int *  overflow_x,
int *  overflow_y 
)

Returns 'overflow' properties' values from element's style or local cache.

virtual ElementDocument* Rocket::Core::Element::GetOwnerDocument ( )
virtual

Gets the document this element belongs to.

Returns
This element's document.

Reimplemented in Rocket::Core::ElementDocument.

void Rocket::Core::Element::GetPaddingProperties ( const Property **  padding_top,
const Property **  padding_bottom,
const Property **  padding_left,
const Property **  padding_right 
)

Returns 'padding' properties from element's style or local cache.

Element* Rocket::Core::Element::GetParentNode ( ) const

Gets this element's parent node.

Returns
This element's parent.
int Rocket::Core::Element::GetPosition ( )

Returns 'position' property value from element's style or local cache.

Element* Rocket::Core::Element::GetPreviousSibling ( ) const

Gets the element immediately preceding this one in the tree.

Returns
This element's previous sibling element, or NULL if there is no sibling element.
const Property* Rocket::Core::Element::GetProperty ( const String &  name)

Returns one of this element's properties. If this element is not defined this property, or a parent cannot be found that we can inherit the property from, the default value will be returned.

Parameters
[in]nameThe name of the property to fetch the value for.
Returns
The value of this property for this element, or NULL if no property exists with the given name.
template<typename T >
T Rocket::Core::Element::GetProperty ( const String &  name)

Returns the values of one of this element's properties.

Parameters
[in]nameThe name of the property to get.
Returns
The value of this property.
Vector2f Rocket::Core::Element::GetRelativeOffset ( Box::Area  area = Box::CONTENT)

Returns the position of the top-left corner of one of the areas of this element's primary box, relative to its offset parent's top-left border corner.

Parameters
[in]areaThe desired area position.
Returns
The relative offset.
RenderInterface* Rocket::Core::Element::GetRenderInterface ( )

Gets the render interface owned by this element's context.

Returns
The element's context's render interface.
virtual void Rocket::Core::Element::GetRML ( String &  content)
protectedvirtual

Returns the RML of this element and all children.

Parameters
[out]contentThe content of this element and those under it, in XML form.
float Rocket::Core::Element::GetScrollHeight ( )

Gets the height of the scrollable content of the element; it includes the element padding but not its margin.

Returns
The height (in pixels) of the of the scrollable content of the element.
float Rocket::Core::Element::GetScrollLeft ( )

Gets the left scroll offset of the element.

Returns
The element's left scroll offset.
float Rocket::Core::Element::GetScrollTop ( )

Gets the top scroll offset of the element.

Returns
The element's top scroll offset.
float Rocket::Core::Element::GetScrollWidth ( )

Gets the width of the scrollable content of the element; it includes the element padding but not its margin.

Returns
The width (in pixels) of the of the scrollable content of the element.
ElementStyle* Rocket::Core::Element::GetStyle ( )

Gets the object representing the declarations of an element's style attributes.

Returns
The element's style.
virtual StyleSheet* Rocket::Core::Element::GetStyleSheet ( ) const
virtual

Returns the active style sheet for this element. This may be NULL.

Returns
The element's style sheet.

Reimplemented in Rocket::Core::ElementDocument.

const String& Rocket::Core::Element::GetTagName ( ) const

Gets the name of the element.

Returns
The name of the element.
int Rocket::Core::Element::GetTextAlign ( )

Returns 'text-align' property value from element's style or local cache.

int Rocket::Core::Element::GetTextTransform ( )

Returns 'text-transform' property value from element's style or local cache.

const Property* Rocket::Core::Element::GetVerticalAlignProperty ( )

Returns 'vertical-align' property value from element's style or local cache.

int Rocket::Core::Element::GetWhitespace ( )

Returns 'white-space' property value from element's style or local cache.

float Rocket::Core::Element::GetZIndex ( ) const

Returns the z-index of the element.

Returns
The element's z-index.
bool Rocket::Core::Element::HasAttribute ( const String &  name)

Checks if the element has a certain attribute.

Parameters
[in]nameThe name of the attribute to check for.
Returns
True if the element has the given attribute, false if not.
bool Rocket::Core::Element::HasChildNodes ( ) const

Returns whether or not this element has any DOM children.

Returns
True if the element has at least one DOM child, false otherwise.
void Rocket::Core::Element::InsertBefore ( Element *  element,
Element *  adjacent_element 
)

Adds a child to this element, directly after the adjacent element. The new element inherits the DOM/non-DOM status from the adjacent element.

Parameters
[in]elementElement to insert into the this element.
[in]adjacent_elementThe element to insert directly before.
bool Rocket::Core::Element::IsClassSet ( const String &  class_name) const

Checks if a class is set on the element.

Parameters
[in]class_nameThe name of the class to check for.
Returns
True if the class is set on the element, false otherwise.
bool Rocket::Core::Element::IsClippingEnabled ( )

Returns true if this element has clipping enabled.

virtual bool Rocket::Core::Element::IsLayoutDirty ( )
protectedvirtual

Returns true if the element has been marked as needing a re-layout.

Reimplemented in Rocket::Core::ElementDocument.

virtual bool Rocket::Core::Element::IsPointWithinElement ( const Vector2f &  point)
virtual

Checks if a given point in screen coordinates lies within the bordered area of this element.

Parameters
[in]pointThe point to test.
Returns
True if the element is within this element, false otherwise.
bool Rocket::Core::Element::IsPseudoClassSet ( const String &  pseudo_class) const

Checks if a specific pseudo-class has been set on the element.

Parameters
[in]pseudo_classThe name of the pseudo-class to check for.
Returns
True if the pseudo-class is set on the element, false if not.
bool Rocket::Core::Element::IsVisible ( ) const

Returns the visibility of the element.

Returns
True if the element is visible, false otherwise.
template<typename T >
bool Rocket::Core::Element::IterateAttributes ( int &  index,
String &  name,
T &  value 
) const

Iterates over the attributes.

Parameters
[in,out]indexIndex to fetch. This is incremented after the fetch.
[out]nameName of the attribute at the specified index
[out]valueValue of the attribute at the specified index.
Returns
True if an attribute was successfully fetched.
bool Rocket::Core::Element::IterateDecorators ( int &  index,
PseudoClassList &  pseudo_classes,
String &  name,
Decorator *&  decorator,
DecoratorDataHandle &  decorator_data 
)

Iterates over all decorators attached to the element. Note that all decorators are iterated over, not just active ones.

Parameters
[in,out]indexIndex to fetch. This is incremented after the fetch.
[out]pseudo_classesThe pseudo-classes the decorator required to be active before it renders.
[out]nameThe name of the decorator at the specified index.
[out]decoratorThe decorator at the specified index.
[out]decorator_dataThis element's handle to any data is has stored against the decorator.
Returns
True if a decorator was successfully fetched, false if not.
bool Rocket::Core::Element::IterateProperties ( int &  index,
PseudoClassList &  pseudo_classes,
String &  name,
const Property *&  property 
) const

Iterates over the properties defined on this element.

Parameters
[in,out]indexIndex of the property to fetch. This is incremented to the next valid index after the fetch. Indices are not necessarily incremental.
[out]pseudo_classesThe pseudo-classes the property is defined by.
[out]nameThe name of the property at the specified index.
[out]propertyThe property at the specified index.
Returns
True if a property was successfully fetched.
virtual void Rocket::Core::Element::LockLayout ( bool  lock)
protectedvirtual

Increment/Decrement the layout lock.

Reimplemented in Rocket::Core::ElementDocument.

virtual void Rocket::Core::Element::OnAttributeChange ( const AttributeNameList &  changed_attributes)
protectedvirtual

Called when attributes on the element are changed.

Parameters
[in]changed_attributesThe attributes changed on the element.

Reimplemented in Rocket::Controls::ElementFormControlTextArea, Rocket::Controls::ElementFormControl, Rocket::Controls::ElementFormControlInput, and Rocket::Controls::ElementFormControlDataSelect.

virtual void Rocket::Core::Element::OnChildAdd ( Element *  child)
protectedvirtual

Called when a child node has been added somewhere in the hierarchy.

Reimplemented in Rocket::Controls::ElementTabSet, and Rocket::Controls::ElementFormControlInput.

virtual void Rocket::Core::Element::OnChildRemove ( Element *  child)
protectedvirtual

Called when a child node has been removed somewhere in the hierarchy.

Reimplemented in Rocket::Controls::ElementTabSet, and Rocket::Controls::ElementFormControlInput.

virtual void Rocket::Core::Element::OnLayout ( )
protectedvirtual

Called during a layout operation, when the element is being positioned and sized.

Reimplemented in Rocket::Controls::ElementFormControlTextArea, and Rocket::Controls::ElementFormControlSelect.

virtual void Rocket::Core::Element::OnPropertyChange ( const PropertyNameList &  changed_properties)
protectedvirtual

Called when properties on the element are changed.

Parameters
[in]changed_propertiesThe properties changed on the element.

Reimplemented in Rocket::Core::ElementDocument, Rocket::Controls::ElementFormControlTextArea, and Rocket::Controls::ElementFormControlInput.

virtual void Rocket::Core::Element::OnReferenceDeactivate ( )
protectedvirtual

A hook method called when the reference count drops to 0.

Reimplemented from Rocket::Core::ReferenceCountable.

virtual void Rocket::Core::Element::OnRender ( )
protectedvirtual

Called during render after backgrounds, borders, decorators, but before children, are rendered.

Reimplemented in Rocket::Controls::ElementFormControlTextArea, Rocket::Controls::ElementFormControlSelect, and Rocket::Controls::ElementFormControlInput.

virtual void Rocket::Core::Element::OnUpdate ( )
protectedvirtual
virtual void Rocket::Core::Element::ProcessEvent ( Event &  event)
virtual

Called for every event sent to this element or one of its descendants.

Parameters
[in]eventThe event to process.

Reimplemented in Rocket::Core::ElementDocument, Rocket::Controls::ElementDataGrid, Rocket::Controls::ElementFormControlInput, Rocket::Controls::ElementTabSet, Rocket::Controls::ElementDataGridCell, and Rocket::Controls::ElementDataGridExpandButton.

void Rocket::Core::Element::RemoveAttribute ( const String &  name)

Removes the attribute from the element.

Parameters
[in]nameName of the attribute.
bool Rocket::Core::Element::RemoveChild ( Element *  element)

Remove a child element from this element.

Parameters
[in]Theelement to remove.
Returns
True if the element was found and removed.
void Rocket::Core::Element::RemoveEventListener ( const String &  event,
EventListener *  listener,
bool  in_capture_phase = false 
)

Removes an event listener from this element.

Parameters
[in]eventEvent to detach from.
[in]listenerThe listener object to be detached.
[in]in_capture_phaseTrue to detach from the capture phase, false from the bubble phase.
void Rocket::Core::Element::RemoveProperty ( const String &  name)

Removes a local property override on the element; its value will revert to that defined in the style sheet.

Parameters
[in]nameThe name of the local property definition to remove.
void Rocket::Core::Element::Render ( )
bool Rocket::Core::Element::ReplaceChild ( Element *  inserted_element,
Element *  replaced_element 
)

Replaces the second node with the first node.

Parameters
[in]inserted_elementThe element that will be inserted and replace the other element.
[in]replaced_elementThe existing element that will be replaced. If this doesn't exist, inserted_element will be appended.
Returns
True if the replaced_element was found, false otherwise.
float Rocket::Core::Element::ResolveProperty ( const String &  name,
float  base_value 
)

Resolves one of this element's properties. If the value is a number or px, this is returned. If it's a percentage then it is resolved based on the second argument (the base value).

Parameters
[in]nameThe name of the property to resolve the value for.
[in]base_valueThe value that is scaled by the percentage value, if it is a percentage.
Returns
The value of this property for this element.
float Rocket::Core::Element::ResolveProperty ( const Property *  property,
float  base_value 
)

Resolves one of this element's non-inherited properties. If the value is a number or px, this is returned. If it's a percentage then it is resolved based on the second argument (the base value).

Parameters
[in]nameThe property to resolve the value for.
[in]base_valueThe value that is scaled by the percentage value, if it is a percentage.
Returns
The value of this property for this element.
void Rocket::Core::Element::ScrollIntoView ( bool  align_with_top = true)

Scrolls the parent element's contents so that this element is visible.

Parameters
[in]align_with_topIf true, the element will align itself to the top of the parent element's window. If false, the element will be aligned to the bottom of the parent element's window.
template<typename T >
void Rocket::Core::Element::SetAttribute ( const String &  name,
const T &  value 
)

Sets an attribute on the element.

Parameters
[in]nameName of the attribute.
[in]valueValue of the attribute.
void Rocket::Core::Element::SetAttributes ( const ElementAttributes *  attributes)

Set a group of attributes.

Parameters
[in]attributesAttributes to set.
void Rocket::Core::Element::SetBox ( const Box &  box)

Sets the box describing the size of the element, and removes all others.

Parameters
[in]boxThe new dimensions box for the element.
void Rocket::Core::Element::SetClass ( const String &  class_name,
bool  activate 
)

Sets or removes a class on the element.

Parameters
[in]class_nameThe name of the class to add or remove from the class list.
[in]activateTrue if the class is to be added, false to be removed.
void Rocket::Core::Element::SetClassNames ( const String &  class_names)

Specifies the entire list of classes for this element. This will replace any others specified.

Parameters
[in]class_namesThe list of class names to set on the style, separated by spaces.
void Rocket::Core::Element::SetClientArea ( Box::Area  client_area)

Sets an alternate area to use as the client area.

Parameters
[in]client_areaThe box area to use as the element's client area.
void Rocket::Core::Element::SetContentBox ( const Vector2f &  content_offset,
const Vector2f &  content_box 
)

Sets the dimensions of the element's internal content. This is the tightest fitting box surrounding all of this element's logical children, plus the element's padding.

Parameters
[in]content_offsetThe offset of the box's internal content.
[in]content_boxThe dimensions of the box's internal content.
void Rocket::Core::Element::SetId ( const String &  id)

Sets the id of the element.

Parameters
[in]idThe new id of the element.
void Rocket::Core::Element::SetInnerRML ( const String &  rml)

Sets the markup and content of the element. All existing children will be replaced.

Parameters
[in]rmlThe new content of the element.
void Rocket::Core::Element::SetInstancer ( ElementInstancer *  instancer)

Sets the instancer to use for releasing this element.

Parameters
[in]instancerInstancer to set on this element.
void Rocket::Core::Element::SetOffset ( const Vector2f &  offset,
Element *  offset_parent,
bool  offset_fixed = false 
)

Sets the position of this element, as a two-dimensional offset from another element.

Parameters
[in]offsetThe offset (in pixels) of our primary box's top-left border corner from our offset parent's top-left border corner.
[in]offset_parentThe element this element is being positioned relative to.
[in]offset_fixedTrue if the element is fixed in place (and will not scroll), false if not.
bool Rocket::Core::Element::SetProperty ( const String &  name,
const String &  value 
)

Sets a local property override on the element.

Parameters
[in]nameThe name of the new property.
[in]valueThe new property to set.
Returns
True if the property parsed successfully, false otherwise.
bool Rocket::Core::Element::SetProperty ( const String &  name,
const Property &  property 
)

Sets a local property override on the element to a pre-parsed value.

Parameters
[in]nameThe name of the new property.
[in]propertyThe parsed property to set.
Returns
True if the property was set successfully, false otherwise.
void Rocket::Core::Element::SetPseudoClass ( const String &  pseudo_class,
bool  activate 
)

Sets or removes a pseudo-class on the element.

Parameters
[in]pseudo_classThe pseudo class to activate or deactivate.
[in]activateTrue if the pseudo-class is to be activated, false to be deactivated.
void Rocket::Core::Element::SetScrollLeft ( float  scroll_left)

Sets the left scroll offset of the element.

Parameters
[in]scroll_leftThe element's new left scroll offset.
void Rocket::Core::Element::SetScrollTop ( float  scroll_top)

Sets the top scroll offset of the element.

Parameters
[in]scroll_topThe element's new top scroll offset.
void Rocket::Core::Element::Update ( )
void Rocket::Core::Element::UpdateLayout ( )

Update the element's layout if required.

Friends And Related Function Documentation

friend class Context
friend
friend class ElementStyle
friend
friend class LayoutEngine
friend
friend class LayoutInlineBox
friend

The documentation for this class was generated from the following file: