Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lib.dragalize = function (frame)
- local fn = frame:GetName()
- frame:SetScript("OnDragStart", function(s) s:StartMoving() end)
- frame:SetScript("OnDragStop", function(s) s:StopMovingOrSizing() end)
- frame:SetMovable(true)
- frame:SetUserPlaced(true)
- local d = CreateFrame("Frame", fn, UIParent)
- d:SetBackdrop(backdrop)
- d:SetBackdropColor(0,1,0,.5)
- d:SetAllPoints(frame)
- d:SetFrameLevel(frame:GetFrameLevel()+5)
- d:SetFrameStrata"HIGH"
- d:SetAlpha(0) -- should be always 0, put 1 if you need to display frame names for edit
- frame.draggable = d
- local name = lib.SetFontString(d, cfg.font, 10, "OUTLINE, MONOCHROME")
- name:SetText(fn)
- name:SetPoint("CENTER", d, "CENTER")
- name:SetJustifyH"CENTER"
- local btn = CreateFrame("Frame", fn.."btn", d)
- btn:SetBackdrop(backdrop)
- btn:SetBackdropColor(1,0,0)
- btn:SetBackdropBorderColor(0,0,0)
- btn:SetSize(10,10)
- btn:SetPoint("BOTTOMRIGHT", d, "BOTTOMRIGHT", -2, 2)
- btn:Hide()
- frame.btn = btn
- btn:SetScript("OnMouseUp", function(self, b)
- if frame:IsShown() then
- lib.setfield(fn, false)
- frame:Hide()
- else
- lib.setfield(fn, true)
- frame:Show()
- end
- local v
- if lib.getfield(fn) then v = 1
- else v = 0
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement