Class: Rabbit::CursorManager
- Inherits:
-
Object
- Object
- Rabbit::CursorManager
- Defined in:
- lib/rabbit/cursor-manager.rb
Constant Summary collapse
- @@cursors =
nil
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ CursorManager
constructor
A new instance of CursorManager.
- #keep(name) ⇒ Object
- #restore(drawable, name) ⇒ Object
- #update(drawable, type) ⇒ Object
Constructor Details
#initialize ⇒ CursorManager
Returns a new instance of CursorManager.
32 33 34 35 |
# File 'lib/rabbit/cursor-manager.rb', line 32 def initialize @stocks = {} @current = nil end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
31 32 33 |
# File 'lib/rabbit/cursor-manager.rb', line 31 def current @current end |
Class Method Details
Instance Method Details
#keep(name) ⇒ Object
37 38 39 40 |
# File 'lib/rabbit/cursor-manager.rb', line 37 def keep(name) @stocks[name] ||= [] @stocks[name].push(@current) end |
#restore(drawable, name) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/rabbit/cursor-manager.rb', line 42 def restore(drawable, name) if name.nil? type = @current else type = @stocks[name].pop end drawable.cursor = type_to_cursor(type) end |
#update(drawable, type) ⇒ Object
51 52 53 |
# File 'lib/rabbit/cursor-manager.rb', line 51 def update(drawable, type) drawable.cursor = type_to_cursor(type) end |