Sha256: ef401eadea38456066b1b94127fdebb6557b1f77c1ce6dee187bbb45d31208e8
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true class Shoes class InputBox < Common::UIElement include Common::Changeable include Common::State def before_initialize(styles, text) styles[:text] = text.to_s end def handle_block(blk) change(&blk) if blk update_visibility end def focus @gui.focus end def text @gui.text end def text=(value) style(text: value.to_s) @gui.text = value.to_s end def highlight_text(start_index, final_index) @gui.highlight_text(start_index, final_index) end def caret_to(index) @gui.caret_to(index) end def readonly? state.to_s == "readonly" end def update_from_state super @gui.readonly = readonly? end end class EditBox < InputBox style_with :change, :common_styles, :dimensions, :text, :state STYLES = { width: 200, height: 108, text: '' }.freeze end class EditLine < InputBox style_with :change, :common_styles, :dimensions, :text, :secret, :state STYLES = { width: 200, height: 28, text: '' }.freeze def secret? secret end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shoes-core-4.0.0.pre11 | lib/shoes/input_box.rb |
shoes-core-4.0.0.pre10 | lib/shoes/input_box.rb |
shoes-core-4.0.0.pre9 | lib/shoes/input_box.rb |