02-22-11, 03:28 AM | #1 | |
Config item templates
Currently looking for a list of config item templates.
FrameXML http://wowprogramming.com/utils/xmlbrowser https://github.com/tekkub/wow-ui-source/ UIPanelTemplates http://wowprogramming.com/utils/xmlb...lTemplates.xml https://github.com/tekkub/wow-ui-sou...lTemplates.xml OptionsPanelTemplates http://wowprogramming.com/utils/xmlb...lTemplates.xml https://github.com/tekkub/wow-ui-sou...lTemplates.xml Consists of templates for Code:
<Button name="OptionsButtonTemplate" inherits="UIPanelButtonTemplate" virtual="true"> <CheckButton name="OptionsBaseCheckButtonTemplate" virtual="true"> <CheckButton name="OptionsCheckButtonTemplate" virtual="true" inherits="OptionsBaseCheckButtonTemplate"> <CheckButton name="OptionsSmallCheckButtonTemplate" virtual="true" inherits="OptionsBaseCheckButtonTemplate"> <Slider name="OptionsSliderTemplate" orientation="HORIZONTAL" virtual="true" enableMouse="true"> <Frame name="OptionsBoxTemplate" virtual="true"> http://wowprogramming.com/utils/xmlb...eTemplates.xml https://github.com/tekkub/wow-ui-sou...eTemplates.xml Consists of templates for Code:
<Button name="OptionsFrameTabButtonTemplate" virtual="true"></Button> <Frame name="OptionsFrameListTemplate" virtual="true"></Frame> <Button name="OptionsListButtonTemplate" virtual="true"></Button> <Frame name="OptionsFrameTemplate" toplevel="true" parent="UIParent" hidden="true" enableMouse="true" frameStrata="HIGH" virtual="true"></Frame> http://wowprogramming.com/utils/xmlb...uTemplates.xml https://github.com/tekkub/wow-ui-sou...uTemplates.xml Config items - editbox http://wowprogramming.com/docs/widgets/EditBox - slider http://wowprogramming.com/docs/widgets/Slider - scrollframe http://wowprogramming.com/docs/widgets/ScrollFrame - checkbutton http://wowprogramming.com/docs/widgets/CheckButton - button http://wowprogramming.com/docs/widgets/Button - colorselect http://wowprogramming.com/docs/widgets/ColorSelect Examples OptionsSliderTemplate Code:
local fname = "TestSlider" local f = CreateFrame("Slider", fname, UIParent, "OptionsSliderTemplate") f:ClearAllPoints() f:SetPoint("CENTER", UIParent, "CENTER", 0, 0) f:SetMinMaxValues(0, 100) f:SetValue(50) _G[fname.."Low"]:SetText("0"); _G[fname.."High"]:SetText("100"); _G[fname.."Text"]:SetText(fname); f:Show() Code:
f.scroll = CreateFrame("ScrollFrame", "myScrollFrame", f, "UIPanelScrollFrameTemplate") Code:
--parent frame local frame = CreateFrame("Frame", "MyFrame", UIParent) frame:SetSize(150, 200) frame:SetPoint("CENTER") local texture = frame:CreateTexture() texture:SetAllPoints() texture:SetTexture(1,1,1,1) frame.background = texture --scrollframe scrollframe = CreateFrame("ScrollFrame", nil, frame) scrollframe:SetPoint("TOPLEFT", 10, -10) scrollframe:SetPoint("BOTTOMRIGHT", -10, 10) local texture = scrollframe:CreateTexture() texture:SetAllPoints() texture:SetTexture(.5,.5,.5,1) frame.scrollframe = scrollframe --scrollbar scrollbar = CreateFrame("Slider", nil, scrollframe, "UIPanelScrollBarTemplate") scrollbar:SetPoint("TOPLEFT", frame, "TOPRIGHT", 4, -16) scrollbar:SetPoint("BOTTOMLEFT", frame, "BOTTOMRIGHT", 4, 16) scrollbar:SetMinMaxValues(1, 200) scrollbar:SetValueStep(1) scrollbar.scrollStep = 1 scrollbar:SetValue(0) scrollbar:SetWidth(16) scrollbar:SetScript("OnValueChanged", function (self, value) self:GetParent():SetVerticalScroll(value) end) local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") scrollbg:SetAllPoints(scrollbar) scrollbg:SetTexture(0, 0, 0, 0.4) frame.scrollbar = scrollbar --content frame local content = CreateFrame("Frame", nil, scrollframe) content:SetSize(128, 128) local texture = content:CreateTexture() texture:SetAllPoints() texture:SetTexture("Interface\\GLUES\\MainMenu\\Glues-BlizzardLogo") content.texture = texture scrollframe.content = content scrollframe:SetScrollChild(content) Does anyone have other examples/links/infos to corresponding panel/config item templates? Basically anything that helps setting up a gui config panel. UI editor: http://www.feverguild.com/uieditor/ Implementation Where does Blizzard use parts of that config templates? For example in the interface options. https://github.com/tekkub/wow-ui-sou...ionsPanels.xml Example XML implementation of the slider template Code:
<Slider name="$parentSpellAlertOpacitySlider" inherits="OptionsSliderTemplate"> <Anchors> <Anchor point="TOPLEFT" relativeTo="$parentShowSpellAlerts" relativePoint="BOTTOMLEFT"> <Offset> <AbsDimension x="24" y="-8"/> </Offset> </Anchor> </Anchors> <Scripts> <OnLoad> self.type = CONTROLTYPE_SLIDER; self.cvar = "spellActivationOverlayOpacity"; self.SetDisplayValue = self.SetValue; self.SetValue = function (self, value) self:SetDisplayValue(value); SpellActivationOverlayFrame:SetAlpha(value); end BlizzardOptionsPanel_RegisterControl(self, self:GetParent()); self:RegisterEvent("VARIABLES_LOADED"); BlizzardOptionsPanel_SetupDependentControl(_G[self:GetParent():GetName().."ShowSpellAlerts"], self); </OnLoad> <OnValueChanged> self.value = value; self:SetValue(value); SetCVar(self.cvar, value); </OnValueChanged> <OnEvent> local val = tonumber(GetCVar(self.cvar)); self:SetValue(val); </OnEvent> </Scripts> </Slider> Bringing both together (slider example and functionality from Blizzard example we get) lua Code:
__________________
| Simple is beautiful. | WoWI AddOns | GitHub | Zork (WoW)
Last edited by zork : 02-22-11 at 06:27 AM. |
||
WoWInterface » Developer Discussions » Lua/XML Help » Config item templates |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|