Class: Cura::Cursor
- Inherits:
-
Object
- Object
- Cura::Cursor
- Includes:
- Attributes::HasApplication, Attributes::HasAttributes, Attributes::HasCoordinates, Attributes::HasInitialize
- 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= ⇒ 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.
18 19 20 21 22 23 24 |
# File 'lib/cura/cursor.rb', line 18 def initialize(attributes={}) @hidden = true super raise ArgumentError, "application must be set" if application.nil? end |
Instance Method Details
#hidden= ⇒ Boolean
Set if the cursor is hidden.
36 |
# File 'lib/cura/cursor.rb', line 36 attribute(:hidden, query: true) |
#hidden? ⇒ Boolean
Check if the cursor is hidden.
|
# File 'lib/cura/cursor.rb', line 26
|
#hide ⇒ Cursor
Hide the cursor.
50 51 52 53 54 |
# File 'lib/cura/cursor.rb', line 50 def hide @hidden = true self end |
#show ⇒ Cursor
Show the cursor.
41 42 43 44 45 |
# File 'lib/cura/cursor.rb', line 41 def show @hidden = false self end |
#update ⇒ Cursor
Draw (set) the cursor.
59 60 61 62 63 64 65 66 67 |
# File 'lib/cura/cursor.rb', line 59 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 |