Add BigTextFrame
This commit is contained in:
@@ -339,9 +339,11 @@ function shared.Config.Init()
|
||||
---@param onDone fun(editBox: Frame)
|
||||
local function CreateBasicSmallEditBox(name, parent, text, initialValue, onDone)
|
||||
local container = GridFrame.new(name, parent, 1, 1)
|
||||
local editBox = CreateFrame("EditBox", name .. "EditBox", container.frame)
|
||||
local editBoxtext = editBox:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
editBoxtext:SetText(text)
|
||||
local editBoxFrame = CreateFrame("Frame", name .. "EditBoxFrame", container.frame)
|
||||
local editBox = CreateFrame("EditBox", name .. "EditBox", editBoxFrame)
|
||||
local textFrame = CreateFrame("Frame", name .. "TextFrame", container.frame)
|
||||
local textElement = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
textElement:SetText(text)
|
||||
|
||||
editBox:SetAutoFocus(false)
|
||||
editBox:SetFontObject("GameFontNormal")
|
||||
@@ -366,14 +368,57 @@ function shared.Config.Init()
|
||||
editBox:SetScript("OnEscapePressed", function() editBox:ClearFocus() end)
|
||||
editBox:SetScript("OnEditFocusLost", function() onDone(editBox) end)
|
||||
editBox:SetText(initialValue)
|
||||
container:Add(editBoxtext, 1, 1)
|
||||
container:Add(textFrame, 1, 1)
|
||||
container:Add(editBox, 2, 1)
|
||||
-- I don't understand why this hack is necessary
|
||||
-- Just put the god damn fucking text in the fucking frame
|
||||
-- Why is the fucking text fucking levitating above the frame!?!?!
|
||||
-- I'm so fucking tired of this shit
|
||||
-- Why do we have to use "BOTTOMLEFT"!?
|
||||
editBoxtext:SetPoint("BOTTOMLEFT", container.frame, "LEFT", 0, 0)
|
||||
textElement:SetPoint("TOPLEFT", textFrame, "TOPLEFT", 2, -2)
|
||||
return container
|
||||
end
|
||||
---@param name string
|
||||
---@param parent Frame
|
||||
---@param text string
|
||||
---@param onDone fun(editBox: Frame)
|
||||
local function CreateBasicBigEditBox(name, parent, text, initialValue, onDone)
|
||||
local container = GridFrame.new(name, parent, 1, 100)
|
||||
local editBoxFrame = CreateFrame("Frame", name .. "EditBoxFrame", container.frame)
|
||||
local editBox = CreateFrame("EditBox", name .. "EditBox", editBoxFrame)
|
||||
local textFrame = CreateFrame("Frame", name .. "TextFrame", container.frame)
|
||||
local textElement = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
textElement:SetText(text)
|
||||
|
||||
editBoxFrame:SetBackdrop({
|
||||
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
||||
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
|
||||
tile = true,
|
||||
tileSize = 2,
|
||||
edgeSize = 12,
|
||||
insets = {
|
||||
left = 2,
|
||||
right = 2,
|
||||
top = 2,
|
||||
bottom = 2
|
||||
}
|
||||
})
|
||||
editBoxFrame:SetBackdropColor(0.8, 0.8, 0.8, 1)
|
||||
editBoxFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
|
||||
|
||||
editBox:SetAllPoints(editBoxFrame)
|
||||
editBox:SetAutoFocus(false)
|
||||
editBox:SetFontObject("GameFontNormal")
|
||||
editBox:SetText(initialValue)
|
||||
editBox:SetTextInsets(6, 6, 6, 6)
|
||||
editBox:SetMultiLine(true)
|
||||
editBox:SetSize(280, 100)
|
||||
editBox:SetMaxLetters(100000)
|
||||
local oldSetHeight = editBox.SetHeight
|
||||
editBox.SetHeight = function(self, height)
|
||||
oldSetHeight(self, height)
|
||||
print("Set height", height)
|
||||
end
|
||||
editBox:SetScript("OnEscapePressed", function() editBox:ClearFocus() end)
|
||||
editBox:SetScript("OnEditFocusLost", function() onDone(editBox) end)
|
||||
container:Add(textFrame, 1, 1)
|
||||
container:Add(editBoxFrame, 7, 1)
|
||||
textElement:SetPoint("TOPLEFT", textFrame, "TOPLEFT", 2, -2)
|
||||
return container
|
||||
end
|
||||
|
||||
@@ -478,7 +523,7 @@ function shared.Config.Init()
|
||||
do
|
||||
local whoerConfigFrame = GridFrame.new("HeimdallWhoerConfig",
|
||||
UIParent, 12, 20)
|
||||
configFrame:Add(whoerConfigFrame, 5, 3)
|
||||
configFrame:Add(whoerConfigFrame, 15, 3)
|
||||
|
||||
local title = whoerConfigFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
title:SetText("Whoer")
|
||||
@@ -529,6 +574,14 @@ function shared.Config.Init()
|
||||
end
|
||||
end)
|
||||
whoerConfigFrame:Add(ttl, 2, 6)
|
||||
|
||||
local ignored = CreateBasicBigEditBox("HeimdallWhoerConfigIgnored",
|
||||
whoerConfigFrame.frame, "Ignored",
|
||||
table.concat(Heimdall_Data.config.who.ignored or {}, "\n"),
|
||||
function(self)
|
||||
--Heimdall_Data.config.who.ignored = self:GetText()
|
||||
end)
|
||||
whoerConfigFrame:Add(ignored, 6, 6)
|
||||
end
|
||||
|
||||
--local spotterEveryoneButton = BasicButton("HeimdallSpotterEveryone", spotterConfigFrame, "Everyone", function(state)
|
||||
|
||||
Reference in New Issue
Block a user