MattiasBuelens

CCGUI focus

Jul 6th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. --[[
  2.  
  3.     ComputerCraft GUI
  4.     Focusable element
  5.  
  6. --]]
  7.  
  8. ccgui = ccgui or {}
  9.  
  10. local FocusElement = common.newClass({
  11.     hasFocus = false
  12. }, ccgui.Element)
  13. ccgui.FocusElement = FocusElement
  14.  
  15. function FocusElement:init()
  16.     ccgui.Element.init(self)
  17.  
  18.     self:bubbleEvent("focus")
  19.     self:bubbleEvent("blur")
  20.  
  21.     -- Repaint on focus
  22.     --[[self:on("focus", self.markRepaint, self)
  23.     self:on("focus", self.markRepaint, self)
  24.     self:on("blur", self.markRepaint, self)]]--
  25. end
  26.  
  27. function FocusElement:canFocus()
  28.     return self.isVisible
  29. end
Advertisement
Add Comment
Please, Sign In to add comment