Class: Tk::Event::Data

Inherits:
Struct
  • Object
show all
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', :String,  :keycode           ],
  ['%m', :String,  :mode              ],
  ['%o', :String,  :override_redirect ],
  ['%p', :String,  :place             ],
  ['%s', :String,  :state             ],
  ['%t', :String,  :time              ],
  ['%w', :Integer, :width             ],
  ['%x', :Integer, :x                 ],
  ['%y', :Integer, :y                 ],
  ['%A', :String,  :unicode           ],
  ['%B', :Integer, :border_width      ],
  ['%D', :String,  :mousewheel_delta  ],
  ['%E', :String,  :send_event        ],
  ['%K', :String,  :keysym            ],
  ['%N', :String,  :keysym_number     ],
  ['%P', :String,  :property          ],
  ['%R', :Integer, :root              ],
  ['%S', :Integer, :subwindow         ],
  ['%T', :Integer, :type              ],
  ['%W', :String,  :window_path       ],
  ['%X', :Integer, :x_root            ],
  ['%Y', :Integer, :y_root            ],
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, sequence, *properties) ⇒ Data

Returns a new instance of Data.



44
45
46
47
48
49
50
51
52
53
# File 'lib/ffi-tk/event/data.rb', line 44

def initialize(id, sequence, *properties)
  super id, sequence

  PROPERTIES.each do |code, conv, name|
    property = properties.shift
    next if property == '??'
    converted = __send__(conv, property)
    self[name] = converted
  end
end

Instance Attribute Details

#border_widthObject

Returns the value of attribute border_width

Returns:

  • (Object)

    the current value of border_width



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def border_width
  @border_width
end

#buttonObject

Returns the value of attribute button

Returns:

  • (Object)

    the current value of button



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def button
  @button
end

#countObject

Returns the value of attribute count

Returns:

  • (Object)

    the current value of count



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def count
  @count
end

#detailObject

Returns the value of attribute detail

Returns:

  • (Object)

    the current value of detail



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def detail
  @detail
end

#focusObject

Returns the value of attribute focus

Returns:

  • (Object)

    the current value of focus



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def focus
  @focus
end

#heightObject

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def height
  @height
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def id
  @id
end

#keycodeObject

Returns the value of attribute keycode

Returns:

  • (Object)

    the current value of keycode



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def keycode
  @keycode
end

#keysymObject

Returns the value of attribute keysym

Returns:

  • (Object)

    the current value of keysym



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def keysym
  @keysym
end

#keysym_numberObject

Returns the value of attribute keysym_number

Returns:

  • (Object)

    the current value of keysym_number



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def keysym_number
  @keysym_number
end

#modeObject

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def mode
  @mode
end

#mousewheel_deltaObject

Returns the value of attribute mousewheel_delta

Returns:

  • (Object)

    the current value of mousewheel_delta



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def mousewheel_delta
  @mousewheel_delta
end

#override_redirectObject

Returns the value of attribute override_redirect

Returns:

  • (Object)

    the current value of override_redirect



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def override_redirect
  @override_redirect
end

#placeObject

Returns the value of attribute place

Returns:

  • (Object)

    the current value of place



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def place
  @place
end

#propertyObject

Returns the value of attribute property

Returns:

  • (Object)

    the current value of property



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def property
  @property
end

#rootObject

Returns the value of attribute root

Returns:

  • (Object)

    the current value of root



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def root
  @root
end

#send_eventObject

Returns the value of attribute send_event

Returns:

  • (Object)

    the current value of send_event



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def send_event
  @send_event
end

#sequenceObject

Returns the value of attribute sequence

Returns:

  • (Object)

    the current value of sequence



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def sequence
  @sequence
end

#serialObject

Returns the value of attribute serial

Returns:

  • (Object)

    the current value of serial



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def serial
  @serial
end

#stateObject

Returns the value of attribute state

Returns:

  • (Object)

    the current value of state



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def state
  @state
end

#subwindowObject

Returns the value of attribute subwindow

Returns:

  • (Object)

    the current value of subwindow



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def subwindow
  @subwindow
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def time
  @time
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def type
  @type
end

#unicodeObject

Returns the value of attribute unicode

Returns:

  • (Object)

    the current value of unicode



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def unicode
  @unicode
end

#widthObject

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def width
  @width
end

#windowObject

Returns the value of attribute window

Returns:

  • (Object)

    the current value of window



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def window
  @window
end

#window_pathObject

Returns the value of attribute window_path

Returns:

  • (Object)

    the current value of window_path



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def window_path
  @window_path
end

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def x
  @x
end

#x_rootObject

Returns the value of attribute x_root

Returns:

  • (Object)

    the current value of x_root



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def x_root
  @x_root
end

#yObject

Returns the value of attribute y

Returns:

  • (Object)

    the current value of y



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def y
  @y
end

#y_rootObject

Returns the value of attribute y_root

Returns:

  • (Object)

    the current value of y_root



3
4
5
# File 'lib/ffi-tk/event/data.rb', line 3

def y_root
  @y_root
end

Instance Method Details

#callObject



55
56
57
# File 'lib/ffi-tk/event/data.rb', line 55

def call
  Handler.invoke(id, self) if id
end