Class: Fidgit::List
Defined Under Namespace
Classes: Item
Constant Summary
Constant Summary
Constants inherited from Composite
Constants inherited from Element
Element::DEFAULT_SCHEMA_FILE, Element::VALID_ALIGN_H, Element::VALID_ALIGN_V
Instance Attribute Summary
Attributes inherited from Packer
Attributes inherited from Element
#align_h, #align_v, #background_color, #border_thickness, #font, #padding_bottom, #padding_left, #padding_right, #padding_top, #parent, #tip, #z
Instance Method Summary (collapse)
- - (Object) clear
-
- (List) initialize(options = {})
constructor
A new instance of List.
- - (Object) item(text, value, options = {}, &block)
- - (Object) size
Methods inherited from Container
#add, #button, #color_picker, #color_well, #combo_box, #file_browser, #grid, #group, #hit_element, #horizontal, #image_frame, #insert, #label, #list, #radio_button, #remove, #scroll_area, #scroll_window, #slider, #text_area, #to_s, #toggle_button, #update, #vertical, #write_tree, #x=, #y=
Methods inherited from Element
#default, #drag?, #draw, #draw_frame, #draw_rect, #enabled=, #enabled?, #height, #height=, #hit?, #max_height, #max_width, #min_height, #min_width, new, original_new, #outer_height, #outer_width, #recalc, schema, #to_s, #update, #width, #width=, #with, #x, #x=, #y, #y=
Methods included from Event
#events, included, new_event_handlers, #publish, #subscribe, #unsubscribe
Constructor Details
- (List) initialize(options = {})
A new instance of List
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fidgit/elements/list.rb', line 13 def initialize( = {}) = { background_color: default(:background_color), border_color: default(:border_color), }.merge! super group do subscribe :changed do |sender, value| publish :changed, value end @items = vertical spacing: 0 end end |
Instance Method Details
- (Object) clear
11 |
# File 'lib/fidgit/elements/list.rb', line 11 def clear; @items.clear; end |
- (Object) item(text, value, options = {}, &block)
32 33 34 |
# File 'lib/fidgit/elements/list.rb', line 32 def item(text, value, = {}, &block) Item.new(text, value, { parent: @items }.merge!(), &block) end |
- (Object) size
10 |
# File 'lib/fidgit/elements/list.rb', line 10 def size; @items.size; end |