Class: Tk::Event::Data
- Defined in:
- lib/ffi-tk/event/data.rb,
lib/ffi-tk/event/data.rb
Constant Summary collapse
- PROPERTIES =
[ ['%#', :Integer, :serial ], ['%b', :Integer, :button ], ['%c', :Integer, :count ], ['%d', :String, :detail ], ['%f', :String, :focus ], ['%h', :Integer, :height ], ['%i', :String, :window ], ['%k', :Integer, :keycode ], ['%m', :String, :mode ], ['%o', :String, :override_redirect ], ['%p', :String, :place ], ['%s', :String, :state ], ['%t', :Integer, :time ], ['%w', :Integer, :width ], ['%x', :Integer, :x ], ['%y', :Integer, :y ], ['%A', :String, :unicode ], ['%B', :Integer, :border_width ], ['%D', :Integer, :mousewheel_delta ], ['%E', :Integer, :send_event ], ['%K', :String, :keysym ], ['%N', :Integer, :keysym_number ], ['%P', :String, :property ], ['%R', :String, :root ], ['%S', :String, :subwindow ], ['%T', :Integer, :type ], ['%W', :String, :window_path ], ['%X', :Integer, :x_root ], ['%Y', :Integer, :y_root ], ]
Instance Attribute Summary collapse
-
#border_width ⇒ Object
Returns the value of attribute border_width.
-
#button ⇒ Object
Returns the value of attribute button.
-
#count ⇒ Object
Returns the value of attribute count.
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#focus ⇒ Object
Returns the value of attribute focus.
-
#height ⇒ Object
Returns the value of attribute height.
-
#id ⇒ Object
Returns the value of attribute id.
-
#keycode ⇒ Object
Returns the value of attribute keycode.
-
#keysym ⇒ Object
Returns the value of attribute keysym.
-
#keysym_number ⇒ Object
Returns the value of attribute keysym_number.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#mousewheel_delta ⇒ Object
Returns the value of attribute mousewheel_delta.
-
#override_redirect ⇒ Object
Returns the value of attribute override_redirect.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#place ⇒ Object
Returns the value of attribute place.
-
#property ⇒ Object
Returns the value of attribute property.
-
#root ⇒ Object
Returns the value of attribute root.
-
#send_event ⇒ Object
Returns the value of attribute send_event.
-
#serial ⇒ Object
Returns the value of attribute serial.
-
#state ⇒ Object
Returns the value of attribute state.
-
#subwindow ⇒ Object
Returns the value of attribute subwindow.
-
#time ⇒ Object
Returns the value of attribute time.
-
#type ⇒ Object
Returns the value of attribute type.
-
#unicode ⇒ Object
Returns the value of attribute unicode.
-
#width ⇒ Object
Returns the value of attribute width.
-
#window ⇒ Object
Returns the value of attribute window.
-
#window_path ⇒ Object
Returns the value of attribute window_path.
-
#x ⇒ Object
Returns the value of attribute x.
-
#x_root ⇒ Object
Returns the value of attribute x_root.
-
#y ⇒ Object
Returns the value of attribute y.
-
#y_root ⇒ Object
Returns the value of attribute y_root.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(id, pattern, *properties) ⇒ Data
constructor
A new instance of Data.
-
#resend(widget, virtual, changes = {}) ⇒ Object
Try to resend the event with as much information preserved as possible.
- #sequence ⇒ Object
- #widget ⇒ Object
Constructor Details
#initialize(id, pattern, *properties) ⇒ Data
Returns a new instance of Data.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ffi-tk/event/data.rb', line 44 def initialize(id, pattern, *properties) super id, pattern PROPERTIES.each do |code, conv, name| value = properties.shift converted = String(value) next if converted == '??' converted = __send__(conv, value) self[name] = converted end end |
Instance Attribute Details
#border_width ⇒ Object
Returns the value of attribute border_width
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def border_width @border_width end |
#button ⇒ Object
Returns the value of attribute button
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def @button end |
#count ⇒ Object
Returns the value of attribute count
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def count @count end |
#detail ⇒ Object
Returns the value of attribute detail
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def detail @detail end |
#focus ⇒ Object
Returns the value of attribute focus
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def focus @focus end |
#height ⇒ Object
Returns the value of attribute height
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def height @height end |
#id ⇒ Object
Returns the value of attribute id
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def id @id end |
#keycode ⇒ Object
Returns the value of attribute keycode
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def keycode @keycode end |
#keysym ⇒ Object
Returns the value of attribute keysym
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def keysym @keysym end |
#keysym_number ⇒ Object
Returns the value of attribute keysym_number
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def keysym_number @keysym_number end |
#mode ⇒ Object
Returns the value of attribute mode
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def mode @mode end |
#mousewheel_delta ⇒ Object
Returns the value of attribute mousewheel_delta
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def mousewheel_delta @mousewheel_delta end |
#override_redirect ⇒ Object
Returns the value of attribute override_redirect
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def override_redirect @override_redirect end |
#pattern ⇒ Object
Returns the value of attribute pattern
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def pattern @pattern end |
#place ⇒ Object
Returns the value of attribute place
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def place @place end |
#property ⇒ Object
Returns the value of attribute property
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def property @property end |
#root ⇒ Object
Returns the value of attribute root
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def root @root end |
#send_event ⇒ Object
Returns the value of attribute send_event
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def send_event @send_event end |
#serial ⇒ Object
Returns the value of attribute serial
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def serial @serial end |
#state ⇒ Object
Returns the value of attribute state
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def state @state end |
#subwindow ⇒ Object
Returns the value of attribute subwindow
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def subwindow @subwindow end |
#time ⇒ Object
Returns the value of attribute time
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def time @time end |
#type ⇒ Object
Returns the value of attribute type
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def type @type end |
#unicode ⇒ Object
Returns the value of attribute unicode
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def unicode @unicode end |
#width ⇒ Object
Returns the value of attribute width
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def width @width end |
#window ⇒ Object
Returns the value of attribute window
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def window @window end |
#window_path ⇒ Object
Returns the value of attribute window_path
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def window_path @window_path end |
#x ⇒ Object
Returns the value of attribute x
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def x @x end |
#x_root ⇒ Object
Returns the value of attribute x_root
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def x_root @x_root end |
#y ⇒ Object
Returns the value of attribute y
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def y @y end |
#y_root ⇒ Object
Returns the value of attribute y_root
3 4 5 |
# File 'lib/ffi-tk/event/data.rb', line 3 def y_root @y_root end |
Instance Method Details
#call ⇒ Object
56 57 58 |
# File 'lib/ffi-tk/event/data.rb', line 56 def call Handler.invoke(id, self) if id end |
#resend(widget, virtual, changes = {}) ⇒ Object
Try to resend the event with as much information preserved as possible. Unfortunately that doesn’t seem to be easy.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/ffi-tk/event/data.rb', line 62 def resend(, virtual, changes = {}) original = {} members.each do |name| value = self[name] case name 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 when :y_root original[:rooty] = value when :detail original[name] = value if value else original[name] = value end end Event.generate(, virtual, original.merge(changes)) end |
#sequence ⇒ Object
90 91 92 93 |
# File 'lib/ffi-tk/event/data.rb', line 90 def sequence Kernel.warn("#{self.class}.sequence deprecated, use #{self.class}.pattern") pattern end |