|
|
@ -97,6 +97,7 @@ local wireFrame = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
-- | Internal Methods |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
|
-- | Internal Methods |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
|
|
|
|
|
---@param self Diesal.GUI.Object.Spinner |
|
|
|
local function processNumber(self, number) |
|
|
|
local function processNumber(self, number) |
|
|
|
local settings = self.settings |
|
|
|
local settings = self.settings |
|
|
|
local number, oldNumber = tonumber(number), self:GetNumber() |
|
|
|
local number, oldNumber = tonumber(number), self:GetNumber() |
|
|
@ -241,8 +242,10 @@ local methods = { |
|
|
|
---@field bar boolean |
|
|
|
---@field bar boolean |
|
|
|
---@field min number |
|
|
|
---@field min number |
|
|
|
---@field max number |
|
|
|
---@field max number |
|
|
|
---@field step number |
|
|
|
---@field prefix? string |
|
|
|
---@field shiftStep number |
|
|
|
---@field shiftStep number |
|
|
|
|
|
|
|
---@field step number |
|
|
|
|
|
|
|
---@field suffix? string |
|
|
|
|
|
|
|
|
|
|
|
---@class Diesal.GUI.Object.Spinner.Settings: Diesal.GUI.Object.Spinner.Settings.Defaults |
|
|
|
---@class Diesal.GUI.Object.Spinner.Settings: Diesal.GUI.Object.Spinner.Settings.Defaults |
|
|
|
---@field number number |
|
|
|
---@field number number |
|
|
@ -251,6 +254,11 @@ local methods = { |
|
|
|
local function Constructor() |
|
|
|
local function Constructor() |
|
|
|
---@class Diesal.GUI.Object.Spinner : Diesal.GUI.ObjectBase, Diesal.GUI.Spinner.Methods |
|
|
|
---@class Diesal.GUI.Object.Spinner : Diesal.GUI.ObjectBase, Diesal.GUI.Spinner.Methods |
|
|
|
---@field settings Diesal.GUI.Object.Spinner.Settings |
|
|
|
---@field settings Diesal.GUI.Object.Spinner.Settings |
|
|
|
|
|
|
|
---@field bar Frame |
|
|
|
|
|
|
|
---@field value number |
|
|
|
|
|
|
|
---@field buttonUp Button |
|
|
|
|
|
|
|
---@field buttonDown Button |
|
|
|
|
|
|
|
---@field editBox EditBox |
|
|
|
local self = DiesalGUI:Create(Type, true) |
|
|
|
local self = DiesalGUI:Create(Type, true) |
|
|
|
local frame = CreateFrame("Frame", nil, UIParent) |
|
|
|
local frame = CreateFrame("Frame", nil, UIParent) |
|
|
|
self.frame = frame |
|
|
|
self.frame = frame |
|
|
@ -276,14 +284,15 @@ local function Constructor() |
|
|
|
self:UpdateBar() |
|
|
|
self:UpdateBar() |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
local editBox = self:CreateRegion("EditBox", "editBox", frame) --[[ @asDiesal.GUI.Region.EditBoxx ]] |
|
|
|
local editBox = self:CreateRegion("EditBox", "editBox", frame) --[[ @as Diesal.GUI.Region.EditBox ]] |
|
|
|
editBox:SetPoint("TOP") |
|
|
|
editBox:SetPoint("TOP") |
|
|
|
editBox:SetPoint("BOTTOM") |
|
|
|
editBox:SetPoint("BOTTOM") |
|
|
|
editBox:SetAutoFocus(false) |
|
|
|
editBox:SetAutoFocus(false) |
|
|
|
editBox:SetJustifyH("CENTER") |
|
|
|
editBox:SetJustifyH("CENTER") |
|
|
|
editBox:SetJustifyV("CENTER") |
|
|
|
editBox:SetJustifyV("CENTER") |
|
|
|
editBox:SetTextInsets(0, 0, 0, 0) |
|
|
|
editBox:SetTextInsets(0, 0, 0, 0) |
|
|
|
editBox:SetText(self.defaults.min) |
|
|
|
editBox:SetNumber(self.defaults.min) |
|
|
|
|
|
|
|
---@param this EditBox |
|
|
|
editBox:SetScript("OnEnterPressed", function(this, ...) |
|
|
|
editBox:SetScript("OnEnterPressed", function(this, ...) |
|
|
|
local number = this:GetNumber() or self.settings.number -- if entered text or nothing revert to old value |
|
|
|
local number = this:GetNumber() or self.settings.number -- if entered text or nothing revert to old value |
|
|
|
local newNumber = processNumber(self, number) |
|
|
|
local newNumber = processNumber(self, number) |
|
|
|