Urho3D::UI Class Reference
Classes |
Public Member Functions |
Private Member Functions |
Private Attributes |
List of all members
Urho3D::UI Class Reference
UI subsystem. Manages the graphical user interface. More...
#include <Urho3D/UI/UI.h>
Inheritance diagram for Urho3D::UI:
Collaboration diagram for Urho3D::UI:
Classes | |
struct | DragData |
Data structure used to represent the drag data associated to a UIElement. More... | |
Public Member Functions | |
UI (Context *context) | |
Construct. | |
virtual | ~UI () |
Destruct. | |
void | SetCursor (Cursor *cursor) |
Set cursor UI element. | |
void | SetFocusElement (UIElement *element, bool byKey=false) |
Set focused UI element. | |
bool | SetModalElement (UIElement *modalElement, bool enable) |
void | Clear () |
Clear the UI (excluding the cursor.) | |
void | Update (float timeStep) |
Update the UI logic. Called by HandlePostUpdate(). | |
void | RenderUpdate () |
Update the UI for rendering. Called by HandleRenderUpdate(). | |
void | Render (bool resetRenderTargets=true) |
Render the UI. If resetRenderTargets is true, is assumed to be the default UI render to backbuffer called by Engine, and will be performed only once. Additional UI renders to a different rendertarget may be triggered from the renderpath. | |
void | DebugDraw (UIElement *element) |
Debug draw a UI element. | |
SharedPtr< UIElement > | LoadLayout (Deserializer &source, XMLFile *styleFile=0) |
Load a UI layout from an XML file. Optionally specify another XML file for element style. Return the root element. | |
SharedPtr< UIElement > | LoadLayout (XMLFile *file, XMLFile *styleFile=0) |
Load a UI layout from an XML file. Optionally specify another XML file for element style. Return the root element. | |
bool | SaveLayout (Serializer &dest, UIElement *element) |
Save a UI layout to an XML file. Return true if successful. | |
void | SetClipboardText (const String &text) |
Set clipboard text. | |
void | SetDoubleClickInterval (float interval) |
Set UI element double click interval in seconds. | |
void | SetDragBeginInterval (float interval) |
Set UI drag event start interval in seconds. | |
void | SetDragBeginDistance (int pixels) |
Set UI drag event start distance threshold in pixels. | |
void | SetDefaultToolTipDelay (float delay) |
Set tooltip default display delay in seconds. | |
void | SetMaxFontTextureSize (int size) |
Set maximum font face texture size. Must be a power of two. Default is 2048. | |
void | SetNonFocusedMouseWheel (bool nonFocusedMouseWheel) |
Set whether mouse wheel can control also a non-focused element. | |
void | SetUseSystemClipboard (bool enable) |
Set whether to use system clipboard. Default false. | |
void | SetUseScreenKeyboard (bool enable) |
Set whether to show the on-screen keyboard (if supported) when a LineEdit is focused. Default true on mobile devices. | |
void | SetUseMutableGlyphs (bool enable) |
Set whether to use mutable (eraseable) glyphs to ensure a font face never expands to more than one texture. Default false. | |
void | SetForceAutoHint (bool enable) |
Set whether to force font autohinting instead of using FreeType's TTF bytecode interpreter. | |
void | SetScale (float scale) |
Set UI scale. 1.0 is default (pixel perfect). Resize the root element to match. | |
void | SetWidth (float size) |
Scale UI to the specified width in pixels. | |
void | SetHeight (float size) |
Scale UI to the specified height in pixels. | |
UIElement * | GetRoot () const |
Return root UI element. | |
UIElement * | GetRootModalElement () const |
Return root modal element. | |
Cursor * | GetCursor () const |
Return cursor. | |
IntVector2 | GetCursorPosition () const |
Return cursor position. | |
UIElement * | GetElementAt (const IntVector2 &position, bool enabledOnly=true) |
Return UI element at screen coordinates. By default returns only input-enabled elements. | |
UIElement * | GetElementAt (int x, int y, bool enabledOnly=true) |
Return UI element at screen coordinates. By default returns only input-enabled elements. | |
UIElement * | GetFocusElement () const |
Return focused element. | |
UIElement * | GetFrontElement () const |
Return topmost enabled root-level non-modal element. | |
const Vector< UIElement * > | GetDragElements () |
Return currently dragged elements. | |
unsigned | GetNumDragElements () const |
Return the number of currently dragged elements. | |
UIElement * | GetDragElement (unsigned index) |
Return the drag element at index. | |
const String & | GetClipboardText () const |
Return clipboard text. | |
float | GetDoubleClickInterval () const |
Return UI element double click interval in seconds. | |
float | GetDragBeginInterval () const |
Return UI drag start event interval in seconds. | |
int | GetDragBeginDistance () const |
Return UI drag start event distance threshold in pixels. | |
float | GetDefaultToolTipDelay () const |
Return tooltip default display delay in seconds. | |
int | GetMaxFontTextureSize () const |
Return font texture maximum size. | |
bool | IsNonFocusedMouseWheel () const |
Return whether mouse wheel can control also a non-focused element. | |
bool | GetUseSystemClipboard () const |
Return whether is using the system clipboard. | |
bool | GetUseScreenKeyboard () const |
Return whether focusing a LineEdit will show the on-screen keyboard. | |
bool | GetUseMutableGlyphs () const |
Return whether is using mutable (eraseable) glyphs for fonts. | |
bool | GetForceAutoHint () const |
Return whether is using forced autohinting. | |
bool | HasModalElement () const |
Return true when UI has modal element(s). | |
bool | IsDragging () const |
Return whether a drag is in progress. | |
float | GetScale () const |
Return current UI scale. | |
Public Member Functions inherited from Urho3D::Object | |
Object (Context *context) | |
Construct. | |
virtual | ~Object () |
Destruct. Clean up self from event sender & receiver structures. | |
virtual StringHash | GetType () const =0 |
Return type hash. | |
virtual const String & | GetTypeName () const =0 |
Return type name. | |
virtual const TypeInfo * | GetTypeInfo () const =0 |
Return type info. | |
virtual void | OnEvent (Object *sender, StringHash eventType, VariantMap &eventData) |
Handle event. | |
bool | IsInstanceOf (StringHash type) const |
Check current instance is type of specified type. | |
bool | IsInstanceOf (const TypeInfo *typeInfo) const |
Check current instance is type of specified type. | |
template<typename T > | |
bool | IsInstanceOf () const |
Check current instance is type of specified class. | |
void | SubscribeToEvent (StringHash eventType, EventHandler *handler) |
Subscribe to an event that can be sent by any sender. | |
void | SubscribeToEvent (Object *sender, StringHash eventType, EventHandler *handler) |
Subscribe to a specific sender's event. | |
void | UnsubscribeFromEvent (StringHash eventType) |
Unsubscribe from an event. | |
void | UnsubscribeFromEvent (Object *sender, StringHash eventType) |
Unsubscribe from a specific sender's event. | |
void | UnsubscribeFromEvents (Object *sender) |
Unsubscribe from a specific sender's events. | |
void | UnsubscribeFromAllEvents () |
Unsubscribe from all events. | |
void | UnsubscribeFromAllEventsExcept (const PODVector< StringHash > &exceptions, bool onlyUserData) |
Unsubscribe from all events except those listed, and optionally only those with userdata (script registered events.) | |
void | SendEvent (StringHash eventType) |
Send event to all subscribers. | |
void | SendEvent (StringHash eventType, VariantMap &eventData) |
Send event with parameters to all subscribers. More... | |
VariantMap & | GetEventDataMap () const |
Return a preallocated map for event data. Used for optimization to avoid constant re-allocation of event data maps. | |
Context * | GetContext () const |
Return execution context. | |
const Variant & | GetGlobalVar (StringHash key) const |
Return global variable based on key. | |
const VariantMap & | GetGlobalVars () const |
Return all global variables. | |
void | SetGlobalVar (StringHash key, const Variant &value) |
Set global variable with the respective key and value. | |
Object * | GetSubsystem (StringHash type) const |
Return subsystem by type. | |
Object * | GetEventSender () const |
Return active event sender. Null outside event handling. | |
EventHandler * | GetEventHandler () const |
Return active event handler. Null outside event handling. | |
bool | HasSubscribedToEvent (StringHash eventType) const |
Return whether has subscribed to an event without specific sender. | |
bool | HasSubscribedToEvent (Object *sender, StringHash eventType) const |
Return whether has subscribed to a specific sender's event. | |
bool | HasEventHandlers () const |
Return whether has subscribed to any event. | |
template<class T > | |
T * | GetSubsystem () const |
Template version of returning a subsystem. | |
const String & | GetCategory () const |
Return object category. Categories are (optionally) registered along with the object factory. Return an empty string if the object category is not registered. | |
Public Member Functions inherited from Urho3D::RefCounted | |
RefCounted () | |
Construct. Allocate the reference count structure and set an initial self weak reference. | |
virtual | ~RefCounted () |
Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist. | |
void | AddRef () |
Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting. | |
void | ReleaseRef () |
Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting. | |
int | Refs () const |
Return reference count. | |
int | WeakRefs () const |
Return weak reference count. | |
RefCount * | RefCountPtr () |
Return pointer to the reference count structure. | |
Private Member Functions | |
URHO3D_OBJECT (UI, Object) | |
void | Initialize () |
Initialize when screen mode initially set. | |
void | Update (float timeStep, UIElement *element) |
Update UI element logic recursively. | |
void | SetVertexData (VertexBuffer *dest, const PODVector< float > &vertexData) |
Upload UI geometry into a vertex buffer. | |
void | Render (bool resetRenderTargets, VertexBuffer *buffer, const PODVector< UIBatch > &batches, unsigned batchStart, unsigned batchEnd) |
Render UI batches. Geometry must have been uploaded first. | |
void | GetBatches (UIElement *element, IntRect currentScissor) |
Generate batches from an UI element recursively. Skip the cursor element. | |
void | GetElementAt (UIElement *&result, UIElement *current, const IntVector2 &position, bool enabledOnly) |
Return UI element at screen position recursively. | |
UIElement * | GetFocusableElement (UIElement *element) |
Return the first element in hierarchy that can alter focus. | |
void | GetCursorPositionAndVisible (IntVector2 &pos, bool &visible) |
Return cursor position and visibility either from the cursor element, or the Input subsystem. | |
void | SetCursorShape (CursorShape shape) |
Set active cursor's shape. | |
void | ReleaseFontFaces () |
Force release of font faces when global font properties change. | |
void | ProcessHover (const IntVector2 &cursorPos, int buttons, int qualifiers, Cursor *cursor) |
Handle button or touch hover. | |
void | ProcessClickBegin (const IntVector2 &cursorPos, int button, int buttons, int qualifiers, Cursor *cursor, bool cursorVisible) |
Handle button or touch begin. | |
void | ProcessClickEnd (const IntVector2 &cursorPos, int button, int buttons, int qualifiers, Cursor *cursor, bool cursorVisible) |
Handle button or touch end. | |
void | ProcessMove (const IntVector2 &cursorPos, const IntVector2 &cursorDeltaPos, int buttons, int qualifiers, Cursor *cursor, bool cursorVisible) |
Handle mouse or touch move. | |
void | SendDragOrHoverEvent (StringHash eventType, UIElement *element, const IntVector2 &screenPos, const IntVector2 &deltaPos, UI::DragData *dragData) |
Send a UI element drag or hover begin event. | |
void | SendClickEvent (StringHash eventType, UIElement *beginElement, UIElement *endElement, const IntVector2 &pos, int button, int buttons, int qualifiers) |
Send a UI click or double click event. | |
void | HandleScreenMode (StringHash eventType, VariantMap &eventData) |
Handle screen mode event. | |
void | HandleMouseButtonDown (StringHash eventType, VariantMap &eventData) |
Handle mouse button down event. | |
void | HandleMouseButtonUp (StringHash eventType, VariantMap &eventData) |
Handle mouse button up event. | |
void | HandleMouseMove (StringHash eventType, VariantMap &eventData) |
Handle mouse move event. | |
void | HandleMouseWheel (StringHash eventType, VariantMap &eventData) |
Handle mouse wheel event. | |
void | HandleTouchBegin (StringHash eventType, VariantMap &eventData) |
Handle touch begin event. | |
void | HandleTouchEnd (StringHash eventType, VariantMap &eventData) |
Handle touch end event. | |
void | HandleTouchMove (StringHash eventType, VariantMap &eventData) |
Handle touch move event. | |
void | HandleKeyDown (StringHash eventType, VariantMap &eventData) |
Handle keypress event. | |
void | HandleTextInput (StringHash eventType, VariantMap &eventData) |
Handle text input event. | |
void | HandleBeginFrame (StringHash eventType, VariantMap &eventData) |
Handle frame begin event. | |
void | HandlePostUpdate (StringHash eventType, VariantMap &eventData) |
Handle logic post-update event. | |
void | HandleRenderUpdate (StringHash eventType, VariantMap &eventData) |
Handle render update event. | |
void | HandleDropFile (StringHash eventType, VariantMap &eventData) |
Handle a file being drag-dropped into the application window. | |
HashMap< WeakPtr< UIElement > , DragData * >::Iterator | DragElementErase (HashMap< WeakPtr< UIElement >, DragData * >::Iterator dragElement) |
Remove drag data and return next iterator. | |
void | ProcessDragCancel () |
Handle clean up on a drag cancel. | |
IntVector2 | SumTouchPositions (UI::DragData *dragData, const IntVector2 &oldSendPos) |
Sum touch positions and return the begin position ready to send. | |
Private Attributes | |
WeakPtr< Graphics > | graphics_ |
Graphics subsystem. | |
SharedPtr< UIElement > | rootElement_ |
UI root element. | |
SharedPtr< UIElement > | rootModalElement_ |
UI root modal element. | |
SharedPtr< Cursor > | cursor_ |
Cursor. | |
WeakPtr< UIElement > | focusElement_ |
Currently focused element. | |
PODVector< UIBatch > | batches_ |
UI rendering batches. | |
PODVector< float > | vertexData_ |
UI rendering vertex data. | |
PODVector< UIBatch > | debugDrawBatches_ |
UI rendering batches for debug draw. | |
PODVector< float > | debugVertexData_ |
UI rendering vertex data for debug draw. | |
SharedPtr< VertexBuffer > | vertexBuffer_ |
UI vertex buffer. | |
SharedPtr< VertexBuffer > | debugVertexBuffer_ |
UI debug geometry vertex buffer. | |
PODVector< UIElement * > | tempElements_ |
UI element query vector. | |
String | clipBoard_ |
Clipboard text. | |
float | doubleClickInterval_ |
Seconds between clicks to register a double click. | |
float | dragBeginInterval_ |
Seconds from mouse button down to begin a drag if there has been no movement exceeding pixel threshold. | |
float | defaultToolTipDelay_ |
Tooltip default display delay in seconds. | |
int | dragBeginDistance_ |
Drag begin event distance threshold in pixels. | |
int | mouseButtons_ |
Mouse buttons held down. | |
int | lastMouseButtons_ |
Last mouse button pressed. | |
int | qualifiers_ |
Qualifier keys held down. | |
int | maxFontTextureSize_ |
Font texture maximum size. | |
bool | initialized_ |
Initialized flag. | |
bool | usingTouchInput_ |
Touch used flag. | |
bool | nonFocusedMouseWheel_ |
Flag to switch mouse wheel event to be sent to non-focused element at cursor. | |
bool | useSystemClipboard_ |
Flag for using operating system clipboard instead of internal. | |
bool | useScreenKeyboard_ |
Flag for showing the on-screen keyboard on focusing a LineEdit. | |
bool | useMutableGlyphs_ |
Flag for using mutable (erasable) font glyphs. | |
bool | forceAutoHint_ |
Flag for forcing FreeType auto hinting. | |
bool | uiRendered_ |
Flag for UI already being rendered this frame. | |
unsigned | nonModalBatchSize_ |
Non-modal batch size (used internally for rendering). | |
Timer | clickTimer_ |
Timer used to trigger double click. | |
WeakPtr< UIElement > | doubleClickElement_ |
UI element last clicked for tracking double clicks. | |
HashMap< WeakPtr< UIElement > , bool > | hoveredElements_ |
Currently hovered elements. | |
HashMap< WeakPtr< UIElement > , DragData * > | dragElements_ |
Currently dragged elements. | |
int | dragElementsCount_ |
Number of elements in dragElements_. | |
int | dragConfirmedCount_ |
Number of elements in dragElements_ with dragPending = false. | |
HashMap< WeakPtr< UIElement > , int > | touchDragElements_ |
UI elements that are being touched with touch input. | |
Vector< UIElement * > | dragElementsConfirmed_ |
Confirmed drag elements cache. | |
float | uiScale_ |
Current scale of UI. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Urho3D::Object | |
static const TypeInfo * | GetTypeInfoStatic () |
Return type info static. | |
static bool | IsTypeOf (StringHash type) |
Check current type is type of specified type. | |
static bool | IsTypeOf (const TypeInfo *typeInfo) |
Check current type is type of specified type. | |
template<typename T > | |
static bool | IsTypeOf () |
Check current type is type of specified class. | |
Protected Attributes inherited from Urho3D::Object | |
Context * | context_ |
Execution context. | |
Detailed Description
UI subsystem. Manages the graphical user interface.
Member Function Documentation
bool Urho3D::UI::SetModalElement | ( | UIElement * | modalElement, |
bool | enable | ||
) |
Set modal element. Until all the modal elements are dismissed, all the inputs and events are only sent to them. Return true when successful. Only the modal element can clear its modal status or when it is being destructed.
Here is the call graph for this function:
Here is the caller graph for this function:
The documentation for this class was generated from the following files:
- Source/Urho3D/UI/UI.h
- Source/Urho3D/UI/UI.cpp