Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. local PANEL = {}
  2. function PANEL:Init()
  3. self:SetSize( 200, 100 )
  4. self:Center()
  5. self.title = "coffeeinv_frame"
  6. self.theme = coffeeInventory.config.themes[ coffeeInventory.config.theme ]
  7. end
  8.  
  9. function PANEL:Paint( w, h )
  10. //Background
  11. draw.RoundedBox( 0, 0, 0, w, h, Color( self.theme.frameBackground.r - 20, self.theme.frameBackground.g - 20, self.theme.frameBackground.b - 20, self.theme.frameBackground.a or 255 ) )
  12. draw.RoundedBox( 0, 1, 1, w - 2, h - 2, self.theme.frameBackground )
  13. draw.RoundedBox( 0, 2, 2, w - 4, h - 4, Color( self.theme.frameBackground.r - 10, self.theme.frameBackground.g - 10, self.theme.frameBackground.b - 10, self.theme.frameBackground.a or 255 ) )
  14. //Bar
  15. draw.RoundedBox( 0, 0, 0, w, 16, self.theme.frameBar )
  16. draw.RoundedBox( 0, 0, 16, w, 4, Color( self.theme.frameBar.r - 50, self.theme.frameBar.g - 50, self.theme.frameBar.b - 50, self.theme.frameBackground.a or 255 ) )
  17. //Title
  18. draw.SimpleText( self.title, "coffeeinventory_little", w / 2, 8, self.theme.titleText, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  19. end
  20.  
  21. function PANEL:setTitle( text )
  22. self.title = text
  23. end
  24.  
  25. function PANEL:addCloseButton()
  26. self.closeButton = vgui.Create( "coffeeinv_textButton", self )
  27. self.closeButton:SetSize( 20, 20 )
  28. self.closeButton:SetPos( self:GetWide() - 25, 0 )
  29. self.closeButton:setText( "X" )
  30. self.closeButton.OnMousePressed = function()
  31. surface.PlaySound( "buttons/button14.wav" )
  32. self:Remove()
  33. end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement