Download
(935 b)
Download
Updated: 04-11-06 01:47 PM
Updated:04-11-06 01:47 PM
Created:unknown
Downloads:2,663
Favorites:1
MD5:

IFrameFactory

Version: 0.0.1.0
by: Shag [More]

A library that helps to create and re-use dynamically created frames.

There it currently only one addon that uses it and it's probably a good idea to look there how I'm using this library: http://www.wowinterface.com/downloads/fileinfo.php?id=4575

Each addon that wants to use this library first has to register a frame using an uniquwe addon name, a frame name and an interface (table) with functions that are used to create or destroy the frames.

Code:
local myAddOnFrameInterface = { }
function myAddOnFrameInterface:frameCreate(frameName)
  return CreateFrame("Frame", frameName, UIParent)
end
function myAddOnFrameInterface:frameCreate(frameObject)
  return frameObject
end

IFrameFactory:frameRegister("myAddOn", "Frame", myAddOnFrameInterface)
then the addon can use IFrameFactory:frameCreate() and IFrameFactory:frameDestroy() to manage the frames. The name 'frameDestroy()' maybe is a bit misleading because frames can't be destroyed right now, but this functiosn should return the frame in a state like frameCreate() returns the frame, that means, any private data should be deleted, undesired handlers/scripts removed etc.

The frame returned by IFrameFactory:frameCreate() is visible and bound to the center of UIParent, IFrameFactory:frameDestroy() hides the frame and binds it to the center of UIParent. That's the only things the interface callbacks don't have to worry about.


Code:
local frameObject = IFrameFactory:frameCreate("myAddOn", "Frame")
-- [[ use frame ]]
IFrameFactory:frameCreate("myAddOn", "Frame", frameObject)

Optional Files (0)


There have been no comments posted to this file.
Be the first to add one.



Category Jump: