12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

502 Part III ■ Advanced Addon Techniquesprimary responsibility is managing the creation <strong>and</strong> placement <strong>of</strong> frames. Asplayers join your party or raid, the secure template h<strong>and</strong>les the creation <strong>of</strong>new frames <strong>for</strong> each <strong>of</strong> them. If an addon were to try this while the player isin combat, the new frames would be locked down, unable to be modified. Thegroup headers enable your addon to do last-minute configuration be<strong>for</strong>e theframe is ever locked down.The process <strong>for</strong> creating a new group header is roughly as follows:1. Create a new header frame that inherits from SecureGroupHeaderTemplate. This may be a custom XML template that inherits from theBlizzard template <strong>and</strong> adds things such as artwork <strong>and</strong> labels, or just theraw template itself.2. Set attributes on the new header <strong>for</strong> some <strong>of</strong> the following:What characters, classes, groups should be displayed in the header?Should the header be displayed when the player is in a party, raid,solo, or all <strong>of</strong> the above?When new frames are created, how should they be anchored to theexisting frames?How should the frames be sorted?Should the frames be grouped, or displayed in columns <strong>and</strong> rows?3. Supply an XML template (optionally) that the header will use to createnew unit frames. Again, this could just be the st<strong>and</strong>ard SecureUnitButtonor a custom template with artwork <strong>and</strong> other elements.4. Provide a configuration function (optionally) that will be called whena new unit frame is created, allowing <strong>for</strong> last-minute customization byaddons.Of course, creating a fully functional raid addon is a bit more complicatedthan this, but once you’ve mastered the basics <strong>of</strong> using the template, otherfeatures can be added to your addon as necessary.Configuration OptionsA SecureGroupHeader has plenty <strong>of</strong> options that can be set using attributes.These options can be grouped into three major classes: filtering, grouping <strong>and</strong>sorting, <strong>and</strong> display. Tables 26-1, 26-2, <strong>and</strong> 26-3 describe these attributes.When specifying a groupBy attribute, you must also supply a groupingOrderor the template will encounter an error, because groupingOrder doesn’t haveany default values.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!