Wikia

WoWWiki

GTB

Talk0
102,215pages on
this wiki
Addonicon
WoWWiki Hosted AddOn Page

GTB-1.0 is a library for creating timers displayed as bars, graphically it's supposed to resemble CandyBar which is used by addons like BigWigs.

Example of a mod that uses GTB isAfflicted2

GTB SVN

GTB-1.0 APIEdit

:RegisterGroup(name, texture)Edit

ArgsEdit

Arg Type Details
name string Name of this group, this will be shown as the anchor name and must be unique to the anchor.
texture string Texture to use for the bars

ReturnsEdit

Return Type Details
GTBObject table The GTB Object encapsulating the GTB API's.

GTB Object APIEdit

GTBObject:RegisterBar(id, text, seconds, startSeconds[, icon, r, g, b])Edit

ArgsEdit

Arg Type Details
id string Bar id, this MUST be unique as it's used for removing and modifying bars, conflicting ids will use the latest one registered.
text number Text to show inside the bar
seconds number How many seconds are left on this timer
startSeconds number/nil How many seconds this timer started as, if nothing is passed uses seconds.
icon string/nil Icon to display next to this bar
r number/nil Overriden background color for red, should be a 1.0 - 0.0 value
g number/nil Overriden background color for red, should be a 1.0 - 0.0 value
b number/nil Overriden background color for red, should be a 1.0 - 0.0 value

RemarksEdit

Starts a graphical timer bar, if the group is set to redirect to another group it'll check if the redirected group exists if it doesn't then it'll silently show it in the normal group without redirection.

GTBObject:UnregisterBar(id)Edit

ArgsEdit

Arg Type Details
id string Bar id

ReturnsEdit

Return Type Details
removed boolean Returns true if we removed a bar, nil is nothing was found

GTBObject:UnregisterAllBars()Edit

ReturnsEdit

Return Type Details
removed boolean Returns true if we removed any bars, nil if the group was empty of active bars

GTBObject:SetBarIcon(id, icon[, left, right, top, bottom])Edit

ArgsEdit

Arg Type Details
id string Bar id
icon string/nil Icon to display next to this bar
left number/nil Left tex coord for the icon texture, defaults to 0.07
right number/nil Right tex coord for the icon texture, defaults to 0.93
top number/nil Top tex coord for the icon texture, defaults to 0.07
bottom number/nil Bottom tex coord for the icon texture, defaults to 0.93

GTBObject:SetRepeatingTimer(id, flag)Edit

ArgsEdit

Arg Type Details
id string Bar id
flag boolean Flag the timer as repeating or stop it from repeating

RemarksEdit

Flags the timer as repeating, meaning it'll keep restarting the timer when it hits 0 instead of removing. The only way to stop this is either flag the timer as not repeating, or to remove it through GTBObject:RemoveBar(id) or GTBObject:RemoveAllBars().

GTBObject:SetAnchorVisible(flag)Edit

ArgsEdit

Arg Type Details
flag boolean Changes the group anchor to be visible, and can be dragged around by the user.


GTBObject:RegisterOnMove(handler[, func])Edit

ArgsEdit

Arg Type Details
handler string/function/table Function/method to call.
func string/function (Optional) Function to call if you're using a handler

RemarksEdit

Registers the passed handler/function to be called when the user stops moving the anchor (OnDragStop fires)

If you passed just a function it'll be called as func(anchorFrame, x, y) If you passed a handler and a function it'll be called as handler[func](handler, anchorFrame, x, y)

GTBObject:RegisterOnFade(handler[, func])Edit

ArgsEdit

Arg Type Details
handler string/function/table Function/method to call.
func string/function (Optional) Function to call if you're using a handler

RemarksEdit

Registers the passed handler/function to be called when a bar has ran out and is done fading, this is not called if the bar is removed through GTBObject:UnregisterBar(id)

If you passed just a function it'll be called as func(barId) If you passed a handler and a function it'll be called as handler[func](handler, barID)

GTBObject:SetDisplayGroup(name)Edit

ArgsEdit

Arg Type Details
name string Group name to redirect to

RemarksEdit

Sets that this group should redirect all new bars created in it to the set one, if the set group does not exist when a bar is created it'll silently ignore this and put it in the group it was registered with.

When bars are redirected to another group, they will use the redirected groups configuration except for the callbacks when the bar fades.

GTBObject:GetDisplayGroup()Edit

ArgsEdit

ReturnsEdit

Return Type Details
group string/nil Group name that this group is being redirected to, or nil if none

RemarksEdit

Returns the name of the group that all bars from this one will be redirected to, this does not check to make sure the group exists before returning the name.

GTBObject:SetFadeTime(seconds)Edit

ArgsEdit

Arg Type Details
seconds number How many seconds it should take for the bar to fade out when it ends

GTBObject:SetFadeTime(seconds)Edit

ArgsEdit

Arg Type Details
seconds number How many seconds it should take for the bar to fade out when it ends

GTBObject:SetBaseColor(r, g, b)Edit

ArgsEdit

Arg Type Details
r number How red the background color of bars will be, needs to be a 1.0 - 0.0 value
g number How green the background color of bars will be, needs to be a 1.0 - 0.0 value
b number How blue the background color of bars will be, needs to be a 1.0 - 0.0 value

GTBObject:SetIconPosition(position)Edit

ArgsEdit

Arg Type Details
position string Icon position, must either be LEFT or RIGHT

RemarksEdit

Positioning of the icon in relation to the bars, this only applies to newly created bars if you have one already running you must call GTBGroup:SetBarIcon(id, icon) or re-register the bar to see a change.

GTBObject:SetBarGrowth(position)Edit

ArgsEdit

Arg Type Details
position string Bar growth type, must either be UP or DOWN

RemarksEdit

How the bars should grow, up or down. Changes will take affect immeditially and bars will be repositioned (if needed).

GTBObject:SetTexture(texture)Edit

ArgsEdit

Arg Type Details
texture string Bar texture

GTBObject:SetWidth(width)Edit

ArgsEdit

Arg Type Details
width number Bar width

GTBObject:SetScale(scale)Edit

ArgsEdit

Arg Type Details
scale number Bar scale

GTBObject:SetPoint(point, relativeFrame[, relativePoint, xOff, yOff])Edit

RemarksEdit

Sets the positioning of the bar group, and any bars attached to it.

See http://www.wowwiki.com/API_Region_SetPoint for more information on arguments as this directly passes the arguments to the anchor frames :SetPoint().

GTBObject:EnableGradient(flag)Edit

ArgsEdit

Arg Type Details
flag boolean Flag the group as using a gradient for the background color

RemarksEdit

By default this is enabled, the bar background color will change from the base color set to red based on how much time is left.

GTBObject:SetMaxBars(maxBars)Edit

ArgsEdit

Arg Type Details
maxBars number/nil Maximum number of bars that can be shown at one time, nil for no limit.

Around Wikia's network

Random Wiki