/trunk/Portfolio/Control
-- already anchored to the left |
middleTex:SetPoint("RIGHT", rightTex, "LEFT", 0, 0) |
control.minWidth = option.minWidth or 100 |
if option.width then |
control.width = option.width |
local leftTex = _G[controlName.."Left"] |
local button = _G[controlName.."Button"] |
local buttonWidth = leftTex:GetWidth() + 2 -- button offset |
control:SetWidth(control.width) |
button:SetHitRectInsets(-control.width + buttonWidth, 0, 0, 0) |
-- TODO: Truncate text if text is smaller than middle width |
elseif option.minWidth then |
control.minWidth = option.minWidth |
else |
control.minWidth = 100 |
end |
-- Setup Frame Text |
control:UpdateText() |
local textWidth = fontString:GetStringWidth() + 43 - 14 -- text offset - texture inset |
local width = leftWidth + textWidth + rightWidth |
if self.minWidth and self.minWidth > width then |
if self.width then |
-- Static Width, do nothing |
-- TODO: Truncate text if text is smaller than middle width |
if textWidth > buttonWidth then |
--fontString:SetWidth(buttonWidth) |
fontString:SetPoint("LEFT", leftTex, "RIGHT", 0, 0) |
end |
elseif self.minWidth and self.minWidth > width then |
self:SetWidth(self.minWidth) |
--middleTex:SetWidth(self.width - leftWidth - rightWidth) |
button:SetHitRectInsets(-self.minWidth + buttonWidth, 0, 0, 0) |