class Iup::Widget

This class provides shared functionality across all widgets in the IUP library.

Every widget has a handle, which is often a C pointer:

p Iup::Button.new.handle
# => #<FFI::Pointer address=0x0000647e530e6a80>

The Widget class provides attributes supporting appearance, including whether the widget is active, its size, font and color, and its position in the z-order list (where widgets are overlapping, and the top one is visible).

Some common callbacks are also found in this class, responding to:

Example

The following code creates a button with large red text, which reports when the mouse moves over the button and any key is pressed:

Iup::mainloop do
  btn = Iup::Button.new("hello") do
    it.fgcolor = "255 0 0"
    it.font = "Times, Bold 18"
    it.enterwindow_cb = ->{ puts "on button" }
    it.leavewindow_cb = ->{ puts "off button" }
    it.k_any = ->(k){ puts "Key #{k.chr}" }
  end

  Iup::Dialog.new(btn).show
end