Back to Home

ESO Lua File v100029

ingame/tradinghouse/keyboard/tradinghousenamesearchfeature_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
-----------------
-- Name search --
-----------------
ZO_TradingHouseNameSearchFeature_Keyboard = ZO_TradingHouseNameSearchFeature_Shared:Subclass()
function ZO_TradingHouseNameSearchFeature_Keyboard:New(...)
    return ZO_TradingHouseNameSearchFeature_Shared.New(self, ...)
end
-- Override
function ZO_TradingHouseNameSearchFeature_Keyboard:GetSearchText()
    return self.nameSearchEdit:GetText()
end
-- Override
function ZO_TradingHouseNameSearchFeature_Keyboard:SetSearchText(newSearchText)
    self.nameSearchEdit:SetText(newSearchText)
    self.nameSearchEdit:SetCursorPosition(0)
end
function ZO_TradingHouseNameSearchFeature_Keyboard:AttachToControl(itemNameSearchControl, itemNameSearchAutoCompleteControl)
    self.nameSearchEdit = itemNameSearchControl:GetNamedChild("Box")
    self.nameSearchEdit:SetHandler("OnTextChanged", function()
    end)
    self.nameSearchEdit:RegisterForEvent(EVENT_MATCH_TRADING_HOUSE_ITEM_NAMES_COMPLETE, function(_, ...)
        self:OnNameMatchComplete(...)
    end)
    self.nameSearchClearButton = itemNameSearchControl:GetNamedChild("Clear")
    self.nameSearchClearButton:SetEnabled(false)
    self.nameSearchClearButton:SetHandler("OnClicked", function()
    end)
    self.nameSearchAutoComplete = ZO_TradingHouseNameSearchAutoComplete:New(itemNameSearchAutoCompleteControl, self.nameSearchEdit)
    TRADING_HOUSE_SEARCH:RegisterCallback("OnSearchCriteriaChanged", function()
        if not IsInGamepadPreferredMode() then
            self:MarkFiltersDirty()
        end
    end)
end
function ZO_TradingHouseNameSearchFeature_Keyboard:OnNameSearchEditTextChanged()
    ZO_EditDefaultText_OnTextChanged(self.nameSearchEdit)
    self.searchText = self.nameSearchEdit:GetText()
    if not self:IsSearchTextLongEnough() then
        self.nameSearchAutoComplete:Hide()
    end
    self.nameSearchClearButton:SetEnabled(self.searchText ~= "")
    TRADING_HOUSE_SEARCH:HandleSearchCriteriaChanged(self)
end
function ZO_TradingHouseNameSearchFeature_Keyboard:OnNameSearchClearButtonClicked()
    self.nameSearchEdit:SetText("")
end
function ZO_TradingHouseNameSearchFeature_Keyboard:OnNameMatchComplete(nameMatchId, numResults, backgroundDurationMS)
    ZO_TradingHouseNameSearchFeature_Shared.OnNameMatchComplete(self, nameMatchId, numResults)
    if nameMatchId == self.completedItemNameMatchId then
        self.nameSearchAutoComplete:ShowListForNameSearch(nameMatchId, numResults)
    end
end