Back to Home

ESO Lua File v100029

publicallingames/itempreview/keyboard/itempreviewlisthelper_keyboard.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
ZO_ItemPreviewListHelper_Keyboard = ZO_ItemPreviewListHelper_Shared:Subclass()
function ZO_ItemPreviewListHelper_Keyboard:New(...)
    return ZO_ItemPreviewListHelper_Shared.New(self, ...)
end
function ZO_ItemPreviewListHelper_Keyboard:Initialize(...)
    ZO_ItemPreviewListHelper_Shared.Initialize(self, ...)
    self.previewPreviousArrowButton = self.control:GetNamedChild("PreviewPreviousArrow")
    self.previewNextArrowButton = self.control:GetNamedChild("PreviewNextArrow")
    self.previewPreviousArrowButton:SetHandler("OnClicked", function() self:PreviewPrevious() end)
    self.previewNextArrowButton:SetHandler("OnClicked", function() self:PreviewNext() end)
end
do
    local function SetButtonStateEnabled(button, enabled)
        if enabled then
            button:SetState(BSTATE_NORMAL, false)
        else
            button:SetState(BSTATE_DISABLED, true)
        end
    end
    function ZO_ItemPreviewListHelper_Keyboard:RefreshActions()
        ZO_ItemPreviewListHelper_Shared.RefreshActions(self)
        local areButtonsVisible = self:HasMultiplePreviewDatas()
        self.previewPreviousArrowButton:SetHidden(not areButtonsVisible)
        self.previewNextArrowButton:SetHidden(not areButtonsVisible)
        if areButtonsVisible then
            local canChangePreview = ITEM_PREVIEW_KEYBOARD:CanChangePreview()
            SetButtonStateEnabled(self.previewPreviousArrowButton, canChangePreview and self:CanPreviewPrevious())
            SetButtonStateEnabled(self.previewNextArrowButton, canChangePreview and self:CanPreviewNext())
        end
    end
end
function ZO_ItemPreviewListHelper_Keyboard:GetPreviewObject()
    return ITEM_PREVIEW_KEYBOARD
end
    ITEM_PREVIEW_LIST_HELPER_KEYBOARD = ZO_ItemPreviewListHelper_Keyboard:New(control)
end