[/] [branches/] [3.02/] [UI/] [FontComboBox.lua] - Rev 89
Go to most recent revision |
Compare with Previous |
Blame |
View Log
import "Turbine.UI";
FontComboBox = class(KragenPlugs.UI.ComboBox);
function FontComboBox:Constructor()
KragenPlugs.UI.ComboBox.Constructor(self);
end
function FontComboBox:AddItem(text, value, size)
local width, height = self.listBox:GetSize();
local listItem = Turbine.UI.Label();
listItem:SetSize(width, size);
listItem:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);
listItem:SetForeColor(ComboBox.ItemColor);
listItem:SetFont(value);
listItem:SetOutlineColor(ComboBox.HighlightColor);
listItem:SetText(text);
listItem.MouseEnter = function(sender, args)
sender:SetFontStyle(Turbine.UI.FontStyle.Outline);
sender:SetForeColor(ComboBox.ItemColor);
sender:SetText(sender:GetText());
end
listItem.MouseLeave = function(sender, args)
sender:SetFontStyle(Turbine.UI.FontStyle.None);
if (self.listBox:IndexOfItem(sender) == self.selection) then
sender:SetForeColor(ComboBox.SelectionColor);
end
sender:SetText(sender:GetText());
end
listItem.MouseClick = function(sender, args)
if (args.Button == Turbine.UI.MouseButton.Left) then
self:ItemSelected(self.listBox:GetSelectedIndex());
self:FireEvent();
end
end
listItem.value = value;
self.listBox:AddItem(listItem);
end
Go to most recent revision |
Compare with Previous |
Blame
All times are GMT -5. The time now is 05:23 AM.