fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
a8034e9
main
1local PANEL =class . create ( "Panel" , "BasePanel" ) 2 3PANEL : ACCESSOR ( "Enabled" , "m_bEnabled" , true ) 4PANEL : ACCESSOR ( "BorderColor" , "m_cBorderColor" , color ( 165 , 165 , 165 )) 5PANEL : ACCESSOR ( { "BGColor" , "BackgroundColor" } , "m_cBackgroundColor" , color ( 200 , 200 , 200 )) 6PANEL : ACCESSOR ( "TooltipTitle" , "m_strTooltipTitle" ) 7PANEL : ACCESSOR ( "TooltipBody" , "m_strTooltipBody" ) 8PANEL : ACCESSOR ( "TooltipParent" , "m_pTooltipParent" ) 9PANEL : ACCESSOR ( "DrawPanel" , "m_bDrawPanel" , true ) 10 11function PANEL : Panel () 12self : super () -- Initialize our baseclass 13end 14 15function PANEL : Skin () 16gui . skinHook ( "Init" , "Panel" , self ) 17end 18 19function PANEL : PrePaint ( w , h ) 20if self . m_bDrawPanel then 21gui . skinHook ( "Paint" , "Panel" , self , w , h ) 22end 23end 24 25function PANEL : Paint ( w , h ) 26-- Override 27end 28 29function PANEL : PaintOverlay ( w , h ) 30if self . m_bDrawPanel then 31gui . skinHook ( "PaintOverlay" , "Panel" , self , w , h ) 32end 33end 34 35function PANEL : PostPaint ( w , h ) 36if not self : IsEnabled () then 37graphics . setColor ( color ( 0 , 0 , 0 , 100 )) 38graphics . rectangle ( "fill" , 0 , 0 , w , h ) 39end 40end 41 42function PANEL : OnQueryTooltip () 43if self . m_strTooltipTitle and self . m_strTooltipBody then 44gui . setTooltip ( self . m_pTooltipParent or self , self . m_strTooltipTitle , self . m_strTooltipBody ) 45return true 46end 47end 48 49function PANEL : IsPressed () 50return self . m_bPressed and self : IsHovered () 51end 52 53function PANEL : OnMousePressed ( x , y , but ) 54if not self . m_bEnabled or but ~= 1 then return end 55self . m_bPressed =true 56return true 57end 58 59function PANEL : OnMouseReleased ( x , y , but ) 60if not self . m_bEnabled or but ~= 1 then return end 61if self . m_bPressed then 62self . m_bPressed =false 63if self : IsHovered () then 64self : OnClick () 65return true 66end 67end 68end 69 70function PANEL : OnClick () 71-- Override 72end