-
Notifications
You must be signed in to change notification settings - Fork 0
/
definitions.lua
125 lines (109 loc) · 3.92 KB
/
definitions.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---@alias MouseButton '"LeftButton"' | '"RightButton"' | '"MiddleButton"' | '"ButtonN"'
---@alias TooltipAnchor
---| '"ANCHOR_TOP"'
---| '"ANCHOR_RIGHT"'
---| '"ANCHOR_BOTTOM"'
---| '"ANCHOR_LEFT"'
---| '"ANCHOR_TOPLEFT"'
---| '"ANCHOR_TOPRIGHT"'
---| '"ANCHOR_BOTTOMRIGHT"'
---| '"ANCHOR_BOTTOMLEFT"'
---| '"ANCHOR_CURSOR"'
---| '"ANCHOR_PRESERVE"'
---| '"ANCHOR_NONE"'
---@alias ModeName
---| '"artifact"'
---| '"azerite"'
---| '"experience"'
---| '"honor"'
---| '"reputation"'
---@class Progress : StatusBar
---@field __owner any
---@field mode Mode @The currently active mode
---@field defaultMode? ModeName
---@field infoText? FontString
---@field modes Mode[]
---@field tooltipAnchor? TooltipAnchor
---@field inAlpha? number
---@field outAlpha? number
---@field Enable? fun(element: Progress)
---@field Disable? fun(element: Progress)
---@class Status
---@field barId integer|string
---@field delta integer
---@field max integer
---@field level integer
---@field value integer
---@class Mode
---@field name ModeName
---@field color ColorMixin @Used to color the bar when the mode is activated
---@field events table<string, boolean> @The events used to update the bar values. Disabled when the mode is inactive
---@field info? string @A tag string to display on the bar
---@field status Status
local Mode = {}
---The events used to activate the mode. Disabled when the mode is active.
---The keys are event names and the values indicate whether the event is unitless
---_(Optional)_
---@type table<string, boolean>
Mode.visibilityEvents = {}
---Called when activating the mode.
---_(Optional)_
---@param element Progress
function Mode:Activate(element) end
---Called when deactivating the mode.
---_(Optional)_
---@param element Progress
function Mode:Deactive(element) end
---Called to cancel a pending item load.
---_(Optional)_
function Mode:CancelItemLoadCallback() end
---Called to supply the bar values. More values may be returned if needed
---@see Mode#PostUpdate
---@param element Progress
---@param unit WowUnit
---@return integer value
---@return integer max
---@return integer level
---@return integer|string barId
function Mode:GetValues(element, unit) end
---Called when the mode is initially loaded.
---_(Optional)_
---@param element Progress
function Mode:Load(element) end
---Handler for the `OnMouseUp` script event.
---Left clicks are reserved to change the current mode and won't be passed to this handler.
---_(Optional)_
---@param element Progress
---@param button MouseButton
function Mode:OnMouseUp(element, button) end
---Called after the bar values have been updated.
---_(Optional)_
---@see Mode#GetValues
---@param element Progress
---@param value integer @The current bar value
---@param max integer @The maximum bar value
---@param level integer @The current level
---@param rest any[] @The rest of the values returned by Mode#GetValues in preserved order
function Mode:PostUpdate(element, value, max, level, rest) end
---Called to update the bar color after the bar values have been set.
---_(Optional)_
---@see Mode#GetValues
---@param element Progress
---@param value integer @The current bar value
---@param max integer @The maximum bar value
---@param level integer @The current level
---@param rest any[] @The rest of the values returned by Mode#GetValues in preserved order
function Mode:UpdateColor(element, value, max, level, rest) end
---Called to update the mode tooltip if the element is mouse-enabled and hovered.
---_(Optional)_
---@param element Progress
function Mode:UpdateTooltip(element) end
---Called to deside on whether the mode should become or stay visible.
---If `Mode#visibilityEvents` is not empty, this method will be called from
---the event handler and `true` will activate inactive modes while `false`
---will deactive active ones. A `nil` return means that the current call should
---be discarded.
---@param event WowEvent
---@vararg any @The rest of the event arguments
---@return boolean?
function Mode:Visibility(event, ...) end