Class: Shoes::ListBox
- Inherits:
-
Common::UIElement
- Object
- Common::UIElement
- Shoes::ListBox
- Includes:
- Common::Changeable, Common::Focus, Common::State
- Defined in:
- shoes-core/lib/shoes/list_box.rb
Constant Summary collapse
- STYLES =
{ width: 200, height: 29, items: [""] }.freeze
Constants included from Common::State
Constants included from Common::Style
Common::Style::DEFAULT_STYLES, Common::Style::STYLE_GROUPS
Instance Attribute Summary
Attributes inherited from Common::UIElement
#app, #dimensions, #gui, #parent
Instance Method Summary collapse
- #after_initialize ⇒ Object
- #choose(item_or_hash = nil) ⇒ Object (also: #choose=)
- #handle_block(blk) ⇒ Object
- #items=(vanilla_array) ⇒ Object
- #text ⇒ Object
Methods included from Common::State
#enabled?, #state=, #update_from_state
Methods included from Common::Focus
Methods included from Common::Changeable
Methods included from Common::SafelyEvaluate
Methods inherited from Common::UIElement
#add_to_parent, #before_initialize, #create_backend, #create_dimensions, #initialize, #needs_rotate?, #painted?, #redraw_height, #redraw_left, #redraw_top, #redraw_width, #update_fill, #update_stroke
Methods included from Common::Style
#applicable_app_styles, #create_style_hash, included, #style, #style_init
Methods included from Common::Remove
Methods included from Common::Positioning
Methods included from Common::Visibility
#hidden?, #hidden_from_view?, #hide, #outside_parent_view?, #show, #toggle, #visible?
Methods included from Common::Inspect
Methods included from Common::Attachable
Constructor Details
This class inherits a constructor from Shoes::Common::UIElement
Instance Method Details
#after_initialize ⇒ Object
41 42 43 44 45 |
# File 'shoes-core/lib/shoes/list_box.rb', line 41 def after_initialize super proxy_array = Shoes::ProxyArray.new(items, @gui) @style[:items] = proxy_array end |
#choose(item_or_hash = nil) ⇒ Object Also known as: choose=
57 58 59 60 61 62 63 64 65 66 67 |
# File 'shoes-core/lib/shoes/list_box.rb', line 57 def choose(item_or_hash = nil) case item_or_hash when String style(choose: item_or_hash) @gui.choose item_or_hash when Hash style(choose: item_or_hash[:item]) @gui.choose item_or_hash[:item] end self end |
#handle_block(blk) ⇒ Object
37 38 39 |
# File 'shoes-core/lib/shoes/list_box.rb', line 37 def handle_block(blk) change(&blk) if blk end |
#items=(vanilla_array) ⇒ Object
47 48 49 50 51 |
# File 'shoes-core/lib/shoes/list_box.rb', line 47 def items=(vanilla_array) proxy_array = Shoes::ProxyArray.new(vanilla_array, @gui) style(items: proxy_array) @gui.update_items end |
#text ⇒ Object
53 54 55 |
# File 'shoes-core/lib/shoes/list_box.rb', line 53 def text @gui.text end |