11--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
22-- @class file
33-- @name AceConfigDialog-3.0
4- -- @release $Id: AceConfigDialog-3.0.lua 1372 2025-10-05 05:38:34Z nevcairiel $
4+ -- @release $Id: AceConfigDialog-3.0.lua 1386 2025-12-11 18:25:02Z nevcairiel $
55
66local LibStub = LibStub
77local gui = LibStub (" AceGUI-3.0" )
88local reg = LibStub (" AceConfigRegistry-3.0" )
99
10- local MAJOR , MINOR = " AceConfigDialog-3.0" , 89
10+ local MAJOR , MINOR = " AceConfigDialog-3.0" , 92
1111local AceConfigDialog , oldminor = LibStub :NewLibrary (MAJOR , MINOR )
1212
1313if not AceConfigDialog then return end
@@ -1083,6 +1083,11 @@ local function InjectInfo(control, options, option, path, rootframe, appName)
10831083 control :SetCallback (" OnRelease" , CleanUserData )
10841084 control :SetCallback (" OnLeave" , OptionOnMouseLeave )
10851085 control :SetCallback (" OnEnter" , OptionOnMouseOver )
1086+
1087+ -- forward custom arg data directly
1088+ if control .SetCustomData and option .arg then
1089+ safecall (control .SetCustomData , control , option .arg )
1090+ end
10861091end
10871092
10881093local function CreateControl (userControlType , fallbackControlType )
@@ -1436,12 +1441,15 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
14361441 if control then
14371442 if control .width ~= " fill" then
14381443 local width = GetOptionsMemberValue (" width" ,v ,options ,path ,appName )
1444+ local relWidth = GetOptionsMemberValue (" relWidth" ,v ,options ,path ,appName )
14391445 if width == " double" then
14401446 control :SetWidth (width_multiplier * 2 )
14411447 elseif width == " half" then
14421448 control :SetWidth (width_multiplier / 2 )
14431449 elseif (type (width ) == " number" ) then
14441450 control :SetWidth (width_multiplier * width )
1451+ elseif width == " relative" and relWidth then
1452+ control :SetRelativeWidth (relWidth )
14451453 elseif width == " full" then
14461454 control .width = " fill"
14471455 else
@@ -1945,6 +1953,8 @@ else
19451953 AceConfigDialog .BlizOptions = AceConfigDialog .BlizOptions or {}
19461954end
19471955
1956+ AceConfigDialog .BlizOptionsIDMap = AceConfigDialog .BlizOptionsIDMap or {}
1957+
19481958local function FeedToBlizPanel (widget , event )
19491959 local path = widget :GetUserData (" path" )
19501960 AceConfigDialog :Open (widget :GetUserData (" appName" ), widget , unpack (path or emptyTbl ))
@@ -1966,16 +1976,17 @@ end
19661976-- has to be a head-level note.
19671977--
19681978-- This function returns a reference to the container frame registered with the Interface
1969- -- Options. You can use this reference to open the options with the API function
1970- -- `InterfaceOptionsFrame_OpenToCategory `.
1979+ -- Options, as well as the registered ID . You can use the ID to open the options with
1980+ -- the API function `Settings.OpenToCategory `.
19711981-- @param appName The application name as given to `:RegisterOptionsTable()`
19721982-- @param name A descriptive name to display in the options tree (defaults to appName)
19731983-- @param parent The parent to use in the interface options tree.
19741984-- @param ... The path in the options table to feed into the interface options panel.
19751985-- @return The reference to the frame registered into the Interface Options.
1976- -- @return The category ID to pass to Settings.OpenToCategory (or InterfaceOptionsFrame_OpenToCategory)
1986+ -- @return The category ID to pass to Settings.OpenToCategory
19771987function AceConfigDialog :AddToBlizOptions (appName , name , parent , ...)
19781988 local BlizOptions = AceConfigDialog .BlizOptions
1989+ local BlizOptionsIDMap = AceConfigDialog .BlizOptionsIDMap
19791990
19801991 local key = appName
19811992 for n = 1 , select (" #" , ... ) do
@@ -2001,29 +2012,32 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
20012012 end
20022013 group :SetCallback (" OnShow" , FeedToBlizPanel )
20032014 group :SetCallback (" OnHide" , ClearBlizPanel )
2004- if Settings and Settings .RegisterCanvasLayoutCategory then
2005- local categoryName = name or appName
2006- if parent then
2007- local category = Settings .GetCategory (parent )
2008- if not category then
2009- error ((" The parent category '%s' was not found" ):format (parent ), 2 )
2010- end
2011- local subcategory = Settings .RegisterCanvasLayoutSubcategory (category , group .frame , categoryName )
20122015
2013- -- force the generated ID to be used for subcategories, as these can have very simple names like "Profiles"
2014- group :SetName (subcategory .ID , parent )
2015- else
2016- local category = Settings .RegisterCanvasLayoutCategory (group .frame , categoryName )
2017- -- using appName here would be cleaner, but would not be 100% compatible
2018- -- but for top-level categories it should be fine, as these are typically addon names
2019- category .ID = categoryName
2020- group :SetName (categoryName , parent )
2021- Settings .RegisterAddOnCategory (category )
2016+ local categoryName = name or appName
2017+ if parent then
2018+ local parentID = BlizOptionsIDMap [parent ] or parent
2019+ local category = Settings .GetCategory (parentID )
2020+ if not category then
2021+ error ((" The parent category '%s' was not found" ):format (parent ), 2 )
20222022 end
2023+ local subcategory = Settings .RegisterCanvasLayoutSubcategory (category , group .frame , categoryName )
2024+ group :SetName (subcategory .ID , parentID )
20232025 else
2024- group :SetName (name or appName , parent )
2025- InterfaceOptions_AddCategory (group .frame )
2026+ if BlizOptionsIDMap [categoryName ] then
2027+ error ((" %s has already been added to the Blizzard Options Window with the given name: %s" ):format (appName , categoryName ), 2 )
2028+ end
2029+
2030+ local category = Settings .RegisterCanvasLayoutCategory (group .frame , categoryName )
2031+ if not (C_SettingsUtil and C_SettingsUtil .OpenSettingsPanel ) then
2032+ -- override the ID so the name can be used in Settings.OpenToCategory
2033+ -- unfortunately with incoming API changes in 12.0 (and likely classic at some point) this override is no longer possible
2034+ category .ID = categoryName
2035+ end
2036+ group :SetName (category .ID )
2037+ BlizOptionsIDMap [categoryName ] = category .ID
2038+ Settings .RegisterAddOnCategory (category )
20262039 end
2040+
20272041 return group .frame , group .frame .name
20282042 else
20292043 error ((" %s has already been added to the Blizzard Options Window with the given path" ):format (appName ), 2 )
0 commit comments