Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Name: "cl_openweb.lua".
- Product: "nexus".
- --]]
- local PANEL = {};
- -- Called when the panel is initialized.
- function PANEL:Init()
- self:SetSize( nexus.menu.GetWidth(), nexus.menu.GetHeight() );
- self.panelList = vgui.Create("DPanelList", self);
- self.panelList:SetPadding(2);
- self.panelList:SetSpacing(3);
- self.panelList:SizeToContents();
- self.panelList:EnableVerticalScrollbar();
- self:Rebuild();
- end;
- local WebSite = "http://x-hosters.com";
- -- A function to rebuild the panel.
- function PANEL:Rebuild()
- local self = vgui.Create("DFrame");
- self.openwebForm:SetSize(ScrW() / 1.1,ScrH() / 1.1);
- self.openwebForm:Center();
- self.openwebForm:SetTitle("Our Website");
- self.openwebForm:SetBackgroundBlur( true );
- self.openwebForm:MakePopup();
- local Butt = vgui.Create("DButton",Form);
- Butt:SetSize(50,23);
- Butt:SetPos(self.openwebForm:GetWide() - 5 - Butt:GetWide(),self.openwebForm:GetTall() - 5 - Butt:GetTall());
- Butt:SetText("Close");
- function Butt:DoClick()
- self.openwebForm:Close();
- end
- local Web = vgui.Create("HTML",Form);
- Web:SetPos(5,23 + 5);
- Web:SetSize(self.openwebForm:GetWide() - 10,self.openwebForm:GetTall() - 23 - 5 - Butt:GetTall() - 5 - 5);
- Web:OpenURL(WebSite);
- self.panelList:AddItem(self.openwebForm);
- self.panelList:InvalidateLayout(true);
- end
- -- Called when the layout should be performed.
- function PANEL:PerformLayout()
- self.panelList:StretchToParent(4, 4, 4, 4);
- self:SetSize( self:GetWide(), math.min(self.panelList.pnlCanvas:GetTall() + 8, ScrH() * 0.75) );
- end;
- -- Called each frame.
- function PANEL:Think()
- self:InvalidateLayout(true);
- end;
- vgui.Register("nx_openweb", PANEL, "DPanel");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement