You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

MoveIt.GUI.Modules.Parent = {}
function MoveIt.GUI.Modules.Parent:Create(container)
MoveIt.GUI.Modules:CreateEnabledCheckbox(container, "Parent", 0.4, "Set Parent")
self.editboxParent = AceGUI:Create("EditBox")
self.editboxParent:SetLabel("Parent frame name (change with caution)")
self.editboxParent:SetRelativeWidth(0.6)
self.editboxParent:SetDisabled(true)
self.editboxParent:SetCallback("OnEnterPressed", function(_, _, value) self:OnSetParent(value) end)
container:AddChild(self.editboxParent)
end
function MoveIt.GUI.Modules.Parent:OnSetParent(value)
local modSettings = MoveIt:GetFrameSettings(MoveIt.GUI.Options.selectedFrame, "Parent")
if MoveIt:IsValidFrame(value) or value == "UIParent" then
modSettings.Parent = value
else
self.editboxParent:SetText(modSettings.Parent, false)
end
MoveIt.Modules.Parent:Apply(MoveIt.GUI.Options.selectedFrame)
end
function MoveIt.GUI.Modules.Parent:Update(frameName)
local modSettings = MoveIt:GetFrameSettings(frameName, "Parent")
self.checkboxEnabled:SetValue(modSettings.Enabled)
self.editboxParent:SetText(modSettings.Parent)
self.checkboxEnabled:SetDisabled(false)
self.editboxParent:SetDisabled(not modSettings.Enabled)
end
function MoveIt.GUI.Modules.Parent:Disable()
self.checkboxEnabled:SetValue(false, false)
self.editboxParent:SetText("")
self.checkboxEnabled:SetDisabled(true)
self.editboxParent:SetDisabled(true)
end