Mercurial > wow > reaction
comparison classes/Button.lua @ 126:6a4b4d3c5fad
More fixes for button base class
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Tue, 03 Mar 2009 23:18:35 +0000 |
| parents | 0c5017f6062d |
| children | 729232aeeb5e |
comparison
equal
deleted
inserted
replaced
| 125:a7f18adee694 | 126:6a4b4d3c5fad |
|---|---|
| 74 | 74 |
| 75 return self | 75 return self |
| 76 end | 76 end |
| 77 | 77 |
| 78 function Button:Destroy() | 78 function Button:Destroy() |
| 79 local f = self.frame | 79 local f = self:GetFrame() |
| 80 gridProxy:RemoveGridFrame(f) | 80 if f then |
| 81 f:Hide() | 81 f:Hide() |
| 82 f:SetParent(trash) | 82 f:SetParent(trash) |
| 83 f:ClearAllPoints() | 83 f:ClearAllPoints() |
| 84 end | |
| 84 end | 85 end |
| 85 | 86 |
| 86 function Button:GetFrame() | 87 function Button:GetFrame() |
| 87 return self.frame | 88 return self.frame |
| 88 end | 89 end |
| 120 idPools[poolID] = pool | 121 idPools[poolID] = pool |
| 121 end | 122 end |
| 122 local useCount = pool.useCount | 123 local useCount = pool.useCount |
| 123 if id == nil then | 124 if id == nil then |
| 124 repeat | 125 repeat |
| 125 local nWraps = pool.nWraps | 126 local nWraps = pool.nWraps or 0 |
| 126 if useCount[hint] == nil or useCount[hint] == nWraps then | 127 if hint and (useCount[hint] == nil or useCount[hint] == nWraps) then |
| 127 id = hint | 128 id = hint |
| 128 else | 129 else |
| 129 local start = hint or 1 | 130 local start = hint or 1 |
| 130 for i = start, maxID do | 131 for i = start, maxID do |
| 131 if useCount[i] == nil or useCount[i] == nWraps then | 132 if useCount[i] == nil or useCount[i] == nWraps then |
| 146 if unique then | 147 if unique then |
| 147 return nil | 148 return nil |
| 148 end | 149 end |
| 149 pool.nWraps = nWraps + 1 | 150 pool.nWraps = nWraps + 1 |
| 150 end | 151 end |
| 151 until id | 152 until id ~= nil |
| 152 end | 153 end |
| 153 useCount[id] = (useCount[id] or 0) + 1 | 154 useCount[id] = (useCount[id] or 0) + 1 |
| 154 return id | 155 return id |
| 155 end | 156 end |
| 156 | 157 |
