|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions
gameplay::Form Class Reference

`#include <Form.h>`

Inheritance diagram for gameplay::Form:

List of all members.

## Public Member Functions

const char * | getTypeName () const
bool | isForm () const
void | update (float elapsedTime)
unsigned int | draw (bool wireframe=false)
bool | isBatchingEnabled () const
void | setBatchingEnabled (bool enabled)

## Static Public Member Functions

static Form * | create (const char *url)
static Form * | create (const char *id, Theme::Style *style, Layout::Type layoutType=Layout::LAYOUT_ABSOLUTE)
static Form * | getForm (const char *id)
static Control * | getActiveControl (unsigned int touchIndex=0)
static Control * | getFocusControl ()
static void | clearFocus ()

## Detailed Description

Defines a form that is a root container that contains zero or more controls.

This can also be attached on a scene Node to support 3D forms.

See also:
  http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms

## Member Function Documentation

static void gameplay::Form::clearFocus | ( |  | ) | `[static]`

Removes focus from any currently focused UI control.

static Form* gameplay::Form::create | ( | const char * | url | ) | `[static]`

Creates a form from a .form properties file.

Parameters:

  url | The URL pointing to the Properties object defining the form.

Returns:
  The new form or NULL if there was an error.

static Form* gameplay::Form::create | ( | const char * | id,
|  | Theme::Style * | style,
|  | Layout::Type | layoutType = `Layout::LAYOUT_ABSOLUTE`
| ) |  | `[static]`

Create a new Form.

The specified style defines the visual style for the form. If NULL is passed for the style, the default UI theme is used. All controls attached to this form will inherit the theme that contains the form's style.

Parameters:

  id | The Form's ID.
  style | The Form's custom style (optional - may be NULL).
  layoutType | The form's layout type (optional).

Returns:
  The new Form.

Reimplemented from gameplay::Container.

unsigned int gameplay::Form::draw | ( | bool | wireframe = `false` | ) | `[virtual]`

Draws this form.

Returns:
  The nubmer of draw calls issued to draw the form.

Implements gameplay::Drawable.

static Control* gameplay::Form::getActiveControl | ( | unsigned int | touchIndex = `0` | ) | `[static]`

Returns the currently active control within the UI system.

An active control is a control that is currently pressed or hovered over. On a multi-touch system, it is possible for several controls to be active at once (one for each touch point). However, only a single control can have focus at once.

Parameters:

  touchIndex | Optional touch point index to retrieve the active control for.

Returns:
  The currently active control, or NULL if no controls are currently active.

static Control* gameplay::Form::getFocusControl | ( |  | ) | `[static]`

Returns the current control that is in focus.

Returns:
  The current control in focus, or NULL if no controls are in focus.

static Form* gameplay::Form::getForm | ( | const char * | id | ) | `[static]`

Get a form from its ID.

Parameters:

  id | The ID of the form to search for.

Returns:
  A form with the given ID, or null if one was not found.

const char* gameplay::Form::getTypeName | ( |  | ) | const`[virtual]`

Extends ScriptTarget::getTypeName() to return the type name of this class.

Child controls should override this function to return the correct type name.

Returns:
  The type name of this class: "Form"

See also:
  ScriptTarget::getTypeName

Reimplemented from gameplay::Container.

bool gameplay::Form::isBatchingEnabled | ( |  | ) | const

Determines whether batching is enabled for this form.

Returns:
  True if batching is enabled for this form, false otherwise.

bool gameplay::Form::isForm | ( |  | ) | const`[virtual]`

See also:
  Container::isForm()

Reimplemented from gameplay::Container.

void gameplay::Form::setBatchingEnabled | ( | bool | enabled | ) |

Turns batching on or off for this form.

By default, forms enable batching as a way to optimize performance. However, on certain complex forms that contain multiple layers of overlapping text and transparent controls, batching may cause some visual artifacts due alpha blending issues. In these cases, turning batching off usually fixes the issue at a slight performance cost.

Parameters:

  enabled | True to enable batching (default), false otherwise.

void gameplay::Form::update | ( | float | elapsedTime | ) | `[virtual]`

See also:
  Control::update

Reimplemented from gameplay::Container.

All Classes Functions Variables Typedefs Enumerations Enumerator