Appearance
Icon
A clickable icon button that displays a texture with an optional caption beneath it.
Create with AceGUI:Create("Icon"). It inherits the Common Widget API.
Widget type: Icon
Methods
SetLabel
method#
lua
widget:SetLabel(text?)Sets the caption shown below the icon. Passing a non-empty string shows the label and sizes the widget to the image height plus 25px; passing nil or an empty string hides the label and sizes to the image height plus 10px.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
text (optional) | string | The caption to display, or nil/"" to hide it. |
SetImage
method#
lua
widget:SetImage(path?, ...)Sets the icon texture. If texture coordinates are supplied as the trailing arguments, they are applied; otherwise the full texture (0, 1, 0, 1) is used.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
path (optional) | string | number | Texture path or file ID. nil clears the image. | |
... | number | Optional texture coordinates: either 4 (left, right, top, bottom) or 8 values. Any other count falls back to the full texture. |
SetImageSize
method#
lua
widget:SetImageSize(width, height)Sets the displayed size of the icon texture and adjusts the widget height accordingly (image height plus 25px when a label is shown, plus 10px otherwise).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
width | number | Texture width in pixels. | |
height | number | Texture height in pixels. |
SetDisabled
method#
lua
widget:SetDisabled(disabled)Enables or disables the icon. When disabled, the button stops responding and the label and image are greyed out.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
disabled | boolean | true to disable, false to enable. |
Defaults
On acquire the icon resets to: width 110, height 110, no label, no image, image size 64×64, and not disabled.
Callbacks
OnClick
callback#
lua
OnClick(button)Fired when the icon is clicked; AceGUI clears focus afterward. Subscribe with widget:SetCallback.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
button | string | The mouse button that was pressed (e.g. "LeftButton"). |
OnEnter
callback#
lua
OnEnter()Fired when the mouse enters the icon. Subscribe with widget:SetCallback.
OnLeave
callback#
lua
OnLeave()Fired when the mouse leaves the icon. Subscribe with widget:SetCallback.
Example
lua
local icon = AceGUI:Create("Icon")
icon:SetImage("Interface\\Icons\\INV_Misc_QuestionMark")
icon:SetImageSize(48, 48)
icon:SetLabel("Help")
icon:SetCallback("OnClick", function(widget, event, button)
print("Clicked with", button)
end)