module Rabbit::Element::SlideElement
Attributes
drawing_index[RW]
index[RW]
transition[RW]
Public Class Methods
new(title_element)
click to toggle source
Calls superclass method
Rabbit::Element::ContainerElement::new
# File lib/rabbit/element/slide-element.rb, line 10 def initialize(title_element) @index = -1 @default_waited_draw_procs = [] super(title_element) end
Public Instance Methods
clear_theme()
click to toggle source
Calls superclass method
Rabbit::Element::ContainerElement#clear_theme
# File lib/rabbit/element/slide-element.rb, line 53 def clear_theme super clear_waiting clear_transition @waited_draw_procs = @default_waited_draw_procs.dup end
clear_transition()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 49 def clear_transition @transition = nil end
clear_waiting()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 45 def clear_waiting @drawing_index = 0 end
draw(canvas, simulation=nil)
click to toggle source
Calls superclass method
# File lib/rabbit/element/slide-element.rb, line 28 def draw(canvas, simulation=nil) if simulation.nil? begin draw(canvas, true) draw(canvas, false) rescue StandardError, LoadError canvas.logger.warn($!) end else canvas.draw_slide(self, simulation) do compile(canvas, 0, 0, canvas.width, canvas.height) super(simulation) end run_gc unless simulation end end
first?(index=nil)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 60 def first?(index=nil) (index || @drawing_index).zero? end
flush()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 84 def flush @drawing_index = @waited_draw_procs.size end
last?(index=nil)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 64 def last?(index=nil) @waited_draw_procs.size == (index || @drawing_index) end
move_to_next()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 68 def move_to_next @drawing_index += 1 unless last? end
move_to_previous()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 72 def move_to_previous @drawing_index -= 1 unless first? end
register_default_wait_proc(target, exact=false, &proc)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 76 def register_default_wait_proc(target, exact=false, &proc) @default_waited_draw_procs << [target, exact, proc] end
register_wait_proc(target, exact=false, &proc)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 80 def register_wait_proc(target, exact=false, &proc) @waited_draw_procs << [target, exact, proc] end
size_ratio()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 24 def size_ratio self["size-ratio"] end
slide()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 16 def slide self end
title()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 20 def title @elements.first.text end
waited_draw_procs(target)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 88 def waited_draw_procs(target) procs = [] candidates = @waited_draw_procs[0, @drawing_index] candidates.each_with_index do |(t, exact, proc), i| next unless target == t if exact procs << proc if i == @drawing_index - 1 else procs << proc end end procs end
Private Instance Methods
run_gc()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 103 def run_gc lazy_gc_timout_msec = 1000 @compressed_gc_task_id ||= GLib::Timeout.add(lazy_gc_timout_msec) do GC.start @compressed_gc_task_id = nil GLib::Source::REMOVE end end