Back to Home

ESO Lua File v100022

libraries/zo_templates/treetemplates.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
88
89
90
91
function ZO_LabelHeader_Setup(control, open)
    control:SetSelected(open)
end
    if not control.text:IsSelected() and control.enabled then
        if control.allowIconScaling then
            control.icon.animation:PlayForward()
        end
        control.iconHighlight:SetHidden(false)
    end
    if(control.text:WasTruncated()) then
        InitializeTooltip(InformationTooltip, control, RIGHT, -10)
        SetTooltipText(InformationTooltip, control.text:GetText())
    end
end
local ICON_HEADER_ICON_MAX_DIMENSIONS = 48
local ICON_HEADER_TEXT_OFFSET_X = 55
local ICON_HEADER_TEXT_PADDING_Y = 9
    if not control.text:IsSelected() and control.allowIconScaling then
        control.icon.animation:PlayBackward()
    end
    control.iconHighlight:SetHidden(true)
    ClearTooltip(InformationTooltip)
end
function ZO_IconHeader_OnMouseUp(control, upInside)
    if control.enabled then
        ZO_TreeHeader_OnMouseUp(control, upInside)
    end
end
function ZO_IconHeader_Setup(control, open, enabled, disableScaling)
    enabled = enabled == nil or enabled
    control.enabled = enabled
    control.allowIconScaling = not disableScaling
    if not control.icon.animation then
        control.icon.animation = ANIMATION_MANAGER:CreateTimelineFromVirtual(control.animationTemplate, control.icon)
    end
    if enabled and (open or WINDOW_MANAGER:GetMouseOverControl() == control) then
        if control.allowIconScaling then
            control.icon.animation:PlayForward()
        end
        control.iconHighlight:SetHidden(WINDOW_MANAGER:GetMouseOverControl() ~= control)
    else
        if control.allowIconScaling then
            control.icon.animation:PlayBackward()
        end
        control.iconHighlight:SetHidden(true)
    end
    control.text:SetSelected(open)
end
    local textWidth, textHeight = control.text:GetTextDimensions()
    local height = textHeight + ICON_HEADER_TEXT_PADDING_Y * 2
    height = zo_max(height, ICON_HEADER_ICON_MAX_DIMENSIONS)
    local width = textWidth + ICON_HEADER_TEXT_OFFSET_X
    control:SetDimensions(width, height)
end
    self.icon = self:GetNamedChild("Icon")
    self.iconHighlight = self.icon:GetNamedChild("Highlight")
    self.text = self:GetNamedChild("Text")
    self.animationTemplate = "IconHeaderAnimation"
end
function ZO_IconHeader_SetAnimation(self, animationTemplate)
    self.animationTemplate = animationTemplate
end
function ZO_IconHeader_SetMaxLines(self, maxLines)
    self.text:SetHeight(self.text:GetFontHeight() * maxLines + 1)
end