Sha256: c0a2a515eda57030e9a4f1fc5913e6d67820ea59479f826548e6f2152d1ffcec
Contents?: true
Size: 777 Bytes
Versions: 4
Compression:
Stored size: 777 Bytes
Contents
module Nuklear module UI class Checkbox < Nuklear::UI::Base attr_accessor :text def initialize(text, checked: false, enabled: true, &block) super enabled: enabled @text = text @checked = checked on(true) { @checked = true } on(false) { @checked = false } if block_given? on true, &block on false, &block end end def checked? @checked end def checked=(checked) @checked = checked @last_event = checked end alias selected? checked? alias selected= checked= def to_command [ :ui_checkbox, text, checked? ] end def result(event, context) trigger event end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nuklear-0.1.3 | lib/nuklear/ui/checkbox.rb |
nuklear-0.1.2 | lib/nuklear/ui/checkbox.rb |
nuklear-0.1.1 | lib/nuklear/ui/checkbox.rb |
nuklear-0.1.0 | lib/nuklear/ui/checkbox.rb |