Class: FakeUI::TextView
- Inherits:
-
Object
- Object
- FakeUI::TextView
- Defined in:
- lib/fakeui/text_view.rb
Instance Attribute Summary collapse
-
#selectedRange ⇒ Object
Returns the value of attribute selectedRange.
-
#string ⇒ Object
Returns the value of attribute string.
-
#textStorage ⇒ Object
Returns the value of attribute textStorage.
Instance Method Summary collapse
-
#initialize ⇒ TextView
constructor
A new instance of TextView.
- #insertText(to_insert) ⇒ Object
- #scrollRangeToVisible(range) ⇒ Object
- #setDelegate(delegate) ⇒ Object
- #setSelectedRange(range) ⇒ Object
- #setString(string) ⇒ Object
Constructor Details
#initialize ⇒ TextView
Returns a new instance of TextView.
5 6 7 8 9 |
# File 'lib/fakeui/text_view.rb', line 5 def initialize @string = "" @selectedRange = [0, 0] @textStorage = TextStorage.new end |
Instance Attribute Details
#selectedRange ⇒ Object
Returns the value of attribute selectedRange.
3 4 5 |
# File 'lib/fakeui/text_view.rb', line 3 def selectedRange @selectedRange end |
#string ⇒ Object
Returns the value of attribute string.
3 4 5 |
# File 'lib/fakeui/text_view.rb', line 3 def string @string end |
#textStorage ⇒ Object
Returns the value of attribute textStorage.
3 4 5 |
# File 'lib/fakeui/text_view.rb', line 3 def textStorage @textStorage end |
Instance Method Details
#insertText(to_insert) ⇒ Object
16 17 18 19 |
# File 'lib/fakeui/text_view.rb', line 16 def insertText(to_insert) @string[@selectedRange[0], @selectedRange[1]] = to_insert @selectedRange = [@selectedRange[0] + to_insert.size, 0] end |
#scrollRangeToVisible(range) ⇒ Object
25 26 27 |
# File 'lib/fakeui/text_view.rb', line 25 def scrollRangeToVisible(range) # stub end |
#setDelegate(delegate) ⇒ Object
29 30 |
# File 'lib/fakeui/text_view.rb', line 29 def setDelegate(delegate) end |
#setSelectedRange(range) ⇒ Object
21 22 23 |
# File 'lib/fakeui/text_view.rb', line 21 def setSelectedRange(range) @selectedRange = range end |
#setString(string) ⇒ Object
11 12 13 14 |
# File 'lib/fakeui/text_view.rb', line 11 def setString(string) @string = string @selectedRange = [string.size, 0] end |