Urho.Gui.UI Class

UI subsystem. Manages the graphical user interface.

See Also: UI


public class UI : UrhoObject


Urho3D implements a simple, hierarchical user interface system based on rectangular elements. The elements provided are:

  • BoderImage: a texture image with an optional border
  • Button: a pushbutton
  • CheckBox: a button that can be toggled on/off
  • Cursor: a mouse cursor
  • DropDownList: shows a vertical list of items (optionally scrollable) as a popup
  • LineEdit: a single-line text editor
  • ListView: shows a scrollable vertical list of items
  • Menu: a button which can show a popup element
  • ScrollBar: a slider with back and forward buttons
  • ScrollView: a scrollable view of child elements
  • Slider: a horizontal or vertical slider bar
  • Sprite: a texture image which supports subpixel positioning, scaling and rotating.
  • Text: static text that can be multiline
  • ToolTip: a popup which automatically displays itself when the cursor hovers on its parent element.
  • UIElement: container for other elements, renders nothing by itself
  • View3D: a window that renders a 3D viewport
  • Window: a movable and resizable window

The root UI element can be queried from the UI subsystem. It is an empty canvas (UIElement) as large as the application window, into which other elements can be added.

Elements are added into each other similarly as scene nodes, using the UIElement.AddChild and UIElement.RemoveChild

To allow the elements react to mouse input, either a mouse cursor element must be defined using the UI.Cursor property  or the operating system mouse cursor must be set visible from the Input subsystem.


Namespace: Urho.Gui
Assembly: Urho (in Urho.dll)
Assembly Versions:

The members of Urho.Gui.UI are listed below.

See Also: UrhoObject

Public Constructors

Constructs a new instance of Urho.Gui.UI which is tied to the Application.CurrentContext.
Constructs a new instance of Urho.Gui.UI, given a raw pointer to an unmanaged object
Constructs a new instance of Urho.Gui.UI linked to a specific Context.

Protected Constructors

Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field.

Public Properties

ClipboardTextString. Return clipboard text. Or Set clipboard text.
CursorCursor. Return cursor. Or Set cursor UI element.
CursorPositionIntVector2. Return cursor position.
CustomSizeIntVector2. Return root element custom size. Returns 0,0 when custom size is not being used and automatic resizing according to window size is in use instead (default.) Or Set custom size of the root element. This disables automatic resizing of the root element according to window size. Set custom size 0,0 to return to automatic resizing.
DefaultToolTipDelaySingle. Return tooltip default display delay in seconds. Or Set tooltip default display delay in seconds.
DoubleClickIntervalSingle. Return UI element double click interval in seconds. Or Set UI element double click interval in seconds.
DragBeginDistanceInt32. Return UI drag start event distance threshold in pixels. Or Set UI drag event start distance threshold in pixels.
DragBeginIntervalSingle. Return UI drag start event interval in seconds. Or Set UI drag event start interval in seconds.
DraggingBoolean. Return whether a drag is in progress.
FocusElementUIElement. Return focused element.
ForceAutoHintBoolean. Return whether is using forced autohinting. Or Set whether to force font autohinting instead of using FreeType's TTF bytecode interpreter.
FrontElementUIElement. Return topmost enabled root-level non-modal element.
MaxFontTextureSizeInt32. Return font texture maximum size. Or Set maximum font face texture size. Must be a power of two. Default is 2048.
NonFocusedMouseWheelBoolean. Determines whether mouse wheel can control also a non-focused element..
NumDragElementsUInt32. Return the number of currently dragged elements.
RootUIElement. Return root UI element.
RootModalElementUIElement. Return root modal element.
ScaleSingle. Return current UI scale. Or Set %UI scale. 1.0 is default (pixel perfect). Resize the root element to match.
TypeStringHash. Urho's type system type.
TypeNameString. Urho's low-level type name.
TypeNameStaticString. Urho's low-level type name, accessible as a static method.
TypeStaticStringHash. Urho's low-level type, accessible as a static method.
UseMutableGlyphsBoolean. Return whether is using mutable (eraseable) glyphs for fonts. Or Set whether to use mutable (eraseable) glyphs to ensure a font face never expands to more than one texture. Default false.
UseScreenKeyboardBoolean. Return whether focusing a %LineEdit will show the on-screen keyboard. Or Set whether to show the on-screen keyboard (if supported) when a %LineEdit is focused. Default true on mobile devices.
UseSystemClipboardBoolean. Return whether is using the system clipboard. Or Set whether to use system clipboard. Default false.

Public Methods

Clear the UI (excluding the cursor.)
Debug draw a UI element.
GetDragElement(UInt32) : UIElement
Return the drag element at index.
GetElementAt(IntVector2, Boolean) : UIElement
Return UI element at screen coordinates. By default returns only input-enabled elements.
GetElementAt(Int32, Int32, Boolean) : UIElement
Return UI element at screen coordinates. By default returns only input-enabled elements.
HasModalElement() : Boolean
Return true when UI has modal element(s).
LoadLayout(File, XmlFile) : UIElement
LoadLayout(MemoryBuffer, XmlFile) : UIElement
LoadLayout(XmlFile, XmlFile) : UIElement
LoadLayoutToElement(UIElement, ResourceCache, String)
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.
Update the UI for rendering. Called by HandleRenderUpdate().
SaveLayout(File, UIElement) : Boolean
SaveLayout(MemoryBuffer, UIElement) : Boolean
SetCustomSize(Int32, Int32)
SetFocusElement(UIElement, Boolean)
Set focused UI element.
SetModalElement(UIElement, Boolean) : Boolean
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.
SubscribeToFocusChanged(Action<FocusChangedEventArgs>) : Subscription
Subscribes to the FocusChanged event raised by the UI.
SubscribeToUIDropFile(Action<UIDropFileEventArgs>) : Subscription
Subscribes to the UIDropFile event raised by the UI.
SubscribeToUIMouseClick(Action<UIMouseClickEventArgs>) : Subscription
Subscribes to the UIMouseClick event raised by the UI.
SubscribeToUIMouseClickEnd(Action<UIMouseClickEndEventArgs>) : Subscription
Subscribes to the UIMouseClickEnd event raised by the UI.
Update the UI logic. Called by HandlePostUpdate().

Public Events