Back to Home

ESO Lua File v101041

common/gamepad/zo_textsearch_header_gamepad.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
ZO_TextSearch_Header_Gamepad = ZO_InitializingCallbackObject:Subclass()
function ZO_TextSearch_Header_Gamepad:Initialize(control, onTextChangedCallback)
    self.control = control
    self.headerTextFilterControl = control:GetNamedChild("Filter")
    self.headerTextFilterEditBox = self.headerTextFilterControl:GetNamedChild("SearchEdit")
    self.headerTextFilterHighlight = self.headerTextFilterControl:GetNamedChild("Highlight")
    self.headerTextFilterIcon = self.headerTextFilterControl:GetNamedChild("Icon")
    self.headerBGTexture = self.headerTextFilterControl:GetNamedChild("BG")
    self.active = false
    self.enabled = true
    self.headerTextFilterEditBox:SetHandler("OnTextChanged", onTextChangedCallback)
    --When the edit box loses focus, fire off a callback that screen narration will listen for
    self.headerTextFilterEditBox:SetHandler("OnFocusLost", function() self:FireCallbacks("EditBoxFocusLost") end, "TextSearchHeader")
end
function ZO_TextSearch_Header_Gamepad:IsActive()
    return self.active
end
function ZO_TextSearch_Header_Gamepad:Activate()
    self.active = true
    self:Update()
    self:FireCallbacks("FocusActivated")
end
function ZO_TextSearch_Header_Gamepad:Deactivate()
    self.active = false
    self:Update()
    self:FireCallbacks("FocusDeactivated")
end
function ZO_TextSearch_Header_Gamepad:Update()
    self.headerTextFilterHighlight:SetHidden(not self.active)
    self.headerBGTexture:SetHidden(not self.active)
    if self.active then
        self.headerTextFilterIcon:SetColor(ZO_SELECTED_TEXT:UnpackRGBA())
    else
        self.headerTextFilterIcon:SetColor(ZO_DISABLED_TEXT:UnpackRGBA())
        if self.headerTextFilterEditBox:HasFocus() then
            self.headerTextFilterEditBox:LoseFocus()
        end
    end
end
function ZO_TextSearch_Header_Gamepad:IsActive()
    return self.active
end
function ZO_TextSearch_Header_Gamepad:SetFocused(isFocused)
    if isFocused then
        self.headerTextFilterEditBox:TakeFocus()
    elseif self.headerTextFilterEditBox:HasFocus() then
        self.headerTextFilterEditBox:LoseFocus()
    end
end
function ZO_TextSearch_Header_Gamepad:UpdateTextForContext(context, suppressCallback)
    self.headerTextFilterEditBox:SetText(TEXT_SEARCH_MANAGER:GetSearchText(context), suppressCallback)
end
function ZO_TextSearch_Header_Gamepad:GetText()
    return self.headerTextFilterEditBox:GetText()
end
function ZO_TextSearch_Header_Gamepad:GetEditBox()
    return self.headerTextFilterEditBox
end
function ZO_TextSearch_Header_Gamepad:GetNarrationText()
    return ZO_FormatEditBoxNarrationText(self:GetEditBox(), GetString(SI_SCREEN_NARRATION_EDIT_BOX_SEARCH_NAME))
end