Back to Home

ESO Lua File v101042

libraries/zo_tile/tile.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
----
-- ZO_Tile
----
ZO_Tile = ZO_CallbackObject:Subclass()
function ZO_Tile:New(...)
    local tile = ZO_CallbackObject.New(self)
    tile:Initialize(...)
    tile:PostInitialize()
    return tile
end
function ZO_Tile:Initialize(control)
    self.control = control
    control.object = self
    if self.InitializePlatform then
        self:InitializePlatform()
    end
    control:SetHandler("OnEffectivelyHidden", function() self:OnControlHidden() end)
    control:SetHandler("OnEffectivelyShown", function() self:OnControlShown() end)
end
function ZO_Tile:PostInitialize()
    if self.PostInitializePlatform then
        self:PostInitializePlatform()
    end
end
function ZO_Tile:GetControl()
    return self.control
end
function ZO_Tile:Reset()
    -- To be overridden
end
function ZO_Tile:SetHidden(isHidden)
    self.control:SetHidden(isHidden)
end
function ZO_Tile:OnShow()
    -- To be overridden
end
function ZO_Tile:OnHide()
    -- To be overridden
end
function ZO_Tile:OnControlShown()
    if self.dirty then
        self:RefreshLayout()
    end
end
function ZO_Tile:OnControlHidden()
    -- To be overridden
end
function ZO_Tile:RefreshLayout()
    if self.control:IsHidden() then
        self.dirty = true
    else
        self.dirty = false
        self:RefreshLayoutInternal()
        self:FireCallbacks("OnRefreshLayout")
    end
end
-- Can only be called by the Tile class and its subclasses
function ZO_Tile:RefreshLayoutInternal()
    -- To be overridden
end
function ZO_Tile:MarkDirty()
    self.dirty = true
end
function ZO_Tile:Layout(data)
    if self.LayoutPlatform then
        self:LayoutPlatform(data)
    end
end
-------------
-- Global Tile Function
-------------
function ZO_DefaultGridTileHeaderSetup(control, data, selected)
    local label = control:GetNamedChild("Text")
    if label then
        label:SetText(data.header)
    end
end
    if not data.isEmptyCell then
        control.object:Layout(data)
    end
end
    control.object:Reset()
end