I've been thinking of digging deeper into WoWs api for a while and I found some free time to write some things down today. The first thing I thought would be useful but haven't been able to find is a frame pool for managing and recycling unused frames. It shouldn't be too tough so I figured I would give it a shot and build it into an embedded library for others to use and build on. It's just some ideas right now, nothing tested, and so far I only have two methods planned, lib:Grab(frametype) and lib:Release(frame)
I plan on keeping separate tables for each type of frame and recursively releasing children for starters. When grabbing frames, a new frame will be created if the corresponding pool is empty. I think I have viable pseudocode for the whole thing except where I need to disassociate a frame from it's previous role
So I thought this would be a good place to ask a few questions while I'm still stuck at work and can't test anything.
Does UnregisterAllEvents() release a frame from any script handlers that might try to call it later if the frame is recycled or does it just prevent the events from notifying the handlers? Would I have to call SetScript("OnBlah",nil) a whole bunch of times?
Does ClearAllPoints() release the frame from what it is anchored to, children that are anchored to it, both or neither?
Is there some inaccessible property I am not aware of that might prevent this whole idea from working at all?
I just imported IFrameFactory to SVN, a very simple factory for frames. It works on specific frame objects and not on generic frames. You give it a :Create() function that will be called wheneever a new frame of your type is needed and 'destroyed' (unused) frames are kept in a list. I'm using it for coolDown and HealSync, both of which display a dynamic number of frames (sometimes ten, sometimes none, depending on how many spells you have on cooldown or how many heals are incomming).
It's an embedded library and also has a README: http://svn.wowace.com/root/trunk/IFrameFactory/