Rocket::Core::ElementUtilities Class Reference
#include <ElementUtilities.h>
|
Public Types |
| enum | PositionAnchor {
TOP = 1 << 0,
BOTTOM = 1 << 1,
LEFT = 1 << 2,
RIGHT = 1 << 3,
TOP_LEFT = TOP | LEFT,
TOP_RIGHT = TOP | RIGHT,
BOTTOM_LEFT = BOTTOM | LEFT,
BOTTOM_RIGHT = BOTTOM | RIGHT
} |
Static Public Member Functions |
| static Element * | GetElementById (Element *root_element, const String &id) |
| static void | GetElementsByTagName (ElementList &elements, Element *root_element, const String &tag) |
| static FontFaceHandle * | GetFontFaceHandle (Element *element) |
| static int | GetFontSize (Element *element) |
| static int | GetLineHeight (Element *element) |
| static int | GetStringWidth (Element *element, const WString &string) |
| static void | BindEventAttributes (Element *element) |
| static bool | GetClippingRegion (Vector2i &clip_origin, Vector2i &clip_dimensions, Element *element) |
| static bool | SetClippingRegion (Element *element, Context *context=NULL) |
| static void | PushClipCache (RenderInterface *render_interface) |
| static bool | FormatElement (Element *element, const Vector2f &containing_block) |
| static void | BuildBox (Box &box, const Vector2f &containing_block, Element *element, bool inline_element=false) |
| static bool | PositionElement (Element *element, const Vector2f &offset) |
| static bool | PositionElement (Element *element, const Vector2f &offset, PositionAnchor anchor) |
Detailed Description
Utility functions for dealing with elements.
- Author:
- Lloyd Weehuizen
Member Function Documentation
| Element * Rocket::Core::ElementUtilities::GetElementById |
( |
Element * |
root_element, |
|
|
const String & |
id | |
|
) |
| | [static] |
Get the element with the given id.
- Parameters:
-
| [in] | root_element | First element to check. |
| [in] | id | ID of the element to look for. |
| void Rocket::Core::ElementUtilities::GetElementsByTagName |
( |
ElementList & |
elements, |
|
|
Element * |
root_element, |
|
|
const String & |
tag | |
|
) |
| | [static] |
Get all elements with the given tag.
- Parameters:
-
| [out] | elements | Resulting elements. |
| [in] | root_element | First element to check. |
| [in] | tag | Tag to search for. |
Returns an element's font face.
- Parameters:
-
| [in] | element | The element to determine the font face for. |
- Returns:
- The element's font face. This will be NULL if no valid RCSS font styles have been set up for this element.
| int Rocket::Core::ElementUtilities::GetFontSize |
( |
Element * |
element |
) |
[static] |
Returns an element's font size, if it has a font defined.
- Parameters:
-
| [in] | element | The element to determine the font size for. |
- Returns:
- The font size as determined by the element's font, or 0 if it has no font specified.
| int Rocket::Core::ElementUtilities::GetLineHeight |
( |
Element * |
element |
) |
[static] |
Returns an element's line height, if it has a font defined.
- Parameters:
-
| [in] | element | The element to determine the line height for. |
- Returns:
- The line height as specified by the element's font and line height styles.
| int Rocket::Core::ElementUtilities::GetStringWidth |
( |
Element * |
element, |
|
|
const WString & |
string | |
|
) |
| | [static] |
Returns the width of a string rendered within the context of the given element.
- Parameters:
-
| [in] | element | The element to measure the string from. |
| [in] | string | The string to measure. |
- Returns:
- The string width, in pixels.
| void Rocket::Core::ElementUtilities::BindEventAttributes |
( |
Element * |
element |
) |
[static] |
Bind and instance all event attributes on the given element onto the element
- Parameters:
-
| bool Rocket::Core::ElementUtilities::GetClippingRegion |
( |
Vector2i & |
clip_origin, |
|
|
Vector2i & |
clip_dimensions, |
|
|
Element * |
element | |
|
) |
| | [static] |
Generates the clipping region for an element.
- Parameters:
-
| [out] | clip_origin | The origin, in context coordinates, of the origin of the element's clipping window. |
| [out] | clip_dimensions | The size, in context coordinates, of the element's clipping window. |
| [in] | element | The element to generate the clipping region for. |
- Returns:
- True if a clipping region exists for the element and clip_origin and clip_window were set, false if not.
| bool Rocket::Core::ElementUtilities::SetClippingRegion |
( |
Element * |
element, |
|
|
Context * |
context = NULL | |
|
) |
| | [static] |
Sets the clipping region from an element and its ancestors.
- Parameters:
-
| [in] | element | The element to generate the clipping region from. |
| [in] | context | The context of the element; if this is not supplied, it will be derived from the element. |
- Returns:
- The visibility of the given element within its clipping region.
| void Rocket::Core::ElementUtilities::PushClipCache |
( |
RenderInterface * |
render_interface |
) |
[static] |
Pushes the cached clip state of a render interface back up to ensure the cache is up-to-date.
- Parameters:
-
| [in] | render_interface | The render interface to update. |
| bool Rocket::Core::ElementUtilities::FormatElement |
( |
Element * |
element, |
|
|
const Vector2f & |
containing_block | |
|
) |
| | [static] |
Formats the contents of an element. This does not need to be called for ordinary elements, but can be useful for non-DOM elements of custom elements.
- Parameters:
-
| [in] | element | The element to lay out. |
| [in] | containing_block | The size of the element's containing block. |
| void Rocket::Core::ElementUtilities::BuildBox |
( |
Box & |
box, |
|
|
const Vector2f & |
containing_block, |
|
|
Element * |
element, |
|
|
bool |
inline_element = false | |
|
) |
| | [static] |
Generates the box for an element.
- Parameters:
-
| [out] | box | The box to be built. |
| [in] | containing_block | The dimensions of the content area of the block containing the element. |
| [in] | element | The element to build the box for. |
| [in] | inline_element | True if the element is placed in an inline context, false if not. |
| bool Rocket::Core::ElementUtilities::PositionElement |
( |
Element * |
element, |
|
|
const Vector2f & |
offset | |
|
) |
| | [static] |
Sizes and positions an element within its parent. Any relative values will be evaluated against the size of the element parent's content area.
- Parameters:
-
| element[in] | The element to size and position. |
| offset[in] | The offset of the element inside its parent's content area. |
| bool Rocket::Core::ElementUtilities::PositionElement |
( |
Element * |
element, |
|
|
const Vector2f & |
offset, |
|
|
PositionAnchor |
anchor | |
|
) |
| | [static] |
Sizes an element, and positions it within its parent offset from the borders of its content area. Any relative values will be evaluated against the size of the element parent's content area.
- Parameters:
-
| element[in] | The element to size and position. |
| offset[in] | The offset from the parent's borders. |
| anchor[in] | Defines which corner or edge the border is to be positioned relative to. |
The documentation for this class was generated from the following files: