Mercurial > wow > reaction
comparison classes/BagButton.lua @ 221:bb13624de7e1
un-namespace Bag bar config
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Sun, 21 Nov 2010 12:51:24 -0800 |
| parents | e63aefb8a555 |
| children | c4b134512c50 |
comparison
equal
deleted
inserted
replaced
| 220:a4e7475633b3 | 221:bb13624de7e1 |
|---|---|
| 23 type = buttonTypeID, | 23 type = buttonTypeID, |
| 24 btnWidth = 30, | 24 btnWidth = 30, |
| 25 btnHeight = 30, | 25 btnHeight = 30, |
| 26 btnRows = 1, | 26 btnRows = 1, |
| 27 btnColumns = 6, | 27 btnColumns = 6, |
| 28 spacing = 4 | 28 spacing = 4, |
| 29 buttons = { } | |
| 29 }, | 30 }, |
| 30 | 31 |
| 31 barType = L["Bag Bar"], | 32 barType = L["Bag Bar"], |
| 32 }, | 33 }, |
| 33 { __index = Super } ) | 34 { __index = Super } ) |
| 40 | 41 |
| 41 -- | 42 -- |
| 42 -- Bag Button base class | 43 -- Bag Button base class |
| 43 -- | 44 -- |
| 44 | 45 |
| 45 function BagBase:New( idx, moduleConfig, bar, idHint ) | 46 function BagBase:New( idx, btnCfg, bar, idHint ) |
| 46 local name = format("ReAction_%s_Bag_%d",bar:GetName(),idx) | 47 local name = format("ReAction_%s_Bag_%d",bar:GetName(),idx) |
| 47 | 48 |
| 48 -- use a variable private leaf implementation class | 49 -- use a variable private leaf implementation class |
| 49 -- unlike traditional OO programming, we can initialize the leaf | 50 -- unlike traditional OO programming, we can initialize the leaf |
| 50 -- class before initializing its derived class | 51 -- class before initializing its parent |
| 51 local class = Bag | 52 local class = Bag |
| 52 if idx == 1 then | 53 if idx == 1 then |
| 53 class = Backpack | 54 class = Backpack |
| 54 elseif idx == 6 then | 55 elseif idx == 6 then |
| 55 class = Keyring | 56 class = Keyring |
| 56 end | 57 end |
| 57 self = class:New(name,moduleConfig.buttons[bar:GetName()][idx], bar, idx) | 58 self = class:New(name, btnCfg, bar, idx) |
| 58 self.moduleConfig = moduleConfig | |
| 59 | 59 |
| 60 local f = self:GetFrame() | 60 local f = self:GetFrame() |
| 61 local config = self:GetConfig() | 61 local config = self:GetConfig() |
| 62 | 62 |
| 63 -- set up the bag ID pool | 63 -- set up the bag ID pool |
| 122 end | 122 end |
| 123 | 123 |
| 124 self:Refresh() | 124 self:Refresh() |
| 125 | 125 |
| 126 return self | 126 return self |
| 127 end | |
| 128 | |
| 129 function BagBase:GetModuleConfig() | |
| 130 -- this is the Bag module config structure, | |
| 131 -- not the config structure of the bar itself | |
| 132 return self.moduleConfig | |
| 133 end | 127 end |
| 134 | 128 |
| 135 function BagBase:GetActionID() | 129 function BagBase:GetActionID() |
| 136 return self.config.bagID | 130 return self.config.bagID |
| 137 end | 131 end |
