Files
wnsrc/lua/vgui/dlabelurl.lua

74 lines
1.3 KiB
Lua
Raw Normal View History

2024-08-04 23:12:27 +03:00
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PANEL = {}
AccessorFunc( PANEL, "m_colText", "TextColor" )
AccessorFunc( PANEL, "m_colTextStyle", "TextStyleColor" )
AccessorFunc( PANEL, "m_bAutoStretchVertical", "AutoStretchVertical" )
function PANEL:Init()
self:SetTextStyleColor( Color( 0, 0, 255 ) )
-- Nicer default height
self:SetTall( 20 )
-- This turns off the engine drawing
self:SetPaintBackgroundEnabled( false )
self:SetPaintBorderEnabled( false )
end
function PANEL:ApplySchemeSettings()
self:UpdateFGColor()
end
function PANEL:SetTextColor( clr )
self.m_colText = clr
self:UpdateFGColor()
end
PANEL.SetColor = PANEL.SetTextColor
function PANEL:GetColor()
return self.m_colText or self.m_colTextStyle
end
function PANEL:OnCursorEntered()
self:SetTextStyleColor( Color( 0, 50, 255 ) )
self:UpdateFGColor()
end
function PANEL:OnCursorExited()
self:SetTextStyleColor( Color( 0, 0, 255 ) )
self:UpdateFGColor()
end
function PANEL:UpdateFGColor()
local col = self:GetColor()
self:SetFGColor( col.r, col.g, col.b, col.a )
end
derma.DefineControl( "DLabelURL", "A Label", PANEL, "URLLabel" )