View Single Post
08-09-18, 05:46 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Mixins are just tables that gets its methods copied to the frame, so on the WorldMapTrackingOptionsButtonTemplate every method of WorldMapTrackingOptionsButtonMixin gets copied. See the Lua implementation of Mixin in Pools.lua on how mixins are basically just copied over.

To hook into whatever uses WorldMapTrackingOptionsButtonTemplate you'll need to see where it's used, not how it's defined. That would be on line 205 in Blizzard_WorldMap.lua.

It's added as an overlay frame, which is its own system (WorldMapFrame:AddOverlayFrame). A frame is created using the template, then added to WorldMapFrame.overlayFrames.

To get the frame you'll need to iterate over that table and use some unique identifying part of the template to find it, like one of its methods or textures (like in the example below).

Lua Code:
  1. for _, overlayFrame in next, WorldMapFrame.overlayFrames do
  2.     if(overlayFrame.Border and overlayFrame.Border:GetTexture() == 'Interface\\Minimap\\MiniMap-TrackingBorder') then
  3.         hooksecurefunc(overlayFrame, 'InitializeDropDown', myFunction)
  4.         break
  5.     end
  6. end
  Reply With Quote