lib/ffi-tk/event/data.rb in ffi-tk-2010.03 vs lib/ffi-tk/event/data.rb in ffi-tk-2010.06

- old
+ new

@@ -1,13 +1,13 @@ module Tk module Event Data = Struct.new( - :id, :sequence, :border_width, :button, :count, :detail, :focus, :height, + :id, :pattern, :border_width, :button, :count, :detail, :focus, :height, :keycode, :keysym, :keysym_number, :mode, :mousewheel_delta, - :override_redirect, :place, :property, :root, :send_event, :serial, :state, - :subwindow, :time, :type, :unicode, :width, :window, :window_path, :x, - :x_root, :y, :y_root + :override_redirect, :place, :property, :root, :send_event, :serial, + :state, :subwindow, :time, :type, :unicode, :width, :window, + :window_path, :x, :x_root, :y, :y_root ) class Data PROPERTIES = [ ['%#', :Integer, :serial ], @@ -39,17 +39,18 @@ ['%W', :String, :window_path ], ['%X', :Integer, :x_root ], ['%Y', :Integer, :y_root ], ] - def initialize(id, sequence, *properties) - super id, sequence + def initialize(id, pattern, *properties) + super id, pattern PROPERTIES.each do |code, conv, name| value = properties.shift - converted = __send__(conv, value) + converted = String(value) next if converted == '??' + converted = __send__(conv, value) self[name] = converted end end def call @@ -62,11 +63,11 @@ original = {} members.each do |name| value = self[name] case name - when :id, :sequence, :border_width, :button, :count, :focus, :height, + when :id, :pattern, :border_width, :button, :count, :focus, :height, :keycode, :keysym, :keysym_number, :mode, :mousewheel_delta, :override_redirect, :place, :property, :root, :send_event, :subwindow, :type, :unicode, :width, :window, :window_path when :x_root original[:rootx] = value @@ -82,9 +83,14 @@ Event.generate(widget, virtual, original.merge(changes)) end def widget Tk.widgets[window_path] + end + + def sequence + Kernel.warn("#{self.class}.sequence deprecated, use #{self.class}.pattern") + pattern end end end end