Framework update, preparing to release
This commit is contained in:
+14
-4
@@ -385,6 +385,7 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
|
||||
|
||||
---add an icon to the left of the button text
|
||||
---short method truncates the text: false = do nothing, nil = increate the button width, 1 = decrease the font size, 2 = truncate the text
|
||||
---@param self table
|
||||
---@param texture any
|
||||
---@param width number|nil
|
||||
---@param height number|nil
|
||||
@@ -395,7 +396,8 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
|
||||
---@param leftPadding number|nil
|
||||
---@param textHeight number|nil
|
||||
---@param shortMethod any
|
||||
function ButtonMetaFunctions:SetIcon(texture, width, height, layout, texcoord, overlay, textDistance, leftPadding, textHeight, shortMethod)
|
||||
---@param filterMode any
|
||||
function ButtonMetaFunctions:SetIcon(texture, width, height, layout, texcoord, overlay, textDistance, leftPadding, textHeight, shortMethod, filterMode)
|
||||
if (not self.icon) then
|
||||
self.icon = self:CreateTexture(nil, "artwork")
|
||||
self.icon:SetSize(self.height * 0.8, self.height * 0.8)
|
||||
@@ -424,10 +426,10 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
|
||||
local r, g, b, a = detailsFramework:ParseColors(texture)
|
||||
self.icon:SetColorTexture(r, g, b, a)
|
||||
else
|
||||
self.icon:SetTexture(texture)
|
||||
self.icon:SetTexture(texture, nil, nil, filterMode)
|
||||
end
|
||||
else
|
||||
self.icon:SetTexture(texture)
|
||||
self.icon:SetTexture(texture, nil, nil, filterMode)
|
||||
end
|
||||
|
||||
self.icon:SetSize(width or self.height * 0.8, height or self.height * 0.8)
|
||||
@@ -468,6 +470,13 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
|
||||
end
|
||||
end
|
||||
|
||||
---@param self df_button
|
||||
function ButtonMetaFunctions:SetIconFilterMode(filterMode)
|
||||
if (self.icon) then
|
||||
self.icon:SetTexture(self.icon:GetTexture(), nil, nil, filterMode)
|
||||
end
|
||||
end
|
||||
|
||||
---query if the button is enabled or not
|
||||
---@return boolean
|
||||
function ButtonMetaFunctions:IsEnabled()
|
||||
@@ -888,6 +897,7 @@ end
|
||||
---@field SetTextColor fun(self: df_button, color: any) set the button text color
|
||||
---@field SetText fun(self: df_button, text: string) set the button text
|
||||
---@field SetClickFunction fun(self: df_button, func: function, param1: any, param2: any, clickType: "left"|"right"|nil)
|
||||
---@field SetIconFilterMode fun(self: df_button, filterMode: any) set the filter mode for the icon, execute after SetIcon()
|
||||
|
||||
---create a Details Framework button
|
||||
---@param parent frame
|
||||
@@ -1097,7 +1107,7 @@ end
|
||||
---@param callback function
|
||||
---@param alpha number|nil
|
||||
---@param buttonTemplate table|nil
|
||||
---@return table|nil
|
||||
---@return df_colorpickbutton
|
||||
function detailsFramework:CreateColorPickButton(parent, name, member, callback, alpha, buttonTemplate)
|
||||
return detailsFramework:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user