class Rabbit::SearchWindow
Attributes
direction[RW]
entry[RW]
window[RW]
Public Class Methods
new(canvas)
click to toggle source
# File lib/rabbit/search-window.rb, line 9 def initialize(canvas) @canvas = canvas @searcher = Searcher.new(canvas) init_window end
Public Instance Methods
destroy()
click to toggle source
# File lib/rabbit/search-window.rb, line 20 def destroy send_focus_change(false) @window.destroy end
empty?()
click to toggle source
# File lib/rabbit/search-window.rb, line 33 def empty? /\A\s*\z/ =~ @entry.text end
forward=(forward)
click to toggle source
# File lib/rabbit/search-window.rb, line 25 def forward=(forward) @direction.active = forward end
forward?()
click to toggle source
# File lib/rabbit/search-window.rb, line 29 def forward? @direction.active? end
regexp()
click to toggle source
# File lib/rabbit/search-window.rb, line 37 def regexp @searcher.regexp(@entry.text) end
show()
click to toggle source
# File lib/rabbit/search-window.rb, line 15 def show send_focus_change(true) @window.show end
Private Instance Methods
init_box()
click to toggle source
# File lib/rabbit/search-window.rb, line 58 def init_box @box = Gtk::Box.new(:horizontal) @box.border_width = 3 @box.show @frame.add(@box) end
init_direction()
click to toggle source
# File lib/rabbit/search-window.rb, line 71 def init_direction @direction = Gtk::ToggleButton.new @arrow = Gtk::Arrow.new(:left, :none) @arrow.show @direction.add(@arrow) @direction.can_focus = false @direction.show @box.add(@direction) @direction.signal_connect("toggled") do |button| if forward? type = :right else type = :left end @arrow.set(type, :none) end @direction.active = true end
init_entry()
click to toggle source
# File lib/rabbit/search-window.rb, line 65 def init_entry @entry = Gtk::Entry.new @entry.show @box.add(@entry) end
init_frame()
click to toggle source
# File lib/rabbit/search-window.rb, line 51 def init_frame @frame = Gtk::Frame.new @frame.shadow_type = :etched_in @frame.show @window.add(@frame) end
init_window()
click to toggle source
# File lib/rabbit/search-window.rb, line 42 def init_window @window = Gtk::Window.new(:popup) @window.modal = true init_frame init_box init_entry init_direction end
send_focus_change(focus_in)
click to toggle source
# File lib/rabbit/search-window.rb, line 90 def send_focus_change(focus_in) @entry.has_focus = focus_in event = Gdk::EventFocus.new(:focus_change) event.window = @entry.window event.in = focus_in @entry.event(event) @entry.notify("has-focus") end