/* * * * * * * * * * * * * * * * 
 * 	 ______     __  __     ______     __  __     ______     ______     __  __    
 *	/\  __ \   /\ \/\ \   /\  == \   /\ \_\ \   /\  __ \   /\  ___\   /\ \/ /    
 *	\ \ \/\ \  \ \ \_\ \  \ \  __<   \ \  __ \  \ \  __ \  \ \ \____  \ \  _"-.  
 *	 \ \_____\  \ \_____\  \ \_____\  \ \_\ \_\  \ \_\ \_\  \ \_____\  \ \_\ \_\ 
 *	  \/_____/   \/_____/   \/_____/   \/_/\/_/   \/_/\/_/   \/_____/   \/_/\/_/ 
 *
 *  - Version : 3L
 *  - By Oubliette
 * * * * * * * * * * * * * * * */

--
local arg = { ... };
local g = arg[ 1 ];
local VGUI = arg[ 2 ];
--


--[[   _                                
    ( )                               
   _| |   __   _ __   ___ ___     _ _ 
 /'_` | /'__`\( '__)/' _ ` _ `\ /'_` )
( (_| |(  ___/| |   | ( ) ( ) |( (_| |
`\__,_)`\____)(_)   (_) (_) (_)`\__,_) 

	DPanel

--]]
local PANEL = {}

g.AccessorFunc( PANEL, "m_bBackground", 			"PaintBackground",	g.FORCE_BOOL )
g.AccessorFunc( PANEL, "m_bBackground", 			"DrawBackground", 	g.FORCE_BOOL )
g.AccessorFunc( PANEL, "m_bIsMenuComponent", 		"IsMenu", 			g.FORCE_BOOL )
g.AccessorFunc( PANEL, "m_bDisableTabbing", 		"TabbingDisabled", 	g.FORCE_BOOL )



g.AccessorFunc( PANEL, "m_bDisabled", 			"Disabled" )
g.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

--[[---------------------------------------------------------
	OnMousePressed
-----------------------------------------------------------]]
function PANEL:OnMousePressed( mousecode )

	if ( self.m_bSelectionCanvas && !dragndrop.IsDragging() ) then 
		self:StartBoxSelection();
	return end

	if ( self:IsDraggable() ) then
	
		self:MouseCapture( true )
		self:DragMousePress( mousecode );
	
	end

end

--[[---------------------------------------------------------
	OnMouseReleased
-----------------------------------------------------------]]
function PANEL:OnMouseReleased( mousecode )

	if ( self:EndBoxSelection() ) then return end

	self:MouseCapture( false )
	
	if ( self:DragMouseRelease( mousecode ) ) then
		return
	end

end

--[[---------------------------------------------------------
	UpdateColours
-----------------------------------------------------------]]
function PANEL:UpdateColours()

end

// This is my replacement for a skin, the entire paint function is handled by, mwah
function PANEL:Paint()

	g.surface.SetDrawColor( VGUI.Cols.BGLight );
	g.surface.DrawRect( 0, 0, self:GetSize() );

end

VGUI.RegisterElement( "DPanel", PANEL, "Panel" );