Class: Rabbit::InfoWindow

Inherits:
Object
  • Object
show all
Includes:
ERB::Util, GetText, Renderer::Display::ButtonHandler, Renderer::Display::HookHandler, Renderer::Display::KeyHandler, Renderer::Display::Menu, Renderer::Display::ScrollHandler
Defined in:
lib/rabbit/info-window.rb

Constant Summary

Constants included from Renderer::Display::ButtonHandler

Renderer::Display::ButtonHandler::BUTTON_PRESS_ACCEPTING_TIME

Constants included from GetText

GetText::DOMAIN

Instance Method Summary collapse

Methods included from Renderer::Display::KeyHandler

#connect_key, #disconnect_key

Methods included from Renderer::Display::HookHandler

#add_button_press_hook, #add_button_release_hook, #add_motion_notify_hook, #add_scroll_hook, #call_hook_procs, #clear_button_press_hook, #clear_button_release_hook, #clear_hooks, #clear_motion_notify_hook, #clear_scroll_hook

Methods included from GetText

included

Constructor Details

#initialize(canvas) ⇒ InfoWindow

Returns a new instance of InfoWindow.



23
24
25
26
27
28
29
30
31
32
# File 'lib/rabbit/info-window.rb', line 23

def initialize(canvas)
  @canvas = canvas
  @window = nil
  @timer_id = nil
  @note_area = nil
  init_hook_handler
  init_key_handler
  init_button_handler
  init_scroll_handler
end

Instance Method Details

#hideObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rabbit/info-window.rb', line 42

def hide
  return unless showing?
  detach_menu(@window)
  detach_key(@window)
  each do |canvas|
    canvas.detach
  end
  @window.signal_handler_disconnect(@window_destroy_id)
  @window.destroy
  @window = @window_destroy_id = nil
  @canvas_widgets = @outer_box = nil
  GLib::Source.remove(@timer_id) if @timer_id
  @timer_id = nil
  @previous_canvas = @current_canvas = @next_canvas = nil
end

#index_mode_offObject



78
79
80
81
# File 'lib/rabbit/info-window.rb', line 78

def index_mode_off
  return unless showing?
  toggle_index_mode
end

#index_mode_onObject



73
74
75
76
# File 'lib/rabbit/info-window.rb', line 73

def index_mode_on
  return unless showing?
  toggle_index_mode
end

#moved(index) ⇒ Object



62
63
64
65
# File 'lib/rabbit/info-window.rb', line 62

def moved(index)
  return unless showing?
  update(index)
end

#parsedObject



67
68
69
70
71
# File 'lib/rabbit/info-window.rb', line 67

def parsed
  return unless showing?
  update_source
  update
end

#show(width = nil, height = nil) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/rabbit/info-window.rb', line 34

def show(width=nil, height=nil)
  init_gui(width, height)
  @window.show_all
  update_source
  toggle_index_mode if @canvas.index_mode?
  adjust_slide
end

#showing?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/rabbit/info-window.rb', line 58

def showing?
  !@window.nil?
end