-- NOTE: This handler object is auto-generated. Feel free to modify the contents of this file.
--
-- IMPORTANT: This script resource must be attached to a script component named WidgetHandler to work
--            with the Button widget's base script.
-- 
local thisActor = ...

local animation = scaleform.Actor.component_by_name(thisActor, "animation")

local sound = scaleform.ContainerComponent.actor_by_name(animation, "sound")
local volume = scaleform.ContainerComponent.actor_by_name(animation, "volume")
local fov = scaleform.ContainerComponent.actor_by_name(animation, "fov")
local aa = scaleform.ContainerComponent.actor_by_name(animation, "antialiasing")

local helpTop = scaleform.ContainerComponent.actor_by_name(animation, "help_top")
local helpAnimation = scaleform.Actor.component_by_name(helpTop, "animation")

local labelBlue = scaleform.ContainerComponent.actor_by_name(helpAnimation, "label_blue")
local labelBlueText = scaleform.Actor.component_by_name(labelBlue, "text")
local labelRed = scaleform.ContainerComponent.actor_by_name(helpAnimation, "label_red")
local labelRedText = scaleform.Actor.component_by_name(labelRed, "text")
local icon = scaleform.ContainerComponent.actor_by_name(helpAnimation, "icon")

local setHintVisibility = function(isVisible)
    scaleform.Actor.set_visible(labelBlue, isVisible)
    scaleform.Actor.set_visible(labelRed, isVisible)
    scaleform.Actor.set_visible(icon, isVisible)
end

local soundOverListener = scaleform.EventListener.create(soundOverListener, function(e, thisListener)
    scaleform.Actor.set_visible(labelBlue, true)
    scaleform.Actor.set_visible(labelRed, true)
    scaleform.Actor.set_visible(icon, true)
    
    local text = "Enable or disable sound"
    local length = string.len(text)
    
    scaleform.TextComponent.set_text(labelBlueText, text, length)
    scaleform.TextComponent.set_text(labelRedText, text, length)
end )

local volumeOverListener = scaleform.EventListener.create(volumeOverListener, function(e, thisListener)
    scaleform.Actor.set_visible(labelBlue, true)
    scaleform.Actor.set_visible(labelRed, true)
    scaleform.Actor.set_visible(icon, true)
    
    local text = "Adjust the intensity of the sound"
    local length = string.len(text)
    
    scaleform.TextComponent.set_text(labelBlueText, text, length)
    scaleform.TextComponent.set_text(labelRedText, text, length)
end )

local fovOverListener = scaleform.EventListener.create(fovOverListener, function(e, thisListener)
    scaleform.Actor.set_visible(labelBlue, true)
    scaleform.Actor.set_visible(labelRed, true)
    scaleform.Actor.set_visible(icon, true)
    
    local text = "Adjust the camera field of view"
    local length = string.len(text)
    
    scaleform.TextComponent.set_text(labelBlueText, text, length)
    scaleform.TextComponent.set_text(labelRedText, text, length)
end )

local aaOverListener = scaleform.EventListener.create(aaOverListener, function(e, thisListener)
    scaleform.Actor.set_visible(labelBlue, true)
    scaleform.Actor.set_visible(labelRed, true)
    scaleform.Actor.set_visible(icon, true)
    
    local text = "Enable or disable anti-aliasing"
    local length = string.len(text)
    
    scaleform.TextComponent.set_text(labelBlueText, text, length)
    scaleform.TextComponent.set_text(labelRedText, text, length)
end )

local mouseOutListener = scaleform.EventListener.create(mouseOutListener, function(e, thisListener)
    scaleform.Actor.set_visible(labelBlue, false)
    scaleform.Actor.set_visible(labelRed, false)
    scaleform.Actor.set_visible(icon, false)
end )

scaleform.EventListener.connect(soundOverListener, sound, scaleform.EventTypes.MouseOver)
scaleform.EventListener.connect(volumeOverListener, volume, scaleform.EventTypes.MouseOver)
scaleform.EventListener.connect(fovOverListener, fov, scaleform.EventTypes.MouseOver)
scaleform.EventListener.connect(aaOverListener, aa, scaleform.EventTypes.MouseOver)

scaleform.EventListener.connect(mouseOutListener, sound, scaleform.EventTypes.MouseOut)
scaleform.EventListener.connect(mouseOutListener, volume, scaleform.EventTypes.MouseOut)
scaleform.EventListener.connect(mouseOutListener, fov, scaleform.EventTypes.MouseOut)
scaleform.EventListener.connect(mouseOutListener, aa, scaleform.EventTypes.MouseOut)

setHintVisibility(false)