thomthom/SKUI — pull request #80 by GWydouw (2014-01-26 16:09:46+00:00)
Title: Added SKUI::ImageButton

Image button with images for default and active state (mouse down)

Methods:
ImageButton.file=
ImageButton.activestatefile=

Event:
ImageButton.on( :click ) {|control| ... }

example toggle image button:
@@active_toggle = false
img_active = SKUI::ImageButton.new(css_path + "icons/off_red.png",css_path + "/icons/off_red_pushed.png")
img_active.on( :click ) {
if @@active_toggle == false
img_active.file = (css_path + "/icons/on_green.png")
img_active.activestatefile = (css_path + "/icons/on_green_pushed.png")
@@active_toggle = true
else
img_active.file = (css_path + "/icons/off_red.png")
img_active.activestatefile = (css_path + "/icons/off_red_pushed.png")
@@active_toggle = false
end
}
@@skui.add_control(img_active)