Class: Rabbit::SearchWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/rabbit/search-window.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(canvas) ⇒ SearchWindow

Returns a new instance of SearchWindow.


9
10
11
12
13
# File 'lib/rabbit/search-window.rb', line 9

def initialize(canvas)
  @canvas = canvas
  @searcher = Searcher.new(canvas)
  init_window
end

Instance Attribute Details

#directionObject

Returns the value of attribute direction.


8
9
10
# File 'lib/rabbit/search-window.rb', line 8

def direction
  @direction
end

#entryObject

Returns the value of attribute entry.


8
9
10
# File 'lib/rabbit/search-window.rb', line 8

def entry
  @entry
end

#windowObject

Returns the value of attribute window.


8
9
10
# File 'lib/rabbit/search-window.rb', line 8

def window
  @window
end

Instance Method Details

#destroyObject


20
21
22
23
# File 'lib/rabbit/search-window.rb', line 20

def destroy
  send_focus_change(false)
  @window.destroy
end

#empty?Boolean

Returns:

  • (Boolean)

33
34
35
# File 'lib/rabbit/search-window.rb', line 33

def empty?
  /\A\s*\z/ =~ @entry.text
end

#forward=(forward) ⇒ Object


25
26
27
# File 'lib/rabbit/search-window.rb', line 25

def forward=(forward)
  @direction.active = forward
end

#forward?Boolean

Returns:

  • (Boolean)

29
30
31
# File 'lib/rabbit/search-window.rb', line 29

def forward?
  @direction.active?
end

#regexpObject


37
38
39
# File 'lib/rabbit/search-window.rb', line 37

def regexp
  @searcher.regexp(@entry.text)
end

#showObject


15
16
17
18
# File 'lib/rabbit/search-window.rb', line 15

def show
  send_focus_change(true)
  @window.show
end