api/widgets/UIObject

UIObject is an abstract UI object type which cannot actually be created.
It's a base of all UI objects and gathers together some of common methods which have identical behaviours across all widget types.


UIObject:AddListener(listener)

Adds a new listener to the frame.
Listeners are tables where the keys are event names, and the values are functions that respond to those events. Each function will receive as its first parameter a reference to the listener table, and any additional event specific data as the remaining parameters. Typically, for Blizzard built-in events, this will be the event source widget object followed by any additional values passed to the event handler. Values in the listener table that are not functions are ignored.

Parameters

listener
a listener table to add.


UIObject:GetListeners(eventName)

Returns any listeners for the specified event.

Parameters

eventName
the event for which to retrieve listeners, or nil to retrieve all listeners for the frame.

Return value

any listeners that are listening for the specified event.


UIObject:GetName()

Returns the name of the object.

Return value

the name of the object.


UIObject:GetObjectType()

Returns the type of the object (Frame, Button, and so on).

Return value

the type of the object.


UIObject:IsListening(eventName)

Tests to see if there are any listeners for the specified event.

Parameters

eventName
the event name to check, or nil to check for listeners for any event.

Return value

true if there is a listener for the specified event, or false otherwise.


UIObject:IsObjectType(type)

Returns whether the object is of the given object type (Frame, Button, and so on).
Note that calling this for "UIObject" will always return false, even though all objects descend from that type.

Parameters

type
a string containing an object type.

Return value

true if the object is of the specified type, or false otherwise.


UIObject:NotifyListeners(eventName, ...)

Notifies any listeners of the specified event.
Listener functions will be passed a reference to themselves, followed by any parameters passed to this function.

Parameters

eventName
the name of the event that has occurred.
...
any parameters that should be passed to the listener.


UIObject:Release()

Releases the widget, as well as its children.
Any listeners with a OnRelease handler will be notified.


UIObject:RemoveListener(listener)

Removes a listener from the frame.

Parameters

listener
the listener object to remove.



Comments

Posts Quoted:
Reply
Clear All Quotes