mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
93
lua/vgui/dpanel.lua
Normal file
93
lua/vgui/dpanel.lua
Normal file
@@ -0,0 +1,93 @@
|
||||
--[[
|
||||
| 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_bBackground", "PaintBackground", FORCE_BOOL )
|
||||
AccessorFunc( PANEL, "m_bBackground", "DrawBackground", FORCE_BOOL ) -- deprecated
|
||||
AccessorFunc( PANEL, "m_bIsMenuComponent", "IsMenu", FORCE_BOOL )
|
||||
AccessorFunc( PANEL, "m_bDisableTabbing", "TabbingDisabled", FORCE_BOOL )
|
||||
|
||||
AccessorFunc( PANEL, "m_bDisabled", "Disabled" )
|
||||
AccessorFunc( PANEL, "m_bgColor", "BackgroundColor" )
|
||||
|
||||
Derma_Hook( PANEL, "Paint", "Paint", "Panel" )
|
||||
Derma_Hook( PANEL, "ApplySchemeSettings", "Scheme", "Panel" )
|
||||
Derma_Hook( PANEL, "PerformLayout", "Layout", "Panel" )
|
||||
|
||||
function PANEL:Init()
|
||||
|
||||
self:SetPaintBackground( true )
|
||||
|
||||
-- This turns off the engine drawing
|
||||
self:SetPaintBackgroundEnabled( false )
|
||||
self:SetPaintBorderEnabled( false )
|
||||
|
||||
end
|
||||
|
||||
function PANEL:SetDisabled( bDisabled )
|
||||
|
||||
self.m_bDisabled = bDisabled
|
||||
|
||||
if ( bDisabled ) then
|
||||
self:SetAlpha( 75 )
|
||||
self:SetMouseInputEnabled( false )
|
||||
else
|
||||
self:SetAlpha( 255 )
|
||||
self:SetMouseInputEnabled( true )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PANEL:SetEnabled( bEnabled )
|
||||
|
||||
self:SetDisabled( !bEnabled )
|
||||
|
||||
end
|
||||
|
||||
function PANEL:IsEnabled()
|
||||
|
||||
return !self:GetDisabled()
|
||||
|
||||
end
|
||||
|
||||
function PANEL:OnMousePressed( mousecode )
|
||||
|
||||
if ( self:IsSelectionCanvas() && !dragndrop.IsDragging() ) then
|
||||
self:StartBoxSelection()
|
||||
return
|
||||
end
|
||||
|
||||
if ( self:IsDraggable() ) then
|
||||
|
||||
self:MouseCapture( true )
|
||||
self:DragMousePress( mousecode )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PANEL:OnMouseReleased( mousecode )
|
||||
|
||||
if ( self:EndBoxSelection() ) then return end
|
||||
|
||||
self:MouseCapture( false )
|
||||
|
||||
if ( self:DragMouseRelease( mousecode ) ) then
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PANEL:UpdateColours()
|
||||
end
|
||||
|
||||
derma.DefineControl( "DPanel", "", PANEL, "Panel" )
|
||||
Reference in New Issue
Block a user