Class: Cura::Cursor
- Inherits:
-
Object
- Object
- Cura::Cursor
- Defined in:
- lib/cura/cursor.rb
Overview
The text cursor controller.
Should only ever have one single Cursor instance at one time. TODO: Rename Cursor::Text, need Cursor::Mouse
Instance Attribute Summary
Attributes included from Attributes::HasApplication
Instance Method Summary collapse
-
#hidden=(value) ⇒ Boolean
Set if the cursor is hidden.
-
#hidden? ⇒ Boolean
Check if the cursor is hidden.
-
#hide ⇒ Cursor
Hide the cursor.
-
#initialize(attributes = {}) ⇒ Cursor
constructor
A new instance of Cursor.
-
#show ⇒ Cursor
Show the cursor.
-
#update ⇒ Cursor
Draw (set) the cursor.
Methods included from Attributes::HasCoordinates
Methods included from Attributes::HasAttributes
Constructor Details
#initialize(attributes = {}) ⇒ Cursor
Returns a new instance of Cursor.
19 20 21 22 23 24 25 |
# File 'lib/cura/cursor.rb', line 19 def initialize(attributes={}) @hidden = true super raise ArgumentError, "application must be set" if application.nil? end |
Instance Method Details
#hidden=(value) ⇒ Boolean
Set if the cursor is hidden.
38 39 40 41 42 |
# File 'lib/cura/cursor.rb', line 38 def hidden=(value) value = !!value @hidden = value end |
#hidden? ⇒ Boolean
Check if the cursor is hidden.
30 31 32 |
# File 'lib/cura/cursor.rb', line 30 def hidden? !!@hidden end |
#hide ⇒ Cursor
Hide the cursor.
56 57 58 59 60 |
# File 'lib/cura/cursor.rb', line 56 def hide @hidden = true self end |
#show ⇒ Cursor
Show the cursor.
47 48 49 50 51 |
# File 'lib/cura/cursor.rb', line 47 def show @hidden = false self end |
#update ⇒ Cursor
Draw (set) the cursor.
65 66 67 68 69 70 71 72 73 |
# File 'lib/cura/cursor.rb', line 65 def update # TODO: Refactor for speed, this can't be effecient if @hidden application.adapter.hide_cursor else application.adapter.set_cursor(@x, @y) end self end |