diff --git a/LibDropDownMenu.lua b/LibDropDownMenu.lua index e7bbbdb..9d24826 100644 --- a/LibDropDownMenu.lua +++ b/LibDropDownMenu.lua @@ -103,9 +103,6 @@ function UIDropDownMenu_InitializeHelper(frame) -- Hide all the buttons local button, dropDownList; for i = 1, UIDROPDOWNMENU_MAXLEVELS, 1 do - if not _G["LibDropDownMenu_List"..i] then - Create_DropDownList("LibDropDownMenu_List"..i,nil,{id=i}); - end dropDownList = _G["LibDropDownMenu_List"..i]; if ( i >= UIDROPDOWNMENU_MENU_LEVEL or frame ~= UIDROPDOWNMENU_OPEN_MENU ) then dropDownList.numButtons = 0; @@ -146,10 +143,6 @@ function UIDropDownMenu_Initialize(frame, initFunction, displayMode, level, menu level = 1; end - if not _G["LibDropDownMenu_List"..level] then - Create_DropDownList("LibDropDownMenu_List"..level,nil,{id=level}); - end - local dropDownList = _G["LibDropDownMenu_List"..level]; dropDownList.dropdown = frame; dropDownList.shouldRefresh = true; @@ -300,7 +293,7 @@ function UIDropDownMenuButton_OnEnter(self) end GetValueOrCallFunction(self, "funcOnEnter", self); - --self.NewFeature:Hide(); -- in retail, but why? + --self.NewFeature:Hide(); -- why should it disappear on mouse over? (found in retail code) self.NewFeature:SetShown(self.showNewLabel); end @@ -1684,7 +1677,7 @@ function UIDropDownMenu_GetValue(id) end end -function OpenColorPicker(info) +function OpenColorPicker(info) -- deprecated in retail ColorPickerFrame.func = info.swatchFunc; ColorPickerFrame.hasOpacity = info.hasOpacity; ColorPickerFrame.opacityFunc = info.opacityFunc; diff --git a/LibDropDownMenuTemplatesCreate.lua b/LibDropDownMenuTemplatesCreate.lua index cb46f07..e95829f 100644 --- a/LibDropDownMenuTemplatesCreate.lua +++ b/LibDropDownMenuTemplatesCreate.lua @@ -80,9 +80,15 @@ if not PixelUtil then -- classic compatibilty end end -local function Create_NewFeature(parent) +local function Create_NewFeature(parent,frameStrata,frameLevel,width,height,scale,shown) local NewFeature = CreateFrame("Frame",nil,parent); -- ResizeLayoutFrame template unusable - NewFeature:Hide(); + --NewFeature:SetFrameStrata(frameStrata); + --NewFeature:SetFrameLevel(parent:GetFrameLevel()+frameLevel); + NewFeature:SetFrameLevel(frameLevel); + NewFeature:SetSize(width,height); + NewFeature:SetScale(scale); + NewFeature:SetShown(shown); + Mixin(NewFeature,NewFeatureLabelMixin); -- @@ -92,21 +98,28 @@ local function Create_NewFeature(parent) -- -- -- - NewFeature.BGLabel = NewFeature:CreateFontString(nil,"OVERLAY","GameFontNormal_NoShadow",1); + NewFeature.BGLabel = NewFeature:CreateFontString(nil,"OVERLAY","GameFontNormal_NoShadow"); + NewFeature.BGLabel.ignoreInLayout = true; + NewFeature.BGLabel:SetDrawLayer("OVERLAY",1) NewFeature.BGLabel:SetMaxLines(1); NewFeature.BGLabel:SetJustifyH("CENTER") NewFeature.BGLabel:SetText(NEW_CAPS); - NewFeature.BGLabel:SetShadowColor(NEW_FEATURE_SHADOW_COLOR:GetRGBA()) + NewFeature.BGLabel:SetTextColor(0.25,0.78,0.92,1 --[[NEW_FEATURE_SHADOW_COLOR:GetRGBA()]]) + -- RAID_CLASS_COLORS.MAGE looks better on brighter backgrounds NewFeature.BGLabel:SetPoint("CENTER",0.5,-0.5) - NewFeature.Label = NewFeature:CreateFontString(nil,"OVERLAY","GameFontHighlight",1); + + NewFeature.Label = NewFeature:CreateFontString(nil,"OVERLAY","GameFontHighlight"); + NewFeature.Label:SetDrawLayer("OVERLAY",1) NewFeature.Label:SetMaxLines(1) NewFeature.Label:SetJustifyH("CENTER") NewFeature.Label:SetText(NEW_CAPS) - NewFeature.Label:SetShadowColor(NEW_FEATURE_SHADOW_COLOR:GetRGBA()) + NewFeature.Label:SetTextColor(0.25,0.78,0.92,1 --[[NEW_FEATURE_SHADOW_COLOR:GetRGBA()]]) NewFeature.Label:SetPoint("CENTER") + NewFeature.Glow = NewFeature:CreateTexture(nil,"OVERLAY",nil,1) NewFeature.Glow:SetPoint("TOPLEFT",NewFeature.Label,-20,10) NewFeature.Glow:SetPoint("BOTTOMRIGHT",NewFeature.Label,20,-10) + NewFeature.Glow:SetAtlas("collections-newglow") -- -- @@ -126,6 +139,7 @@ local function Create_NewFeature(parent) A2:SetFromAlpha(0.5) A2:SetToAlpha(1) -- + NewFeature.Fade:Play() -- NewFeature:SetScript("OnShow",NewFeature.OnShow); @@ -133,7 +147,6 @@ local function Create_NewFeature(parent) NewFeature:SetScript("OnHide",NewFeature.OnHide); -- - return NewFeature end @@ -202,6 +215,14 @@ local function MenuButton_OnDisable(self) self.invisibleButton:Show(); end +function Update_DropDownMenuButton(name) + local button = _G[name]; + if not (button and button.NewFeature) then return end + + button.NewFeature = Create_NewFeature(button,"FULLSCREEN_DIALOG",100,1,1,0.8,false); + button.NewFeature:SetPoint("LEFT", button.NormalText, "RIGHT", 20, 0); +end + function Create_DropDownMenuButton(name,parent,opts) local button = CreateFrame("Button",name,parent); button:SetSize(100,16); @@ -291,12 +312,7 @@ function Create_DropDownMenuButton(name,parent,opts) button.invisibleButton:SetScript("OnLeave",UIDropDownMenuButtonInvisibleButton_OnLeave); -- -- - button.NewFeature = Create_NewFeature(button); - button.NewFeature:SetFrameStrata("HIGH"); - button.NewFeature:SetScale(0.8); - button.NewFeature:SetFrameLevel(100); - button.NewFeature:SetSize(1,1); - button.NewFeature:Hide(); + button.NewFeature = Create_NewFeature(button,"FULLSCREEN_DIALOG",100,1,1,0.8,false); -- -- @@ -547,3 +563,9 @@ function Create_LargeDropDownMenu(name,parent) return menu; end +-- lua replacement of UIDropDownMenu.xml +if not _G.LibDropDownMenu_List1 then + for i=1, UIDROPDOWNMENU_MAXLEVELS, 1 do + Create_DropDownList("LibDropDownMenu_List"..i,nil,{id=i}); + end +end