Skip to content

API: LibQTip 2.0.Tooltip

James D. Callahan III edited this page May 8, 2023 · 5 revisions

Tooltip

AddColumn

(method) LibQTip-2.0.Tooltip:AddColumn(horizontalJustification?: JustifyH)
  -> LibQTip-2.0.Column

Add a new Column to the right of the Tooltip.

@param horizontalJustification — The horizontal justification of Cells in this Column ("CENTER", "LEFT" or "RIGHT"). Defaults to "LEFT".

horizontalJustification:
    | "LEFT"
    | "RIGHT"
    | "CENTER"

AddHeadingRow

(method) LibQTip-2.0.Tooltip:AddHeadingRow(...string)
  -> row: LibQTip-2.0.Row

Add a new heading Row at the bottom of the Tooltip.

Provided values are displayed on the Row using the DefaultHeadingFont. Nil values are ignored.

If the number of values is greater than the number of Columns, an error is raised.

@param ... — Value to be displayed in each Column of the Row.

AddRow

(method) LibQTip-2.0.Tooltip:AddRow(...string)
  -> row: LibQTip-2.0.Row

Add a new Row at the bottom of the Tooltip.

Provided values are displayed on the Row with the regular Font. Nil values are ignored.

If the number of values is greater than the number of Columns, an error is raised.

@param ... — Value to be displayed in each Column of the Row.

AddSeparator

(method) LibQTip-2.0.Tooltip:AddSeparator(height?: number, r?: number, g?: number, b?: number, a?: number)
  -> row: LibQTip-2.0.Row

Adds a graphical separator Row at the bottom of the Tooltip.

@param height — Height, in pixels, of the separator. Defaults to 1.

@param r — Red color value of the separator. Defaults to NORMAL_FONT_COLOR.r

@param g — Green color value of the separator. Defaults to NORMAL_FONT_COLOR.g

@param b — Blue color value of the separator. Defaults to NORMAL_FONT_COLOR.b

@param a — Alpha level of the separator. Defaults to 1.

Clear

(method) LibQTip-2.0.Tooltip:Clear()
  -> LibQTip-2.0.Tooltip

Reset the contents of the Tootip. The Column layout is preserved but all Rows are removed.

GetColumn

(method) LibQTip-2.0.Tooltip:GetColumn(columnIndex: integer)
  -> LibQTip-2.0.Column

Returns the Column at the given index.

GetColumnCount

(method) LibQTip-2.0.Tooltip:GetColumnCount()
  -> columnCount: number

Returns the total number of Columns on the Tooltip.

GetDefaultCellProvider

(method) LibQTip-2.0.Tooltip:GetDefaultCellProvider()
  -> LibQTip-2.0.CellProvider

Returns the CellProvider used for Cell functionality.

GetDefaultFont

(method) LibQTip-2.0.Tooltip:GetDefaultFont()
  -> Font

Return the Font used for regular Rows.

GetDefaultHeadingFont

(method) LibQTip-2.0.Tooltip:GetDefaultHeadingFont()
  -> Font

Return the Tooltip's DefaultHeadingFont used for heading Rows.

GetRow

(method) LibQTip-2.0.Tooltip:GetRow(rowIndex: integer)
  -> LibQTip-2.0.Row

Returns the Row at the given index.

GetRowCount

(method) LibQTip-2.0.Tooltip:GetRowCount()
  -> rowCount: number

Returns the total number of Rows on the Tooltip.

HookScript

(method) LibQTip-2.0.Tooltip:HookScript()

Disallow the use of the HookScript method to avoid one AddOn breaking all others.

IsAcquiredBy

(method) LibQTip-2.0.Tooltip:IsAcquiredBy(key: string)
  -> boolean

Determine whether or not the Tooltip has been acquired by the specified key.

@param key — The key to check.

Release

(method) LibQTip-2.0.Tooltip:Release()

Convenience wrapper on LibQTip to release the Tooltip.

SetAutoHideDelay

(method) LibQTip-2.0.Tooltip:SetAutoHideDelay(delay?: number, alternateFrame?: Frame, releaseHandler?: LibQTip-2.0.ReleaseHandler)
  -> LibQTip-2.0.Tooltip

Sets the length of time in which the mouse pointer can be outside of the Tooltip, or an alternate Frame, before the Tooltip is automatically hidden and then released.

@param delay — Whole or fractional seconds.

@param alternateFrame — If specified, the Tooltip will not be automatically hidden while the mouse pointer is over it.

@param releaseHandler — Called when the Tooltip is released. Generally used to clean up a reference an AddOn has to the Tooltip, since another AddOn can subsequently acquire it.

Usage:

:SetAutoHideDelay(0.25) => hides after 0.25sec outside of the tooltip

:SetAutoHideDelay(0.25, someFrame) => hides after 0.25sec outside of both the tooltip and someFrame

:SetAutoHideDelay() => disable auto-hiding (default)

SetCellMarginH

(method) LibQTip-2.0.Tooltip:SetCellMarginH(size: integer)
  -> LibQTip-2.0.Tooltip

Sets the horizontal margin size of all Cells within the Tooltip.

This method can only be used before Rows have been added.

@param size — The desired margin size. Must be a positive number or zero.

SetCellMarginV

(method) LibQTip-2.0.Tooltip:SetCellMarginV(size: integer)
  -> LibQTip-2.0.Tooltip

Sets the vertical margin size of all Cells within the Tooltip.

This method can only be used before Rows have been added.

@param size — The desired margin size. Must be a positive number or zero.

SetColumnLayout

(method) LibQTip-2.0.Tooltip:SetColumnLayout(columnCount: number, ...JustifyH)
  -> LibQTip-2.0.Tooltip

Ensure the Tooltip has at least the passed number of Columns.

The justification of existing Columns is reset to any passed values, or to "LEFT" if none are provided.

@param columnCount — Minimum number of columns

@param ... — Column horizontal justifications ("CENTER", "LEFT" or "RIGHT"). Defaults to "LEFT".


Example Tooltip with 5 columns justified as left, center, left, left, left:

tooltip:SetColumnLayout(5, "LEFT", "CENTER")

...(param):
    | "LEFT"
    | "RIGHT"
    | "CENTER"

SetDefaultCellProvider

(method) LibQTip-2.0.Tooltip:SetDefaultCellProvider(cellProvider: LibQTip-2.0.CellProvider)
  -> LibQTip-2.0.Tooltip

Define the CellProvider to be used for all Cell functionality.

@param cellProvider — The new default CellProvider.

SetDefaultFont

(method) LibQTip-2.0.Tooltip:SetDefaultFont(font: Font|FontObject)
  -> LibQTip-2.0.Tooltip

Define the Font used when adding new Rows.

@param font — The new default Font.

SetDefaultHeadingFont

(method) LibQTip-2.0.Tooltip:SetDefaultHeadingFont(font: Font|FontObject)
  -> LibQTip-2.0.Tooltip

Define the Font used when adding new heading Rows.

@param font — The new default heading Font.

SetHighlightTexCoord

(method) LibQTip-2.0.Tooltip:SetHighlightTexCoord(...number)
  -> LibQTip-2.0.Tooltip

Works identically to the default UI's texture:SetTexCoord() API, for the Tooltip's highlight Texture.

@param ... — Arguments to pass to texture:SetTexCoord()

SetHighlightTexture

(method) LibQTip-2.0.Tooltip:SetHighlightTexture(...string)
  -> LibQTip-2.0.Tooltip

Sets the Texture of the highlight when mousing over a Row or Cell that has a script assigned to it.

Works identically to the default UI's texture:SetTexture() API.

@param ... — Arguments to pass to texture:SetTexture()

SetScript

(method) LibQTip-2.0.Tooltip:SetScript(scriptType: "OnMouseWheel"|LibQTip-2.0.ScriptType, handler?: fun(arg: any, ...any))
  -> LibQTip-2.0.Tooltip

Assigns a script to the Tooltip.

scriptType:
    | "OnEnter"
    | "OnLeave"
    | "OnMouseDown"
    | "OnMouseUp"
    | "OnReceiveDrag"
    | "OnMouseWheel"

SetScrollStep

(method) LibQTip-2.0.Tooltip:SetScrollStep(step: number)
  -> LibQTip-2.0.Tooltip

Set the step size for the scroll bar

@param step — The new step size.

SmartAnchorTo

(method) LibQTip-2.0.Tooltip:SmartAnchorTo(frame: Frame)
  -> LibQTip-2.0.Tooltip

Anchor the Tooltip to the given Frame, ensuring that it is always on screen.

@param frame — The Frame that will serve as the Tooltip anchor.

UpdateScrolling

(method) LibQTip-2.0.Tooltip:UpdateScrolling(maxHeight?: number)
  -> LibQTip-2.0.Tooltip

Resizes the Tooltip to fit the screen and show a scrollbar if needed.

@param maxHeight — Maximum Tooltip height, in pixels.