lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [trunk/] [JackdawPlugins/] [SortPack/] [JContextMenu.lua] - Blame information for rev 119

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 114 MrJackdaw-1942
--New contextmenu class
2 MrJackdaw-1942
 
3 MrJackdaw-1942
JContextMenu=class(Turbine.UI.Window())
4 MrJackdaw-1942
 
5 MrJackdaw-1942
function JContextMenu:Constructor()
6 MrJackdaw-1942
        Turbine.UI.Window(self)
7 MrJackdaw-1942
 
8 MrJackdaw-1942
        self:SetBackColor ( Turbine.UI.Color(1,0,0,0 ))
9 MrJackdaw-1942
 
10 MrJackdaw-1942
        self.Control=Turbine.UI.Control()
11 MrJackdaw-1942
                self.Control:SetParent(self)
12 MrJackdaw-1942
                self.Control:SetZOrder(990)
13 MrJackdaw-1942
                self.Control:SetSize(200,200)
14 MrJackdaw-1942
 
15 MrJackdaw-1942
 
16 MrJackdaw-1942
        self.ListBox=Turbine.UI.ListBox()
17 MrJackdaw-1942
                self.ListBox:SetParent(self.Control)
18 MrJackdaw-1942
                self.ListBox:SetWidth(200)
19 MrJackdaw-1942
                self:SetVisible(true)
20 MrJackdaw-1942
 
21 MrJackdaw-1942
        local x,y=Turbine.UI.Display:GetMousePosition()
22 MrJackdaw-1942
        self:SetPosition(x,y)
23 MrJackdaw-1942
 
24 MrJackdaw-1942
        self.Control.MouseLeave=function()
25 MrJackdaw-1942
                self:SetVisible(false)
26 MrJackdaw-1942
                self=nil
27 MrJackdaw-1942
        end
28 MrJackdaw-1942
        self:SetVisible(true)
29 MrJackdaw-1942
        self:SetSize(200,1)
30 MrJackdaw-1942
        self:SetZOrder(9999)
31 MrJackdaw-1942
end
32 MrJackdaw-1942
 
33 MrJackdaw-1942
 
34 MrJackdaw-1942
function JContextMenu:AddItem(i)
35 MrJackdaw-1942
        self.ListBox:AddItem(i)
36 MrJackdaw-1942
        self:SetHeight(self:GetHeight()+i:GetHeight())
37 MrJackdaw-1942
        self.ListBox:SetSize(self:GetSize())
38 MrJackdaw-1942
        self.Control:SetSize(self:GetSize())
39 MrJackdaw-1942
 
40 MrJackdaw-1942
        --ensure it stays on screen.
41 MrJackdaw-1942
        local x,y=self:GetPosition()
42 MrJackdaw-1942
        local w,h=self:GetSize()
43 MrJackdaw-1942
        local sw,sh=Turbine.UI.Display.GetWidth(),Turbine.UI.Display.GetHeight()
44 MrJackdaw-1942
        if x+w>sw then x=sw-w end
45 MrJackdaw-1942
        if y+h>sh then y=sh-h end
46 MrJackdaw-1942
 
47 MrJackdaw-1942
        self:SetPosition(x,y)
48 MrJackdaw-1942
 
49 MrJackdaw-1942
end
50 MrJackdaw-1942
 
51 MrJackdaw-1942
 
52 MrJackdaw-1942
--Simple label button function
53 MrJackdaw-1942
JClabel=class(Turbine.UI.Control)
54 MrJackdaw-1942
function JClabel:Constructor (text,e)
55 MrJackdaw-1942
        local width=200
56 MrJackdaw-1942
        local height=20
57 MrJackdaw-1942
 
58 MrJackdaw-1942
        Turbine.UI.Control.Constructor(self)
59 MrJackdaw-1942
        self:SetSize(width,height)
60 MrJackdaw-1942
 
61 MrJackdaw-1942
        self.quickslot = Turbine.UI.Lotro.Quickslot();
62 MrJackdaw-1942
                self.quickslot:SetParent(self);
63 MrJackdaw-1942
                self.quickslot:SetSize(width, height);
64 MrJackdaw-1942
                self.quickslot:SetBackColor(Turbine.UI.Color(0.4, 0.3, 0.0));
65 MrJackdaw-1942
                self.shortcut = Turbine.UI.Lotro.Shortcut();
66 MrJackdaw-1942
                self.shortcut:SetType(Turbine.UI.Lotro.ShortcutType.Alias);
67 MrJackdaw-1942
                self.shortcut:SetData(e);
68 MrJackdaw-1942
                self.quickslot:SetShortcut(self.shortcut);
69 MrJackdaw-1942
                self.quickslot:SetVisible(true);
70 MrJackdaw-1942
                self.quickslot:SetZOrder(991)
71 MrJackdaw-1942
 
72 MrJackdaw-1942
        self.label=Turbine.UI.Label()
73 MrJackdaw-1942
 
74 MrJackdaw-1942
        self.label:SetBackColor( Turbine.UI.Color( 1,0,0,0 ) )
75 MrJackdaw-1942
 
76 MrJackdaw-1942
                self.label:SetMultiline(false)
77 MrJackdaw-1942
                self.label:SetTextAlignment( Turbine.UI.ContentAlignment.Left )
78 MrJackdaw-1942
                self.label:SetFont(Turbine.UI.Lotro.Font.TrajanPro14)
79 MrJackdaw-1942
                self.label:SetText( text )
80 MrJackdaw-1942
                self.label:SetMouseVisible (false)
81 MrJackdaw-1942
                self.label:SetSize(width,height)
82 MrJackdaw-1942
                self.label:SetParent(self)
83 MrJackdaw-1942
                self.label:SetZOrder(992)
84 MrJackdaw-1942
 
85 MrJackdaw-1942
                self.label.MouseEnter=function()
86 MrJackdaw-1942
                        self.label:SetOutlineColor(Turbine.UI.Color(0.8, 0.65, 0.1));
87 MrJackdaw-1942
                        self.label:SetFontStyle(Turbine.UI.FontStyle.Outline);
88 MrJackdaw-1942
                end
89 MrJackdaw-1942
                self.label.MouseLeave =function()
90 MrJackdaw-1942
                        self.label:SetOutlineColor(Turbine.UI.Color(0.0, 0.0, 0.0));
91 MrJackdaw-1942
                        self.label:SetFontStyle(Turbine.UI.FontStyle.None);
92 MrJackdaw-1942
                end
93 MrJackdaw-1942
 
94 MrJackdaw-1942
        self.quickslot.MouseClick=function()
95 MrJackdaw-1942
        --fudge function Not pretty.
96 MrJackdaw-1942
                if context~=nil then
97 MrJackdaw-1942
                        context:SetVisible(false)
98 MrJackdaw-1942
                        context=nil
99 MrJackdaw-1942
 
100 119 MrJackdaw-1942
                        --Unload/load sortpack
101 114 MrJackdaw-1942
                        Turbine.PluginManager.UnloadScriptState("SortPack")
102 MrJackdaw-1942
                        Turbine.PluginManager.LoadPlugin("SortPack")
103 MrJackdaw-1942
                end
104 MrJackdaw-1942
        end
105 MrJackdaw-1942
end

All times are GMT -5. The time now is 06:25 PM.


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