lotrointerface.com
Search Downloads

LoTROInterface SVN KragenBars

[/] [trunk/] [KragenPlugs/] [KragenBars/] [SetupGlobals.lua] - Rev 96

Compare with Previous | Blame | View Log

import "Turbine.UI";

SetupGlobals = 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 SetupGlobals:Constructor()
    Turbine.UI.ListBox.Constructor(self);

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

        self:AddTitleBar("Global Options");

        self:AddComboBox(self.globaloptions);
        self.globaloptions[1].label:SetText("Language");
        self.globaloptions[1].label:SetVisible(true);
        self.combolangbox = self.globaloptions[1].combobox;
        self.combolangbox:SetVisible(true);
        self.combolangbox.listBox:ClearItems();
        local combolist = {"English", "French", "German"};
        for k,v in pairs(combolist) do
                self.combolangbox:AddItem(v, k);
        end
        
        self:AddCheckboxRow(self.globaloptions);
        self.checkboxlock = self.globaloptions[2];
        self.checkboxlock:SetText("Lock Slots");
    self.checkboxlock:SetVisible(true);
        self.checkboxgrid = self.globaloptions[3];
    self.checkboxgrid:SetText("Windows Snap to Grid");
    self.checkboxgrid:SetVisible(true);
        
        self:AddCheckboxRow(self.globaloptions);
        self.globaloptions[4]:SetVisible(false);
        -- self.checkboxgrid = self.globaloptions[4];
    -- self.checkboxgrid:SetText("None");
    -- self.checkboxgrid:SetVisible(true);
        self.checkboxmulticlick = self.globaloptions[5];
        self.checkboxmulticlick:SetText("RClk to Adv MultiSlot");
    self.checkboxmulticlick:SetVisible(true);
        
        self:AddSlider(self.globaloptions, 9, 36, 9, "Grid Size (pixels)");
        self.gridsizeslider = self.globaloptions[6];

        self:AddSlider(self.globaloptions, 0, 100, 1, "Button Bar Opacity (%)");
        self.opacityslider = self.globaloptions[7];
        
end


function SetupGlobals: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 SetupGlobals: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 SetupGlobals: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 SetupGlobals: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 SetupGlobals:Destroy()
    -- cleanup the quickslots so the client doesn't crash

end

Compare with Previous | Blame


All times are GMT -5. The time now is 02:27 PM.


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