-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMessageRow.lua
More file actions
63 lines (56 loc) · 1.49 KB
/
Copy pathMessageRow.lua
File metadata and controls
63 lines (56 loc) · 1.49 KB
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
MessageRowMixin = {}
function MessageRowMixin:Setup(message)
self.message = message
if self.message then
self:SetID(message.id)
if self.message.name then
local nameText = format("%s (%s)", self.message.name, self.message.id)
self.name:SetText(nameText);
end
if self.message.type then
local typeStr = MessageBarker:GetMessageTypeString(self.message.type)
self.info:SetText(typeStr);
end
self:UpdateKeyBindings()
else
self:ResetDisplay()
end
self:Show();
end
function MessageRowMixin:GetBindingCommand()
return "CLICK "..self.RunButton:GetName()..":LeftButton"
end
function MessageRowMixin:UpdateKeyBindings()
self.keyBindings = GetBindingKey(self:GetBindingCommand())
if self.keyBindings then
self.keybind:SetText(self.keyBindings)
-- TODO display additional bindings (in tooltip?)
else
self.keybind:SetText('')
end
end
function MessageRowMixin:RemoveKeyBindings()
local function removeKeyBindings(...)
for i = 1, select('#', ...) do
local ok = SetBinding(select(i, ...))
if ok then
SaveBindings(GetCurrentBindingSet())
end
end
end
removeKeyBindings(GetBindingKey(self:GetBindingCommand()))
end
--[[ function MessageRowMixin:Reset()
self:ResetDisplay()
self:Hide();
self:SetHighlightAtlas("voicechat-channellist-row-highlight");
self:UnlockHighlight()
self:Enable();
end ]]
function MessageRowMixin:ResetDisplay()
self.name:SetText('');
self.info:SetText('');
end
function MessageRowMixin:RunClicked()
MessageBarker:BarkMessage(self.message.id)
end