Back to Home

ESO Lua File v101042

ingame/tradinghouse/keyboard/tradinghousesearchhistory_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
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
ZO_TradingHouseSearchHistory_Keyboard = ZO_CallbackObject:Subclass()
function ZO_TradingHouseSearchHistory_Keyboard:New(...)
    local object = ZO_CallbackObject.New(self)
    object:Initialize(...)
    return object
end
function ZO_TradingHouseSearchHistory_Keyboard:Initialize(control)
    self.control = control
    self.history = {}
    self:InitializeList()
    TRADING_HOUSE_SEARCH_HISTORY_KEYBOARD_FRAGMENT = ZO_FadeSceneFragment:New(control)
    TRADING_HOUSE_SEARCH_HISTORY_KEYBOARD_FRAGMENT:RegisterCallback("StateChange", function(_, newState)
        if newState == SCENE_FRAGMENT_SHOWING then
            SCENE_MANAGER:AddFragment(MEDIUM_LEFT_PANEL_BG_FRAGMENT)
        elseif newState == SCENE_FRAGMENT_HIDING then
            SCENE_MANAGER:RemoveFragment(MEDIUM_LEFT_PANEL_BG_FRAGMENT)
        end
    end)
    TRADING_HOUSE_SCENE:RegisterCallback("StateChange", function(_, newState)
        if newState == SCENE_FRAGMENT_SHOWING then
            self:RefreshHistory()
        end
    end)
    TRADING_HOUSE_SEARCH_HISTORY_MANAGER:RegisterCallback("HistoryUpdated", function()
        if TRADING_HOUSE_SCENE:IsShowing() then
            self:RefreshHistory()
        end
    end)
end
local SEARCH_HISTORY_ROW_DATA = 1
function ZO_TradingHouseSearchHistory_Keyboard:InitializeList()
    self.list = self.control:GetNamedChild("List")
    self.noHistoryRow = self.control:GetNamedChild("NoHistoryRow")
    local function SetupHistoryRow(rowControl, rowData)
        if not rowData.formattedSearchTableDescription then
            rowData.formattedSearchTableDescription = TRADING_HOUSE_SEARCH:GenerateSearchTableShortDescription(rowData.searchTable)
        end
        rowControl:GetNamedChild("Description"):SetText(rowData.formattedSearchTableDescription)
        rowControl.rowData = rowData
    end
    ZO_ScrollList_AddDataType(self.list, SEARCH_HISTORY_ROW_DATA, "ZO_TradingHouseSearchHistoryRow_Keyboard", 60, SetupHistoryRow)
    ZO_ScrollList_EnableHighlight(self.list, "ZO_TallListHighlight")
end
function ZO_TradingHouseSearchHistory_Keyboard:RefreshHistory()
    local scrollData = ZO_ScrollList_GetDataList(self.list)
    for _, searchEntry in TRADING_HOUSE_SEARCH_HISTORY_MANAGER:SearchEntryIterator() do
        local historyData = {searchTable = searchEntry.searchTable, formattedSearchTableDescription = formattedString}
        local dataEntry = ZO_ScrollList_CreateDataEntry(SEARCH_HISTORY_ROW_DATA, historyData)
        table.insert(scrollData, dataEntry)
    end
    self.noHistoryRow:SetHidden(#scrollData ~= 0)
end
function ZO_TradingHouseSearchHistory_Keyboard:GetMouseOverSearchTable()
    local rowControl = ZO_ScrollList_GetMouseOverControl(self.list)
    if rowControl then
        return rowControl.rowData.searchTable
    end
    return nil
end
    TRADING_HOUSE_SEARCH_HISTORY_KEYBOARD = ZO_TradingHouseSearchHistory_Keyboard:New(control)
end
    TRADING_HOUSE_SEARCH:LoadSearchTable(rowControl.rowData.searchTable)
    TRADING_HOUSE_SEARCH:DoSearch()
    -- Jump to top of list, where the current search now resides
    ZO_ScrollList_ResetToTop(TRADING_HOUSE_SEARCH_HISTORY_KEYBOARD.list)
end
    ZO_ScrollList_MouseEnter(TRADING_HOUSE_SEARCH_HISTORY_KEYBOARD.list, rowControl)
    InitializeTooltip(InformationTooltip, rowControl, TOPLEFT, 0, 0, TOPRIGHT)
    SetTooltipText(InformationTooltip, TRADING_HOUSE_SEARCH:GenerateSearchTableDescription(rowControl.rowData.searchTable))
    TRADING_HOUSE_SEARCH_HISTORY_KEYBOARD:FireCallbacks("MouseOverRowChanged")
end
    ZO_ScrollList_MouseExit(TRADING_HOUSE_SEARCH_HISTORY_KEYBOARD.list, rowControl)
    ClearTooltip(InformationTooltip)
    TRADING_HOUSE_SEARCH_HISTORY_KEYBOARD:FireCallbacks("MouseOverRowChanged")
end