diff Libs/DF/cooltip.lua @ 40:a960d5372b0c

- framework update from v22 to v44.
author Tercio
date Wed, 31 Aug 2016 19:55:14 -0300
parents 7944c081e5b4
children 2bbf129690b0
line wrap: on
line diff
--- a/Libs/DF/cooltip.lua	Tue Jul 19 13:23:40 2016 -0300
+++ b/Libs/DF/cooltip.lua	Wed Aug 31 19:55:14 2016 -0300
@@ -156,6 +156,10 @@
 			frame1 = CreateFrame ("Frame", "GameCooltipFrame1", UIParent, "DFCooltipMainFrameTemplate")
 			tinsert (UISpecialFrames, "GameCooltipFrame1")
 			DF:CreateFlashAnimation (frame1)
+			
+			if (DF.CreateBorder) then
+				DF:CreateBorder (frame1, .3, .1, .03)
+			end
 		else
 			frame1 = GameCooltipFrame1
 		end
@@ -174,11 +178,15 @@
 			tinsert (UISpecialFrames, "GameCooltipFrame2")
 			DF:CreateFlashAnimation (frame2)
 			frame2:SetClampedToScreen (true)
+			
+			if (DF.CreateBorder) then
+				DF:CreateBorder (frame2, .3, .1, .03)
+			end
 		else
 			frame2 = GameCooltipFrame2
 		end
 
-		frame2:SetPoint ("bottomleft", frame1, "bottomright")
+		frame2:SetPoint ("bottomleft", frame1, "bottomright", 4, 0)
 		
 		GameCooltipFrame2_FrameBackgroundCenter:SetTexture (DF.folder .. "cooltip_background")
 		GameCooltipFrame2_FrameBackgroundCenter:SetTexCoord (0.10546875, 0.89453125, 0, 1)
@@ -593,16 +601,16 @@
 			frame.selectedTop:ClearAllPoints()
 			frame.selectedBottom:ClearAllPoints()
 		
-			frame.selectedTop:SetPoint ("topleft", button, "topleft", left, top) --
-			frame.selectedTop:SetPoint ("topright", button, "topright", right, top) --
+			frame.selectedTop:SetPoint ("topleft", button, "topleft", left+1, top) --
+			frame.selectedTop:SetPoint ("topright", button, "topright", right-1, top) --
 			
-			frame.selectedBottom:SetPoint ("bottomleft", button, "bottomleft", left, bottom) --
-			frame.selectedBottom:SetPoint ("bottomright", button, "bottomright", right, bottom) --
+			frame.selectedBottom:SetPoint ("bottomleft", button, "bottomleft", left+1, bottom) --
+			frame.selectedBottom:SetPoint ("bottomright", button, "bottomright", right-1, bottom) --
 
 			CoolTip:ShowSelectedTexture (frame)
 		end
 		
-		local OnClickFunctionButtonPrincipal = function (self)
+		local OnClickFunctionButtonPrincipal = function (self, button)
 					if (CoolTip.IndexesSub [self.index] and CoolTip.IndexesSub [self.index] > 0) then
 						CoolTip:ShowSub (self.index)
 						CoolTip.last_button = self.index
@@ -619,18 +627,18 @@
 					
 					if (CoolTip.FunctionsTableMain [self.index]) then
 						local parameterTable = CoolTip.ParametersTableMain [self.index]
-						CoolTip.FunctionsTableMain [self.index] (_, CoolTip.FixedValue, parameterTable [1], parameterTable [2], parameterTable [3])
+						CoolTip.FunctionsTableMain [self.index] (_, CoolTip.FixedValue, parameterTable [1], parameterTable [2], parameterTable [3], button)
 					end
 				end
 				
-		local OnClickFunctionButtonSecundario = function (self)
+		local OnClickFunctionButtonSecundario = function (self, button)
 					CoolTip.buttonClicked = true
 					
 					CoolTip:SetSelectedAnchor (frame2, self)
 					
 					if (CoolTip.FunctionsTableSub [self.mainIndex] and CoolTip.FunctionsTableSub [self.mainIndex] [self.index]) then
 						local parameterTable = CoolTip.ParametersTableSub [self.mainIndex] [self.index]
-						CoolTip.FunctionsTableSub [self.mainIndex] [self.index] (_, CoolTip.FixedValue, parameterTable [1], parameterTable [2], parameterTable [3])
+						CoolTip.FunctionsTableSub [self.mainIndex] [self.index] (_, CoolTip.FixedValue, parameterTable [1], parameterTable [2], parameterTable [3], button)
 					end
 					
 					local botao_p = frame1.Lines [self.mainIndex]
