Back to Home

ESO Lua File v100026

libraries/zo_tile/contextualactionstile.lua

[◄ back to folders ]
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
------
-- For order of instantiation to happen in the intended order the base class must be inherited after it's platform counterpart
-- "Focus" will be determined by the nature of "selection" per platform
------
ZO_ContextualActionsTile = ZO_Tile:Subclass()
function ZO_ContextualActionsTile:New(...)
    return ZO_Tile.New(self, ...)
end
function ZO_ContextualActionsTile:Initialize(control)
    ZO_Tile.Initialize(self, control)
    self.titleLabel = self.control:GetNamedChild("Title")
    self.iconTexture = self.control:GetNamedChild("Icon")
    self.highlightControl = self.control:GetNamedChild("Highlight")
    self.keybindStripDescriptor = {}
    self.canFocus = true
end
function ZO_ContextualActionsTile:GetTitleLabel()
    return self.titleLabel
end
function ZO_ContextualActionsTile:SetTitle(titleText)
    self.titleLabel:SetText(titleText)
end
function ZO_ContextualActionsTile:GetIconTexture()
    return self.iconTexture
end
function ZO_ContextualActionsTile:SetIcon(iconFile)
    self.iconTexture:SetTexture(iconFile)
end
function ZO_ContextualActionsTile:GetHighlightControl()
    return self.highlightControl
end
function ZO_ContextualActionsTile:SetHighlightAnimationProvider(provider)
    self.highlightAnimationProvider = provider
end
function ZO_ContextualActionsTile:GetKeybindStripDescriptor()
    return self.keybindStripDescriptor
end
function ZO_ContextualActionsTile:SetCanFocus(canFocus)
    self.canFocus = canFocus
end
function ZO_ContextualActionsTile:OnFocusChanged(isFocused)
    if isFocused and self.canFocus then
        KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
        self:SetHighlightHidden(false)
    else
        KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
        self:SetHighlightHidden(true)
    end
end
function ZO_ContextualActionsTile:SetHighlightHidden(hidden, instant)
    if self.highlightAnimationProvider then
        if hidden then
            self.highlightAnimationProvider:PlayBackward(self.highlightControl, instant)
        else
            self.highlightAnimationProvider:PlayForward(self.highlightControl, instant)
        end
    end
end
function ZO_ContextualActionsTile:UpdateKeybinds()
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
-- Begin ZO_Tile Overrides --
function ZO_ContextualActionsTile:OnControlHidden()
    ZO_Tile.OnControlHidden(self)
    local IS_NOT_FOCUSED = false
    self:OnFocusChanged(IS_NOT_FOCUSED)
end
-- End ZO_Tile Overrides --