That's AceConfigDialog-3.0, which AceDBOptions-3.0 can generate a profile select page for.
Code:
local defaults={profile={
-- your defaults
}}
YourAddonObject.options = { -- this is an AceConfig-3.0 option table
type="group",
args={
},
}
function YourAddonObject:OnProfileEnable()
-- here you do stuff that you want to re-do when a new profile is loaded, f.e. positioning frames etc.
end
YourAddonObject:SetScript("OnEvent",function(self,event,arg1)
if event == "ADDON_LOADED" and arg1 == "AddonFolderName" then
self.db = LibStub("AceDB-3.0"):new("MySavedVar",defaults or {})
self.db.RegisterCallback(self,"OnProfileChanged","OnProfileEnable")
self.db.RegisterCallback(self,"OnProfileCopied","OnProfileEnable")
self.db.RegisterCallback(self,"OnProfileReset","OnProfileEnable")
self.opt = self.db.profile -- you'll use self.opt to access your current profile config
self.options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) -- this is where the options page is generated
self.options.args.profiles.order = -1 -- set it to be the last page
LibStub("AceConfig-3.0"):RegisterOptionsTable("YourAddonName", self.options)
SlashCmdList["YOURADDON"]=function(input)
LibStub("AceConfigDialog-3.0"):Open("YourAddonName")
end
SLASH_YOURADDON1 = "/yourslashcommand"
end
end)