WoWInterface SVN PhanxConfigWidgets

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/PhanxConfig-Slider
    from Rev 160 to Rev 161
    Reverse comparison

Rev 160 → Rev 161

PhanxConfig-Slider.lua
61,20 → 61,27
GameTooltip:Hide()
end
 
local function Slider_OnValueChanged(self, value, userInput, delta)
local function Slider_OnMouseWheel(self, delta)
local parent = self:GetParent()
local minValue, maxValue = self:GetMinMaxValues()
local valueStep = self:GetValueStep()
local step = self:GetValueStep() * delta
 
if delta then
local step = valueStep * delta
if step > 0 then
value = min(self:GetValue() + step, maxValue)
else
value = max(self:GetValue() + step, minValue)
end
if step > 0 then
value = min(self:GetValue() + step, maxValue)
else
value = max(self:GetValue() + step, minValue)
end
 
self:SetValue(value)
 
if parent.Callback then
parent:Callback(value)
end
end
 
local function Slider_OnValueChanged(self, value, userInput)
local parent = self:GetParent()
 
if parent.isPercent then
parent.valueText:SetFormattedText("%.0f%%", value * 100)
else
86,10 → 93,6
end
end
 
local function Slider_OnMouseWheel(self, delta)
return Slider_OnValueChanged(self, nil, true, delta)
end
 
------------------------------------------------------------------------
 
local function EditBox_OnEnter(self)
102,7 → 105,7
return Slider_OnLeave(parent.slider)
end
 
local function EditBox_OnEnterPressed(self) -- print("OnEnterPressed SLIDER")
local function EditBox_OnEnterPressed(self)
local parent = self:GetParent():GetParent()
local text = self:GetText()
self:ClearFocus()
128,7 → 131,7
}
 
function lib:New(parent, name, tooltipText, minValue, maxValue, valueStep, percent, noEditBox)
assert(type(parent) == "table" and parent.CreateFontString, "PhanxConfig-Slider: Parent is not a valid frame!")
assert(type(parent) == "table" and type(rawget(parent, 0)) == "userdata", "PhanxConfig-Slider: parent must be a frame")
if type(name) ~= "string" then name = nil end
if type(tooltipText) ~= "string" then tooltipText = nil end
if type(minValue) ~= "number" then minValue = 0 end