diff options
| author | Apickx <Apickx@cogarr.org> | 2015-12-28 19:18:30 -0500 |
|---|---|---|
| committer | Apickx <Apickx@cogarr.org> | 2015-12-28 19:18:30 -0500 |
| commit | 868e729d68b5913716bfe5ddb512f4099851e9a2 (patch) | |
| tree | 6441108754145dfd68a6e23bea382b5cb1ab63d5 /gamemode/cl_hud/vgui/mbframe.lua | |
| download | gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.tar.gz gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.tar.bz2 gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.zip | |
Diffstat (limited to 'gamemode/cl_hud/vgui/mbframe.lua')
| -rw-r--r-- | gamemode/cl_hud/vgui/mbframe.lua | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/gamemode/cl_hud/vgui/mbframe.lua b/gamemode/cl_hud/vgui/mbframe.lua new file mode 100644 index 0000000..ab99fd7 --- /dev/null +++ b/gamemode/cl_hud/vgui/mbframe.lua @@ -0,0 +1,84 @@ +local PANEL = {} +local Close = surface.GetTextureID("gearfox/vgui/close") + +function PANEL:Init() + self.bgcol = MAIN_COLOR + self.fgcol = MAIN_COLOR2 + + self.Font = "Trebuchet18" + self.Text = "No-Title MBFrame" + self.TextCol = MAIN_TEXTCOLOR + self.BrigCol = MAIN_WHITECOLOR + self.CloseRem = false + self.ShowClose = true + + self:SetPaintBackgroundEnabled( false ) + self:SetPaintBorderEnabled( false ) +end + +function PANEL:OnClose() +end + +function PANEL:SetDeleteOnClose( bool ) + self.CloseRem = bool +end + +function PANEL:SetTitle( name ) + self.Text = name +end + +function PANEL:SetFGColor( col ) + self.fgcol = col +end + +function PANEL:SetBGColor( col ) + self.bgcol = col +end + +function PANEL:SetTextColor( col ) + self.TextCol = col +end + +function PANEL:SetTextFont( font ) + self.Font = font +end + +function PANEL:ShowCloseButton( bool ) + self.ShowClose = bool +end + +function PANEL:OnMousePressed() + if (!self.ShowClose) then return end + + local x,y = self:LocalToScreen( self:GetWide()-17 , 3 ) + + if (input.IsMouseInBox( x , y , 14 , 14 )) then + self:OnClose() + + if (self.CloseRem) then self:Remove() + else self:SetVisible(false) end + end +end + +function PANEL:Paint(w,h) + DrawBoxy( 0 , 0 , w , h , self.bgcol ) + DrawLine( 0 , 20 , w , 20 , self.fgcol ) +end + +function PANEL:PaintOver(w,h) + DrawText( self.Text , self.Font , 2 , 2 , self.TextCol ) + + if (self.ShowClose) then + local x,y = self:GetPos() + + if (input.IsMouseInBox(x+w-17 , y+3 , 14 , 14)) then DrawTexturedRect( w-17 , 3 , 14 , 14 , self.BrigCol , Close ) + else DrawTexturedRect( w-17 , 3 , 14 , 14 , self.TextCol , Close ) end + end + + return true +end + +function PANEL:PerformLayout() +end + +vgui.Register( "MBFrame", PANEL, "EditablePanel" )
\ No newline at end of file |
