Gtk::EventBox
# File gtk2/sample/misc/mouse-gesture.rb, line 139 def initialize(conf={}) super() set_visible_window(false) conf ||= {} @back_rgba = conf[:back_rgba] || DEFAULT_BACK_RGBA @line_rgba = conf[:line_rgba] || DEFAULT_LINE_RGBA @next_rgba = conf[:next_rgba] || DEFAULT_NEXT_RGBA @current_rgba = conf[:current_rgba] || DEFAULT_CURRENT_RGBA @processor = GestureProcessor.new(conf[:threshold], conf[:skew_threshold_angle]) @actions = [] set_expose_event set_motion_notify_event set_button_release_event end
# File gtk2/sample/misc/mouse-gesture.rb, line 155 def add_action(sequence, action=Proc.new) invalid_motion = sequence.find do |motion| not @processor.available_motion?(motion) end raise "invalid motion: #{invalid_motion}" if invalid_motion @actions << [sequence, action] end
# File gtk2/sample/misc/mouse-gesture.rb, line 163 def start(widget, button, x, y, base_x, base_y) Gtk.grab_add(self) @widget = widget @button = button @processor.start(x, y) @base_x = base_x @base_y = base_y @cr = window.create_cairo_context @cr.set_source_rgba(@line_rgba) @cr.move_to(x, y) end
Generated with the Darkfish Rdoc Generator 2.