Sha256: d8499b9c0c4903bc275c584bd357d21a20e7c22df9ce9063b167c9d6b22b8e66
Contents?: true
Size: 1.38 KB
Versions: 7
Compression:
Stored size: 1.38 KB
Contents
module CyberarmEngine class CheckBox < Flow def initialize(text, options, block = nil) super({}, block = nil) options[:toggled] = options[:checked] @toggle_button = ToggleButton.new(options) @label = Label.new(text, options) define_label_singletons add(@toggle_button) add(@label) @width = @toggle_button.width + @label.width @height = @toggle_button.height + @label.height end def text=(text) @label.text = text recalculate end def define_label_singletons @label.define_singleton_method(:_toggle_button) do |button| @_toggle_button = button end @label._toggle_button(@toggle_button) @label.define_singleton_method(:holding_left_mouse_button) do |sender, x, y| @_toggle_button.left_mouse_button(sender, x, y) end @label.define_singleton_method(:released_left_mouse_button) do |sender, x, y| @_toggle_button.released_left_mouse_button(sender, x, y) end @label.define_singleton_method(:clicked_left_mouse_button) do |sender, x, y| @_toggle_button.clicked_left_mouse_button(sender, x, y) end @label.define_singleton_method(:enter) do |sender| @_toggle_button.enter(sender) end @label.define_singleton_method(:leave) do |sender| @_toggle_button.leave(sender) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems