lotrointerface.com
Search Downloads

LoTROInterface SVN KragenBars

[/] [branches/] [3.11/] [UI/] [FontComboBox.lua] - Rev 26

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

Compare with Previous | Blame


All times are GMT -5. The time now is 07:59 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui