Updates
This commit is contained in:
+39
-7
@@ -65,6 +65,9 @@ function DetailsCreateCoolTip()
|
||||
["WidthAnchorMod"] = true,
|
||||
["FixedWidth"] = true,
|
||||
["FixedHeight"] = true,
|
||||
["FixedWidthSub"] = true,
|
||||
["FixedHeightSub"] = true,
|
||||
["IgnoreSubMenu"] = true,
|
||||
["TextHeightMod"] = true,
|
||||
["ButtonHeightMod"] = true,
|
||||
["ButtonHeightModSub"] = true,
|
||||
@@ -89,8 +92,11 @@ function DetailsCreateCoolTip()
|
||||
["IconSize"] = nil,
|
||||
["HeightAnchorMod"] = nil,
|
||||
["WidthAnchorMod"] = nil,
|
||||
["Width"] = nil,
|
||||
["Height"] = nil,
|
||||
["FixedWidth"] = nil,
|
||||
["FixedHeight"] = nil,
|
||||
["FixedWidthSub"] = nil,
|
||||
["FixedHeightSub"] = nil,
|
||||
["IgnoreSubMenu"] = nil,
|
||||
["TextHeightMod"] = nil,
|
||||
["ButtonHeightMod"] = nil,
|
||||
["ButtonHeightModSub"] = nil,
|
||||
@@ -499,7 +505,7 @@ function DetailsCreateCoolTip()
|
||||
|
||||
end
|
||||
|
||||
function CoolTip:TextAndIcon (frame, menuButton, leftTextTable, rightTextTable, leftIconTable, rightIconTable)
|
||||
function CoolTip:TextAndIcon (frame, menuButton, leftTextTable, rightTextTable, leftIconTable, rightIconTable, isSub)
|
||||
|
||||
--> reset width
|
||||
menuButton.leftText:SetWidth (0)
|
||||
@@ -581,6 +587,10 @@ function DetailsCreateCoolTip()
|
||||
frame.w = stringWidth
|
||||
end
|
||||
end
|
||||
else
|
||||
if (isSub and CoolTip.OptionsTable.FixedWidthSub) then
|
||||
menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidthSub - menuButton.leftIcon:GetWidth() - 20)
|
||||
end
|
||||
end
|
||||
|
||||
local height = _math_max ( menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight(), menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight() )
|
||||
@@ -651,7 +661,7 @@ function DetailsCreateCoolTip()
|
||||
CoolTip:TextAndIcon (frame2, menuButton, CoolTip.LeftTextTableSub [mainMenuIndex] and CoolTip.LeftTextTableSub [mainMenuIndex] [index],
|
||||
CoolTip.RightTextTableSub [mainMenuIndex] and CoolTip.RightTextTableSub [mainMenuIndex] [index],
|
||||
CoolTip.LeftIconTableSub [mainMenuIndex] and CoolTip.LeftIconTableSub [mainMenuIndex] [index],
|
||||
CoolTip.RightIconTableSub [mainMenuIndex] and CoolTip.RightIconTableSub [mainMenuIndex] [index])
|
||||
CoolTip.RightIconTableSub [mainMenuIndex] and CoolTip.RightIconTableSub [mainMenuIndex] [index], true)
|
||||
--> setup statusbar
|
||||
CoolTip:StatusBar (menuButton, CoolTip.StatusBarTable [mainMenuIndex] and CoolTip.StatusBarTable [mainMenuIndex] [index])
|
||||
|
||||
@@ -682,6 +692,11 @@ function DetailsCreateCoolTip()
|
||||
|
||||
function CoolTip:ShowSub (index)
|
||||
|
||||
if (CoolTip.OptionsTable.IgnoreSubMenu) then
|
||||
gump:Fade (frame2, 1)
|
||||
return
|
||||
end
|
||||
|
||||
frame2:SetHeight (6)
|
||||
|
||||
local amtIndexes = CoolTip.IndexesSub [index]
|
||||
@@ -690,6 +705,10 @@ function DetailsCreateCoolTip()
|
||||
return
|
||||
end
|
||||
|
||||
if (CoolTip.OptionsTable.FixedWidthSub) then
|
||||
frame2:SetWidth (CoolTip.OptionsTable.FixedWidthSub)
|
||||
end
|
||||
|
||||
frame2.h = CoolTip.IndexesSub [index] * 20
|
||||
frame2.hHeight = 0
|
||||
frame2.w = 0
|
||||
@@ -753,7 +772,10 @@ function DetailsCreateCoolTip()
|
||||
--]]
|
||||
|
||||
frame2:SetHeight ( (frame2.hHeight * CoolTip.IndexesSub [index]) + 12 + (-spacing))
|
||||
frame2:SetWidth (frame2.w + 44)
|
||||
|
||||
if (not CoolTip.OptionsTable.FixedWidthSub) then
|
||||
frame2:SetWidth (frame2.w + 44)
|
||||
end
|
||||
|
||||
gump:Fade (frame2, 0)
|
||||
|
||||
@@ -1870,7 +1892,7 @@ function DetailsCreateCoolTip()
|
||||
end
|
||||
|
||||
--> search key: ~inject
|
||||
function CoolTip:ExecFunc (host)
|
||||
function CoolTip:ExecFunc (host, fromClick)
|
||||
|
||||
if (host.dframework) then
|
||||
if (not host.widget.CoolTip) then
|
||||
@@ -1899,6 +1921,10 @@ function DetailsCreateCoolTip()
|
||||
|
||||
host.CoolTip.BuildFunc()
|
||||
CoolTip:ShowCooltip()
|
||||
|
||||
if (fromClick) then
|
||||
UIFrameFlash (frame1, 0.05, 0.05, 0.2, true, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local InjectOnUpdateEnter = function (self, elapsed)
|
||||
@@ -1956,7 +1982,7 @@ function DetailsCreateCoolTip()
|
||||
end
|
||||
end
|
||||
|
||||
function CoolTip:CoolTipInject (host)
|
||||
function CoolTip:CoolTipInject (host, openOnClick)
|
||||
if (host.dframework) then
|
||||
if (not host.widget.CoolTip) then
|
||||
host.widget.CoolTip = host.CoolTip
|
||||
@@ -1976,6 +2002,12 @@ function DetailsCreateCoolTip()
|
||||
host:SetScript ("OnEnter", InjectOnEnter)
|
||||
host:SetScript ("OnLeave", InjectOnLeave)
|
||||
|
||||
if (openOnClick) then
|
||||
if (host:GetObjectType() == "Button") then
|
||||
host:SetScript ("OnClick", function() CoolTip:ExecFunc (host, true) end)
|
||||
end
|
||||
end
|
||||
|
||||
return ture
|
||||
end
|
||||
|
||||
|
||||
@@ -558,6 +558,7 @@ function DetailsDropDownOnMouseDown (button)
|
||||
end
|
||||
end
|
||||
|
||||
object.scroll:SetValue (0)
|
||||
object:Open()
|
||||
|
||||
else
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
local _detalhes = _G._detalhes
|
||||
local gump = _detalhes.gump
|
||||
|
||||
local _rawset = rawset --> lua local
|
||||
local _rawget = rawget --> lua local
|
||||
local APIHelpFunctions = false
|
||||
local HelpMetaFunctions = {}
|
||||
|
||||
local get_members_function_index = {}
|
||||
|
||||
HelpMetaFunctions.__index = function (_table, _member_requested)
|
||||
|
||||
local func = get_members_function_index [_member_requested]
|
||||
if (func) then
|
||||
return func (_table, _member_requested)
|
||||
end
|
||||
|
||||
local fromMe = _rawget (_table, _member_requested)
|
||||
if (fromMe) then
|
||||
return fromMe
|
||||
end
|
||||
|
||||
return HelpMetaFunctions [_member_requested]
|
||||
end
|
||||
|
||||
local set_members_function_index = {}
|
||||
|
||||
HelpMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
local func = set_members_function_index [_key]
|
||||
if (func) then
|
||||
return func (_table, _value)
|
||||
else
|
||||
return _rawset (_table, _key, _value)
|
||||
end
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:AddHelp (width, height, x, y, buttonX, buttonY, text, anchor)
|
||||
self.helpTable [#self.helpTable + 1] = {
|
||||
HighLightBox = {x = x, y = y, width = width, height = height},
|
||||
ButtonPos = { x = buttonX, y = buttonY},
|
||||
ToolTipDir = anchor or "RIGHT",
|
||||
ToolTipText = text
|
||||
}
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
|
||||
v1, v2, v3, v4, v5 = gump:CheckPoints (v1, v2, v3, v4, v5, self)
|
||||
if (not v1) then
|
||||
print ("Invalid parameter for SetPoint")
|
||||
return
|
||||
end
|
||||
return self.widget:SetPoint (v1, v2, v3, v4, v5)
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:ShowHelp()
|
||||
if (not HelpPlate_IsShowing (self.helpTable)) then
|
||||
HelpPlate_Show (self.helpTable, self.frame, self.button, true)
|
||||
else
|
||||
HelpPlate_Hide (true)
|
||||
end
|
||||
end
|
||||
|
||||
local nameCounter = 1
|
||||
function _detalhes.gump:NewHelp (parent, width, height, x, y, buttonWidth, buttonHeight, name)
|
||||
|
||||
local help = {}
|
||||
|
||||
if (parent.dframework) then
|
||||
parent = parent.widget
|
||||
end
|
||||
|
||||
local helpButton = CreateFrame ("button", name or "DetailsHelpButton"..nameCounter, parent, "MainHelpPlateButton")
|
||||
nameCounter = nameCounter + 1
|
||||
|
||||
if (not APIHelpFunctions) then
|
||||
APIHelpFunctions = true
|
||||
local idx = getmetatable (helpButton).__index
|
||||
for funcName, funcAddress in pairs (idx) do
|
||||
if (not HelpMetaFunctions [funcName]) then
|
||||
HelpMetaFunctions [funcName] = function (object, ...)
|
||||
local x = loadstring ( "return _G."..object.button:GetName()..":"..funcName.."(...)")
|
||||
return x (...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (buttonWidth and buttonHeight) then
|
||||
helpButton:SetWidth (buttonWidth)
|
||||
helpButton:SetHeight (buttonHeight)
|
||||
helpButton.I:SetWidth (buttonWidth*0.8)
|
||||
helpButton.I:SetHeight (buttonHeight*0.8)
|
||||
helpButton.Ring:SetWidth (buttonWidth)
|
||||
helpButton.Ring:SetHeight (buttonHeight)
|
||||
helpButton.Ring:SetPoint ("center", buttonWidth*.2, -buttonWidth*.2)
|
||||
end
|
||||
|
||||
help.helpTable = {
|
||||
FramePos = {x = x, y = y},
|
||||
FrameSize = {width = width, height = height}
|
||||
}
|
||||
|
||||
help.frame = parent
|
||||
help.button = helpButton
|
||||
help.widget = helpButton
|
||||
help.I = helpButton.I
|
||||
help.Ring = helpButton.Ring
|
||||
|
||||
helpButton:SetScript ("OnClick", function()
|
||||
help:ShowHelp()
|
||||
end)
|
||||
|
||||
setmetatable (help, HelpMetaFunctions)
|
||||
|
||||
return help
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user