comparison BagButton.lua @ 277:4e325f1ea6e1

Construct the button name in the base class
author Flick
date Wed, 11 May 2011 11:27:36 -0700
parents 36a29870bf34
children d1a56601267b
comparison
equal deleted inserted replaced
276:36a29870bf34 277:4e325f1ea6e1
47 -- 47 --
48 -- Bag Button base class 48 -- Bag Button base class
49 -- 49 --
50 50
51 function BagBase:New( btnCfg, bar, idx, idHint ) 51 function BagBase:New( btnCfg, bar, idx, idHint )
52 local name = format("ReAction_%s_Bag_%d",bar:GetName(),idx)
53
54 -- use a variable private leaf implementation class 52 -- use a variable private leaf implementation class
55 -- unlike traditional OO programming, we can initialize the leaf 53 -- unlike traditional OO programming, we can initialize the leaf
56 -- class before initializing its parent 54 -- class before initializing its parent
57 local class = Bag 55 local class = Bag
58 if idx == 1 then 56 if idx == 1 then
59 class = Backpack 57 class = Backpack
60 elseif idx == 6 then 58 elseif idx == 6 then
61 class = Keyring 59 class = Keyring
62 end 60 end
63 self = class:New(name, btnCfg, bar, idx) 61 self = class:New(btnCfg, bar, idx)
64 62
65 local f = self:GetFrame() 63 local f = self:GetFrame()
66 local config = self:GetConfig() 64 local config = self:GetConfig()
67 65
68 -- set up the bag ID pool 66 -- set up the bag ID pool