@@ -757,12 +765,6 @@
 					menuButton.rightText:SetWidth (0)
 				end
 				
-				if (CoolTip.OptionsTable.RightTextHeight) then
-					menuButton.rightText:SetHeight (CoolTip.OptionsTable.RightTextHeight)
-				else
-					menuButton.rightText:SetHeight (0)
-				end
-				
 				if (CoolTip.OptionsTable.TextFont and not rightTextTable [7]) then
 					if (_G [CoolTip.OptionsTable.TextFont]) then
 						menuButton.rightText:SetFontObject (CoolTip.OptionsTable.TextFont)
@@ -852,9 +854,18 @@
 				menuButton.rightIcon:SetHeight (CoolTip.OptionsTable.IconSize)
 			end
 			
+			menuButton.leftText:SetHeight (0)
+			menuButton.rightText:SetHeight (0)
+			
 			if (CoolTip.Type == 2) then
 				CoolTip:LeftTextSpace (menuButton)
 			end
+			if (CoolTip.OptionsTable.LeftTextHeight) then
+				menuButton.leftText:SetHeight (CoolTip.OptionsTable.LeftTextHeight)
+			end
+			if (CoolTip.OptionsTable.RightTextHeight) then
+				menuButton.rightText:SetHeight (CoolTip.OptionsTable.RightTextHeight)
+			end
 			
 			--> string length
 			if (not isSub) then --> main frame
@@ -866,7 +877,7 @@
 						end
 					end
 				else
-					menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidth - menuButton.leftIcon:GetWidth() - menuButton.rightText:GetStringWidth() - menuButton.rightIcon:GetWidth() - 30)
+					menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidth - menuButton.leftIcon:GetWidth() - menuButton.rightText:GetStringWidth() - menuButton.rightIcon:GetWidth() - 22)
 				end
 			else
 				if (not CoolTip.OptionsTable.FixedWidthSub) then
@@ -877,7 +888,7 @@
 						end
 					end
 				else
-					menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidthSub - menuButton.leftIcon:GetWidth() - 20)
+					menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidthSub - menuButton.leftIcon:GetWidth() - 12)
 				end
 			end
 			
@@ -1011,15 +1022,14 @@
 			--> setup statusbar
 			CoolTip:StatusBar (menuButton, CoolTip.StatusBarTableSub [mainMenuIndex] and CoolTip.StatusBarTableSub [mainMenuIndex] [index])
 
-
 			--> click
 			menuButton:RegisterForClicks ("LeftButtonDown")
 			
 			menuButton:ClearAllPoints()
 			menuButton:SetPoint ("center", frame2, "center")
 			menuButton:SetPoint ("top", frame2, "top", 0, (((index-1)*20)*-1)-3)
-			menuButton:SetPoint ("left", frame2, "left")
-			menuButton:SetPoint ("right", frame2, "right")
+			menuButton:SetPoint ("left", frame2, "left", -4, 0)
+			menuButton:SetPoint ("right", frame2, "right", 4, 0)
 			
 			DF:FadeFrame (menuButton, 0)
 			
@@ -1160,8 +1170,8 @@
 				menuButton:ClearAllPoints()
 				
 				menuButton:SetPoint ("center", frame2, "center")
-				menuButton:SetPoint ("left", frame2, "left")
-				menuButton:SetPoint ("right", frame2, "right")
+				menuButton:SetPoint ("left", frame2, "left", -4, 0)
+				menuButton:SetPoint ("right", frame2, "right", 4, 0)
 				
 				menuButton.rightText:SetText ("")
 				
@@ -1204,8 +1214,8 @@
 				if (CoolTip.OptionsTable.YSpacingModSub) then
 					spacing = spacing + CoolTip.OptionsTable.YSpacingModSub
 				end
-				menuButton:SetPoint ("left", frame2, "left")
-				menuButton:SetPoint ("right", frame2, "right")
+				menuButton:SetPoint ("left", frame2, "left", -4, 0)
+				menuButton:SetPoint ("right", frame2, "right", 4, 0)
 				
 				if (menuButton.divbar) then
 					menuButton.divbar:Hide()
@@ -1248,21 +1258,21 @@
 			local button = frame1.Lines [index]
 		
 			frame2:ClearAllPoints()
-			frame2:SetPoint ("left", button, "right")
+			frame2:SetPoint ("left", button, "right", 4, 0)
 			
 		elseif (CoolTip.OptionsTable.SubFollowButton and CoolTip.frame2_leftside) then
 		
 			local button = frame1.Lines [index]
 		
 			frame2:ClearAllPoints()
