|
function self:CreateCompanionButton(num) |
local button = CreateFrame("CheckButton", "$parentButton" .. num, self, "SecureFrameTemplate") |
button:EnableMouseWheel(true) |
button:SetWidth(150) |
button:SetHeight(32) |
|
|
button.icon = button:CreateTexture("$parentIcon", "ARTWORK") |
button.icon:SetWidth(32) |
button.icon:SetHeight(32) |
button.icon:SetTexture("Interface\\Icons\\Ability_BackStab") |
button.icon:SetPoint("TOPLEFT") |
|
local checkedTexture = button:CreateTexture(nil, "HIGHLIGHT") |
checkedTexture:SetTexture("Interface\\Buttons\\ButtonHilight-Square") |
--checkedTexture:SetTexture("Interface\\Buttons\\UI-Button-Outline") |
checkedTexture:SetAllPoints(button.icon) |
checkedTexture:SetBlendMode("ADD") |
|
button:SetCheckedTexture(checkedTexture, "ADD") |
|
button.name = button:CreateFontString("$parentName", "ARTWORK", "GameFontNormal") |
button.name:SetTextColor(1,1,1) |
button.name:SetJustifyH("LEFT") |
button.name:SetPoint("TOPLEFT", button.icon, "TOPRIGHT", 5, -2) |
button.name:SetPoint("BOTTOMRIGHT") |
|
button:SetScript("OnClick", function() |
self.model:SetCreature(button:GetID()) |
button:SetScript("OnClick", self.OnButtonClick) |
--function() |
--self.model:SetCreature(button:GetID()) |
-- self:OnButtonClick(button, arg1) |
--end) |
|
button:SetScript("OnMouseWheel", function(_,direction) |
--Scrolls +2/-2, doesnt exceed max value |
self.scrollBar:SetValue(min(self.scrollBar:GetValue() + (direction * -2), select(2, self.scrollBar:GetMinMaxValues()))) |
end) |
|
return button |