CreateFramePool()
(Redirected from FramePoolMixin)
Jump to navigation
Jump to search
- This function is implemented in
FrameXML/Pools.lua
.
- This function is implemented in
Creates a FramePoolMixin (inherits from ObjectPoolMixin), a pool of reusable frames.
pool = CreateFramePool(frameType [, parent, frameTemplate, resetterFunc, forbidden, frameInitFunc])
Arguments
- frameType
- string - Type of the frame to be created (XML tag name) such as "Frame" or "Button".
- parent
- string? - A common parent for all furnished frames to share, or nil if they will not have a parent.
- frameTemplate
- string? - Comma-delimited list of XML virtual templates to inherit from.
- resetterFunc
- function? - Custom function to prepare a frame for reuse; the default function simply hides the frame and clears all points. Arg1 is the Pool object itself, Arg2 is the frame being reset.
- forbidden
- boolean? - If true, frames will be made using CreateForbiddenFrame instead of CreateFrame.
- frameInitFunc
- function? - Custom function to run once after a frame is initially created by the pool. The frame created is passed as the functions only argument.
Methods
FramePoolMixin
- FramePoolMixin:GetTemplate() - Returns the template(s) assigned to all frames in this pool.
ObjectPoolMixin
An ObjectPoolMixin is a pool of reusable widgets that may be acquired and released for reuse.
- ObjectPoolMixin:Acquire() - Furnishes a new or reused widget
- ObjectPoolMixin:Release(widget) - Restores a widget to original condition for reuse
- ObjectPoolMixin:ReleaseAll() - Restores all widgets sourced from the pool to original condition for reuse
- ObjectPoolMixin:EnumerateActive() - Returns an iterator to cycle through widgets sourced from the pool
- ObjectPoolMixin:EnumerateInactive() - Returns an iterator to cycle through widgets released back to the pool
- ObjectPoolMixin:GetNextActive(current) - Moves to the next active widget within the pool, or returns nil
- ObjectPoolMixin:GetNextInactive(current) - Moves to the next inactive widget within the pool, or returns nil
- ObjectPoolMixin:IsActive(widget) - Indicates if the widget is presently acquired from the pool
- ObjectPoolMixin:GetNumActive() - Returns the number of widgets presently acquired from the pool
- ObjectPoolMixin:SetResetDisallowedIfNew() - Prevents Acquire() from calling resetterFunc() on newly-created widgets.
Example
local pool = CreateFramePool("Frame", nil, "BackdropTemplate")
local frame = pool:Acquire()
See also
- CreateFramePoolCollection() - Alternative to manage a collection of frame pools.
Patch changes
- Patch 7.2.0 (2017-03-28): Added.[1]
References
- ^ 2017-03-28, Pools.lua, version 7.2.0.23835, near line 134, archived at Townlong-Yak