dobrograd-13-06-2022/garrysmod/addons/gmod-tools/lua/vgui/ctrlnumpadmulti.lua
Jonny_Bro (Nikita) e4d5311906 first commit
2023-11-16 15:01:19 +05:00

39 lines
778 B
Lua

local PANEL = {}
function PANEL:Init()
self.Label = vgui.Create("DLabel", self)
self.NumPad = vgui.Create("DNumPadMulti", self)
self.Label:SetTextColor(color_white)
self:SetPaintBackground(false)
end
function PANEL:SetLabel(txt)
self.Label:SetText(txt or "Unnamed CtrlNumPadMulti: ")
end
function PANEL:SetConVar(varname)
self.ConVar = varname
self.NumPad:SetConVar(varname)
end
function PANEL:GetConVar()
return self.ConVar
end
function PANEL:PerformLayout()
self.NumPad:InvalidateLayout(true)
self.NumPad:Center()
self.NumPad:AlignBottom(5)
self.Label:CenterHorizontal()
self.Label:AlignTop(5)
self.Label:SizeToContents()
self:SetTall(self.Label:GetTall() + self.NumPad:GetTall() + 15)
end
vgui.Register("CtrlNumPadMulti", PANEL, "DPanel")