tooltip

Text container for cityRPTooltip.

Rows are the main way of interacting with cityRPTooltips. These derive from

DLabel panels, which means that making use of this panel

will be largely the same as any DLabel panel.

This has been taken from Helix: https://github.com/NebulousCloud/helix/blob/master/gamemode/core/derma/cl_tooltip.lua

Functions

tooltip:AddRow(id)

View source »

Creates a new cityrpTooltipRow panel and adds it to the bottom of this tooltip.

Parameters

  • id string

    Name of the new row. This is used to reorder rows if needed

Returns

  • panel

    Created row

tooltip:AddRowAfter(after, id)

View source »

Creates a new cityrpTooltipRow and adds it after the row with the given id. The order of the rows is set via setting the Z position of the panels, as this is how VGUI handles ordering with docked panels.

Parameters

  • after string

    Name of the row to insert after

  • id string

    Name of the newly created row

Returns

  • panel

    Created row

tooltip:GetCursorPosition()

View source »

Returns the current position of the mouse cursor on the screen.

Returns

  • number

    X position of cursor

  • number

    Y position of cursor

tooltip:GetRow(id)

View source »

Returns an cityrpTooltipRow corresponding to the given name.

Parameters

Returns

  • panel

    Corresponding row

  • OR
  • nil

    If the row doesn't exist

tooltip:IsMinimal()

View source »

Whether or not this tooltip should be displayed in a minimal format.

Returns

  • bool

    True if this tooltip should be displayed in a minimal format

See Also

tooltip:IsMinimal()

View source »

Whether or not this tooltip row should be displayed in a minimal format. This usually means no background and/or smaller font. You probably won't need this if you're using regular cityrpTooltipRow panels, but you should take into account if you're creating your own panels that derive from cityrpTooltipRow.

Returns

  • bool

    True if this tooltip row should be displayed in a minimal format

tooltip:Paint(width, height)

View source »

Called when the foreground of this row should be painted. If you are overriding this in a subclassed panel, make sure you call cityrpTooltipRow:PaintBackground at the beginning of your function to make its style consistent with the rest of the framework.

Parameters

  • width number

    Width of the panel

  • height number

    Height of the panel

tooltip:PaintBackground(width, height)

View source »

Called when the background of this row should be painted. This will paint the background with the DrawImportantBackground function set in the skin by default.

Parameters

  • width number

    Width of the panel

  • height number

    Height of the panel

tooltip:SetBackgroundColor(color)

View source »

Sets the background color of this row. This should be used sparingly to avoid overwhelming players with a bunch of different colors that could convey different meanings.

Parameters

  • color

tooltip:SetEntity(entity)

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

View source »

Sets the entity associated with this tooltip. Note that this function is not how you get entities to show tooltips.

Parameters

  • entity Entity

    Entity to associate with this tooltip

tooltip:SetImportant()

View source »

Sets this row to be more prominent with a larger font and more noticable background color. This should usually be used once per tooltip as a title row. For example, item tooltips have one "important" row consisting of the item's name. Note that this function is a fire-and-forget function; you cannot revert a row back to it's regular state unless you set the font/colors manually.

tooltip:SizeToContents()

View source »

Resizes the tooltip to fit all of the child panels. You should always call this after you are done adding all of your rows.

tooltip:SizeToContents()

View source »

Resizes this panel to fit its contents. This should be called after setting the text.

tooltip:SizeToContentsY()

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

View source »

Resizes the height of this panel to fit its contents.