comparison Libs/DF/cooltip.lua @ 56:7c0f819a85c6 v7.3.5.056

- Framework update.
author Tercio
date Sun, 11 Mar 2018 10:50:12 -0300
parents 307f5af3ad02
children 0682d738499b
comparison
equal deleted inserted replaced
55:307f5af3ad02 56:7c0f819a85c6
1621 menuButton.isDiv = false 1621 menuButton.isDiv = false
1622 end 1622 end
1623 end 1623 end
1624 1624
1625 end 1625 end
1626 1626
1627 if (CoolTip.OptionsTable.FixedHeight) then 1627 if (CoolTip.OptionsTable.FixedHeight) then
1628 frame1:SetHeight (CoolTip.OptionsTable.FixedHeight) 1628 frame1:SetHeight (CoolTip.OptionsTable.FixedHeight)
1629 else 1629 else
1630 local mod = CoolTip.OptionsTable.HeighMod or 0 1630 local mod = CoolTip.OptionsTable.HeighMod or 0
1631 frame1:SetHeight (_math_max ( (frame1.hHeight * CoolTip.Indexes) + 12 + (-spacing) + mod, 22 )) 1631 frame1:SetHeight (_math_max ( (frame1.hHeight * CoolTip.Indexes) + 12 + (-spacing) + mod, 22 ))
1681 1681
1682 --> clear all points 1682 --> clear all points
1683 frame1:ClearAllPoints() 1683 frame1:ClearAllPoints()
1684 1684
1685 local anchor = CoolTip.OptionsTable.Anchor or CoolTip.Host 1685 local anchor = CoolTip.OptionsTable.Anchor or CoolTip.Host
1686
1686 frame1:SetPoint (CoolTip.OptionsTable.MyAnchor, anchor, CoolTip.OptionsTable.RelativeAnchor, 0 + moveX + CoolTip.OptionsTable.WidthAnchorMod, 10 + CoolTip.OptionsTable.HeightAnchorMod + moveY) 1687 frame1:SetPoint (CoolTip.OptionsTable.MyAnchor, anchor, CoolTip.OptionsTable.RelativeAnchor, 0 + moveX + CoolTip.OptionsTable.WidthAnchorMod, 10 + CoolTip.OptionsTable.HeightAnchorMod + moveY)
1687 1688
1688 if (not x_mod) then 1689 if (not x_mod) then
1689 --> check if cooltip is out of screen bounds 1690 --> check if cooltip is out of screen bounds
1690 local center_x = frame1:GetCenter() 1691 local center_x = frame1:GetCenter()
1848 end 1849 end
1849 1850
1850 function CoolTip:SetHost (frame, myPoint, hisPoint, x, y) 1851 function CoolTip:SetHost (frame, myPoint, hisPoint, x, y)
1851 --> check data integrity 1852 --> check data integrity
1852 if (type (frame) ~= "table" or not frame.GetObjectType) then 1853 if (type (frame) ~= "table" or not frame.GetObjectType) then
1853 print ("host need to be a frame") 1854 print ("host needs to be a frame")
1854 return --> error 1855 return --> error
1855 end 1856 end
1856 1857
1857 CoolTip.Host = frame 1858 CoolTip.Host = frame
1858 1859
1859 CoolTip.frame1:SetFrameLevel (frame:GetFrameLevel()+1) 1860 CoolTip.frame1:SetFrameLevel (frame:GetFrameLevel()+1)
1860 1861
1861 --> defaults 1862 --> defaults
1862 myPoint = myPoint or CoolTip.OptionsTable.MyAnchor or "bottom" 1863 myPoint = myPoint or CoolTip.OptionsTable.MyAnchor or "bottom"
1863 hisPoint = hisPoint or CoolTip.OptionsTable.hisPoint or "top" 1864 hisPoint = hisPoint or CoolTip.OptionsTable.hisPoint or "top"
2962 CoolTip:SetType (host.CoolTip.Type) 2963 CoolTip:SetType (host.CoolTip.Type)
2963 CoolTip:SetFixedParameter (host.CoolTip.FixedValue) 2964 CoolTip:SetFixedParameter (host.CoolTip.FixedValue)
2964 CoolTip:SetColor ("main", host.CoolTip.MainColor or "transparent") 2965 CoolTip:SetColor ("main", host.CoolTip.MainColor or "transparent")
2965 CoolTip:SetColor ("sec", host.CoolTip.SubColor or "transparent") 2966 CoolTip:SetColor ("sec", host.CoolTip.SubColor or "transparent")
2966 2967
2968 local okay, errortext = pcall (host.CoolTip.BuildFunc, host, host.CoolTip and host.CoolTip.FixedValue) --resetting anchors
2969 if (not okay) then
2970 print ("Cooltip Injected Fucntion Error:", errortext)
2971 end
2972
2967 CoolTip:SetOwner (host, host.CoolTip.MyAnchor, host.CoolTip.HisAnchor, host.CoolTip.X, host.CoolTip.Y) 2973 CoolTip:SetOwner (host, host.CoolTip.MyAnchor, host.CoolTip.HisAnchor, host.CoolTip.X, host.CoolTip.Y)
2968 2974
2969 local options = host.CoolTip.Options 2975 local options = host.CoolTip.Options
2970 if (type (options) == "function") then 2976 if (type (options) == "function") then
2971 options = options() 2977 options = options()
2973 if (options) then 2979 if (options) then
2974 for optionName, optionValue in pairs (options) do 2980 for optionName, optionValue in pairs (options) do
2975 CoolTip:SetOption (optionName, optionValue) 2981 CoolTip:SetOption (optionName, optionValue)
2976 end 2982 end
2977 end 2983 end
2978
2979 host.CoolTip.BuildFunc()
2980 2984
2981 if (CoolTip.Indexes == 0) then 2985 if (CoolTip.Indexes == 0) then
2982 if (host.CoolTip.Default) then 2986 if (host.CoolTip.Default) then
2983 CoolTip:SetType ("tooltip") 2987 CoolTip:SetType ("tooltip")
2984 CoolTip:AddLine (host.CoolTip.Default, nil, 1, "white") 2988 CoolTip:AddLine (host.CoolTip.Default, nil, 1, "white")
2985 end 2989 end
2986 end 2990 end
2987 2991
2988 CoolTip:ShowCooltip() 2992 CoolTip:ShowCooltip()
2989 2993
2990 if (fromClick) then 2994 if (fromClick) then
2991 --UIFrameFlash (frame1, ) 2995 --UIFrameFlash (frame1, )
2992 frame1:Flash (0.05, 0.05, 0.2, true, 0, 0) 2996 frame1:Flash (0.05, 0.05, 0.2, true, 0, 0)