Module: Iup::ButtonCallback

Included in:
Button, Canvas, Dial, Label, List, Scintilla, Text, Tree
Defined in:
lib/wrapped/common-attributes.rb

Overview

Standard callback method for when a mouse button is pressed or released.

Instance Method Summary collapse

Instance Method Details

#button_cb=(callback) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/wrapped/common-attributes.rb', line 21

def button_cb= callback
  unless callback.arity == 5
    raise ArgumentError, 'button_cb callback must take 5 arguments: (button, state, x, y, status)'
  end
  cb = Proc.new do |ih, b, p, x, y, status|
    callback.call b.chr, p, x, y, status
  end
  define_callback cb, 'BUTTON_CB', :iiiis_i
end