From 2c7cce945d8a462a9bcb9ec60d05acdd763d4ae2 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Mon, 29 Sep 2014 16:12:54 +0400 Subject: [PATCH] Export frame dragging and dropdown shit --- ElvUI_SLE/core/toolkit.lua | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/ElvUI_SLE/core/toolkit.lua b/ElvUI_SLE/core/toolkit.lua index f7b78d8..a1b7fc6 100644 --- a/ElvUI_SLE/core/toolkit.lua +++ b/ElvUI_SLE/core/toolkit.lua @@ -141,6 +141,14 @@ function SLE:CreateExport() frame:Hide() frame:EnableMouse(true) frame:SetFrameStrata("DIALOG") + frame:SetMovable(true) + frame:RegisterForDrag("LeftButton") + frame:SetScript("OnDragStart", function(self) + if IsShiftKeyDown() then + self:StartMoving() + end + end) + frame:SetScript("OnDragStop", frame.StopMovingOrSizing) local text = frame:CreateFontString(nil, "OVERLAY") text:SetFont(E["media"].normFont, 14) @@ -148,6 +156,39 @@ function SLE:CreateExport() text:SetText("< "..L["Export / Import"].." >") text:SetJustifyH("left") + local dropdown = CreateFrame("Button", "SLEExImDropDown", frame, "UIDropDownMenuTemplate") + dropdown:ClearAllPoints() + dropdown:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -3) + dropdown:Show() + Sk:HandleDropDownBox(dropdown) + + local items = { + L["Profile"], + L["Private"], + L["Global"], + L["All"], + } + + local function OnClick(self) + UIDropDownMenu_SetSelectedID(dropdown, self:GetID()) + end + + local function initialize(self, level) + local info = UIDropDownMenu_CreateInfo() + for k,v in pairs(items) do + info = UIDropDownMenu_CreateInfo() + info.text = v + info.value = v + info.func = OnClick + UIDropDownMenu_AddButton(info, level) + end + end + + + UIDropDownMenu_Initialize(dropdown, initialize) + UIDropDownMenu_SetSelectedID(dropdown, 1) + UIDropDownMenu_JustifyText(dropdown, "LEFT") + local ExScrollArea = CreateFrame("ScrollFrame", "SLEExportScrollFrame", frame, "UIPanelScrollFrameTemplate") ExScrollArea:Point("TOPLEFT", frame, "TOPLEFT", 10, -30) ExScrollArea:Point("BOTTOMRIGHT", frame, "BOTTOM", -25, 30) @@ -254,6 +295,11 @@ Private will copy character specific settings.|r]]) GameTooltip:Show() end) exHelp:HookScript("OnLeave", function() GameTooltip:Hide() end) + exHelp:SetScript("OnClick", function(self) + + ExEditBox:SetText(items[dropdown.selectedID]) + + end) local button3 = CreateFrame("Button", "SLEExportPrivateTab", frame) button3:Size(100, 20) -- 1.7.9.5