-			frame2:SetPoint ("right", button, "left")
+			frame2:SetPoint ("right", button, "left", -4, 0)
 			
 		elseif (CoolTip.frame2_leftside) then
 			frame2:ClearAllPoints()
-			frame2:SetPoint ("bottomright", frame1, "bottomleft")
+			frame2:SetPoint ("bottomright", frame1, "bottomleft", -4, 0)
 		else
 			frame2:ClearAllPoints()
-			frame2:SetPoint ("bottomleft", frame1, "bottomright")
+			frame2:SetPoint ("bottomleft", frame1, "bottomright", 4, 0)
 		end
 		
 	end
@@ -1339,8 +1349,8 @@
 			
 			menuButton:ClearAllPoints()
 			menuButton:SetPoint ("center", frame1, "center")
-			menuButton:SetPoint ("left", frame1, "left")
-			menuButton:SetPoint ("right", frame1, "right")
+			menuButton:SetPoint ("left", frame1, "left", -4, 0)
+			menuButton:SetPoint ("right", frame1, "right", 4, 0)
 			
 			--> height
 			if (CoolTip.OptionsTable.AlignAsBlizzTooltip) then
@@ -1531,8 +1541,8 @@
 				menuButton:SetHeight (4)
 				--> points
 				menuButton:ClearAllPoints()				
-				menuButton:SetPoint ("left", frame1, "left")
-				menuButton:SetPoint ("right", frame1, "right")
+				menuButton:SetPoint ("left", frame1, "left", -4, 0)
+				menuButton:SetPoint ("right", frame1, "right", 4, 0)
 				menuButton:SetPoint ("center", frame1, "center")
 				
 				local div_size_up = tonumber (CoolTip.LeftTextTable [i] [2])
@@ -1574,8 +1584,8 @@
 				if (CoolTip.OptionsTable.YSpacingMod) then
 					spacing = spacing + CoolTip.OptionsTable.YSpacingMod
 				end
-				menuButton:SetPoint ("left", frame1, "left")
-				menuButton:SetPoint ("right", frame1, "right")
+				menuButton:SetPoint ("left", frame1, "left", -4, 0)
+				menuButton:SetPoint ("right", frame1, "right", 4, 0)
 			
 				if (menuButton.divbar) then
 					menuButton.divbar:Hide()
@@ -1711,7 +1721,7 @@
 						CoolTip.overlap_checked = true
 						
 						frame2:ClearAllPoints()
-						frame2:SetPoint ("bottomright", frame1, "bottomleft")
+						frame2:SetPoint ("bottomright", frame1, "bottomleft", 4, 0)
 						CoolTip.frame2_leftside = true
 						--> diff
 						return CoolTip:SetMyPoint (host, CoolTip.internal_x_mod , CoolTip.internal_y_mod)
@@ -1743,7 +1753,7 @@
 						local diff = f2_start_point - f1_end_point
 
 						frame2:ClearAllPoints()
-						frame2:SetPoint ("bottomright", frame1, "bottomleft")
+						frame2:SetPoint ("bottomright", frame1, "bottomleft", 4, 0)
 						CoolTip.frame2_leftside = true
 					end
 				
@@ -1971,8 +1981,13 @@
 		function CoolTip:Reset()
 
 			frame2:ClearAllPoints()
-			frame2:SetPoint ("bottomleft", frame1, "bottomright")
-		
+			frame2:SetPoint ("bottomleft", frame1, "bottomright", 4, 0)
+
+			frame1:SetParent (UIParent)
+			frame2:SetParent (UIParent)
+			frame1:SetFrameStrata ("TOOLTIP")
+			frame2:SetFrameStrata ("TOOLTIP")
+			
 			CoolTip:HideSelectedTexture (frame1)
 			CoolTip:HideSelectedTexture (frame2)
 		
@@ -2846,6 +2861,11 @@
 		
 		function CoolTip:ShowCooltip (frame, menuType, color)
 
+			frame1:SetFrameStrata ("TOOLTIP")
+			frame2:SetFrameStrata ("TOOLTIP")
+			frame1:SetParent (UIParent)
+			frame2:SetParent (UIParent)
+		
 			CoolTip.had_interaction = false
 		
 			if (frame) then
@@ -3066,10 +3086,10 @@
 			self:SetOption ("YSpacingMod", -4)
 			self:SetOption ("IgnoreButtonAutoHeight", true)
 			
-			--self:SetColor (1, 0.5, 0.5, 0.5, 0.5)
 			self:SetColor (1, 0.5, 0.5, 0.5, 0)
 			
 			self:SetBackdrop (1, preset2_backdrop, gray_table, black_table)
+			self:SetBackdrop (2, preset2_backdrop, gray_table, black_table)
 		end
 	end