api/UnitFrame

PitBull4:ConvertIntoUnitFrame(frame, isExampleFrame)

Add the proper functions and scripts to a SecureUnitButton, as well as some various initialization.

Parameters

frame
a Button which inherits from SecureUnitButton
isExampleFrame
whether the button is an example frame, thus not a real unit frame

Usage

PitBull4:ConvertIntoUnitFrame(frame)


PitBull4:MakeSingletonFrame(unit)

Make a singleton unit frame.

Parameters

unit
the UnitID of the frame in question

Usage

PitBull4:MakeSingletonFrame("player")


SingletonUnitFrame:Activate()

Activate the unit frame.
This handles UnitWatch and the custom StateDriver

Usage

frame:Activate()


SingletonUnitFrame:Deactivate()

Deactivate the unit frame.
This handles UnitWatch and the custom StateDriver

Usage

frame:Deactivate()


SingletonUnitFrame:RefixSizeAndPosition()

Reset the size and position of the unit frame.

Usage

frame:RefixSizeAndPosition()


UnitFrame:GetFont(font_override, size_multiplier)

Get the font of the unit frame.

Parameters

font_override
nil or the LibSharedMedia name of a font
size_multiplier
how much to multiply the default font size by. Defaults to 1.

Return values

  1. path to the font
  2. size of the font

Usage

local font, size = frame:GetFont(db.font, db.size)
frame.MyModule:SetFont(font, size)


UnitFrame:IterateControls()

Iterate over all controls on this frame

Return value

iterator which returns the id, control, and module

Usage

for id, control, module in PitBull4.IterateControls() do
    doSomethingWith(control)
end


UnitFrame:IterateControlsOfType(module_type)

Iterate over all controls on this frame of the given type

Parameters

module_type
one of "bar", "indicator", "custom"

Return value

iterator which returns the id, control, and module

Usage

for id, control, module in PitBull4.IterateControlsOfType("bar") do
    doSomethingWith(control)
end


UnitFrame:RefreshVehicle()

Reheck the toggleForVehicle attribute for the unit frame

Usage

frame:RefreshVehicle()


UnitFrame:Update(same_guid, update_layout)

Update all details about the UnitFrame, possibly after a GUID change

Parameters

same_guid
whether the previous GUID is the same as the current, at which point is less crucial to update
update_layout
whether to update the layout no matter what

Usage

frame:Update()
frame:Update(true)
frame:Update(false, true)


UnitFrame:UpdateGUID(guid, update)

Check the guid of the Unit Frame, if it is changed, then update the frame.

Parameters

guid
result from UnitGUID(unit)
update
when true force an update even if the guid isn't changed, but is non-nil, when false never cause an update and when update is empty or nil let the function decide on its own if an update is needed.

Usage

frame:UpdateGUID(UnitGUID(frame.unit))
frame:UpdateGUID(UnitGUID(frame.unit), true)


UnitFrame:_RefreshLayout()

Recheck the layout of the unit frame, make sure it's up to date, and update the frame.

Usage

frame:RefreshLayout()


UnitFrame

is_singleton
whether the Unit Frame is a singleton or member
classification
the classification of the Unit Frame
classification_db
the database table for the Unit Frame's classification
layout
the layout of the Unit Frame's classification
unit
the UnitID of the Unit Frame. Can be nil.
guid
the current GUID of the Unit Frame. Can be nil.
overlay
an overlay frame for texts to be placed on.



Comments

Posts Quoted:
Reply
Clear All Quotes