lotrointerface.com
Search Downloads

LoTROInterface SVN KragenBars

[/] [trunk/] [KragenPlugs/] [KragenBars/] [SetupButtonBars.lua] - Rev 119

Compare with Previous | Blame | View Log

import "Turbine.UI";

SetupButtonBars = class(Turbine.UI.ListBox);

-- helper functions
local tt = function(width, height, control, text)
    local tooltip = KragenPlugs.UI.Tooltip();
    tooltip:SetText(text);
    tooltip:SetControl(control);
    tooltip:SetSize(width, height);
end

local holder = function(parent, height)
    local container = Turbine.UI.Control();
    container:SetSize(400, height);
    parent:AddItem(container);
    return container;
end


function SetupButtonBars:Constructor()
    Turbine.UI.ListBox.Constructor(self);

    self.current = nil;
        self.titlebars = { };
        self.buttonbars = { };
        self.bars = { };
        
    self:SetOrientation(Turbine.UI.Orientation.Horizontal);
    self:SetMaxItemsPerLine(1);

        self:AddTitleBar("Button Bars");
        
        local index = #self.bars + 1;
    local line = holder(self, 30);
        self.bars[index] = { };
    self.bars[index].combobox = KragenPlugs.UI.ComboBox();
    self.bars[index].combobox:SetParent(line);
    self.bars[index].combobox:SetSize(190, 20);
    self.bars[index].combobox:SetPosition(0, 0);
    self.bars[index].combobox:SetVisible(false);
        self.barslist = self.bars[index].combobox;
        self.barslist:SetVisible(true);
        
        self.bars[index].namebox = Turbine.UI.Lotro.TextBox();
    self.bars[index].namebox:SetParent(line);
    self.bars[index].namebox:SetSize(180, 20);
    self.bars[index].namebox:SetPosition(210, 0);
    self.bars[index].namebox:SetFont(Turbine.UI.Lotro.Font.Verdana14);
    self.bars[index].namebox:SetMultiline(false);
        self.barsnamebox = self.bars[index].namebox;
        self.barsnamebox:SetVisible(true);
        
        index = #self.bars + 1;
        line = holder(self,30);
        self.bars[index] = { };
        self.bars[index].buttonnew  = Turbine.UI.Lotro.Button();
    self.bars[index].buttonnew:SetParent(line);
        self.bars[index].buttonnew:SetPosition(60, 0);
    self.bars[index].buttonnew:SetSize(100, 22);
    self.bars[index].buttonnew:SetText("New");
        self.barsbuttonnew = self.bars[index].buttonnew;
        self.barsbuttonnew:SetVisible(true);

    self.bars[index].buttonremove  = Turbine.UI.Lotro.Button();
    self.bars[index].buttonremove:SetParent(line);
    self.bars[index].buttonremove:SetPosition(240, 0);
    self.bars[index].buttonremove:SetSize(100, 22);
    self.bars[index].buttonremove:SetText("Remove");
        self.barsbuttonremove = self.bars[index].buttonremove;
        self.barsbuttonremove:SetVisible(true);
        
        line = holder(self,10);
        
        index = #self.bars + 1;
        line = holder(self,30);
        self.bars[index] = KragenPlugs.UI.CheckBox();
        self.bars[index]:SetParent(line);
        self.bars[index]:SetSize(180, 20);
        self.bars[index]:SetPosition(0,0);
        self.bars[index]:SetText("Active");
        self.bars[index]:SetVisible(true);
        self.barsactive = self.bars[3];
                
        index = #self.bars + 1;
        self.bars[index] = KragenPlugs.UI.ComboBox();
    self.bars[index]:SetParent(line);
    self.bars[index]:SetSize(190, 20);
    self.bars[index]:SetPosition(210, 0);
    self.bars[index]:SetVisible(true);
        self.barscombat = self.bars[4];
        self.barscombat:AddItem("Always", 1);
        self.barscombat:AddItem("Only In Combat", 2);
        self.barscombat:AddItem("Only Out of Combat", 3);

        self:AddSlider(self.bars, 1, 12, 1, "Bar Width (slots)");
        self.barswidth = self.bars[5];
        self:AddSlider(self.bars, 1, 12, 1, "Bar Height (slots)");
        self.barsheight = self.bars[6];
        
        self:AddSlider(self.bars, 9, 72, 9, "Slot Size (pixels)");
        self.barsslotsize = self.bars[#self.bars];
        self.barsslotsize:SetVisible(false);
        
        self:AddComboBox(self.bars);
        self.barsthresholdcombo = self.bars[#self.bars];
        self.barsthresholdcombo.label:SetText("Show Bar When:");
        self.barsthresholdcombo.label:SetVisible(false);
        self.barsthresholdcombo.combobox:SetVisible(false);
        local combolist = {"Any morale or power", "Morale above threshold", "Morale below threshold", "Power above threshold", "Power below threshold"};
        for k,v in pairs(combolist) do
                self.barsthresholdcombo.combobox:AddItem(v, k);
        end
        
        self:AddSlider(self.bars, 0, 100, 1, "Threshold (%)");
        self.barsthresholdslider = self.bars[#self.bars];
        self.barsthresholdslider:SetVisible(false);
        
    
        
end


function SetupButtonBars:AddTitleBar(text)
    local index = #self.titlebars + 1;
        
        local line = holder(self, 35);
    self.titlebars[index] = KragenPlugs.UI.PanelDivider();
    self.titlebars[index]:SetPosition(0,0);
    self.titlebars[index]:SetParent(line);
    self.titlebars[index]:SetText(text);
    self.titlebars[index]:SetSize(400, 30);

end

function SetupButtonBars:AddCheckboxRow(option)
    local index = #option + 1;
        local line = holder(self, 20);
        
        for i = 1,2 do 
                option[index] = KragenPlugs.UI.CheckBox();
                option[index]:SetParent(line);
                option[index]:SetSize(180, 20);
                if math.mod(index, 2) == 0 then
                        option[index]:SetPosition(220,0);
                        option[index]:AlignLeft(true);
                else
                        option[index]:SetPosition(0,0);
                end
                option[index]:SetText("Checkbox");
                option[index]:SetVisible(false);
                index = #option + 1;
        end

end

function SetupButtonBars:AddSlider(option, mini, maxi, step, text)
        local index = #option + 1;
        
        local line = holder(self, 50);
    option[index] = KragenPlugs.UI.Slider();
    option[index]:SetParent(line);
    option[index]:SetText(text);
    option[index]:SetPosition(49, 0);
    option[index]:SetSize(350, 40);
    option[index]:SetStep(step);
    option[index]:SetMin(mini);
    option[index]:SetMax(maxi);

end

function SetupButtonBars:AddComboBox(option)
        local index = #option + 1;
        
    local line = holder(self, 30);
        option[index] = { };
        option[index].label = KragenPlugs.UI.Label();
    option[index].label:SetParent(line);
    option[index].label:SetSize(190, 20);
    option[index].label:SetPosition(20, 0);
    option[index].label:SetText("Label");
    option[index].label:SetVisible(false);
    
    option[index].combobox = KragenPlugs.UI.ComboBox();
    option[index].combobox:SetParent(line);
    option[index].combobox:SetSize(190, 20);
    option[index].combobox:SetPosition(210, 0);
    option[index].combobox:SetVisible(false);

end

function SetupButtonBars:Destroy()
    -- cleanup the quickslots so the client doesn't crash

end

Compare with Previous | Blame


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


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