Class: Fidgit::Grid
- Defined in:
- lib/fidgit/elements/grid.rb
Overview
A vertically aligned element packing container.
Direct Known Subclasses
Constant Summary
Constants inherited from Element
Element::DEFAULT_SCHEMA_FILE, Element::VALID_ALIGN_H, Element::VALID_ALIGN_V
Instance Attribute Summary collapse
- #num_columns ⇒ Integer readonly
- #num_rows ⇒ Integer readonly
- #type ⇒ Symbol readonly
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
-
#initialize(options = {}) ⇒ Grid
constructor
A new instance of Grid.
Methods inherited from Container
#add, #button, #clear, #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
#initialize(options = {}) ⇒ Grid
Currently only supports num_columns
mode (not num_rows
).
Returns a new instance of Grid.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fidgit/elements/grid.rb', line 23 def initialize( = {}) = { cell_border_color: default(:cell_border_color), cell_background_color: default(:cell_background_color), cell_border_thickness: default(:cell_border_thickness), }.merge! @num_columns = [:num_columns] @num_rows = [:num_rows] raise ArgumentError, "options :num_rows and :num_columns are not compatible" if @num_rows and @num_columns @cell_border_color = [:cell_border_color].dup @cell_border_thickness = [:cell_border_thickness] @cell_background_color = [:cell_background_color].dup @type = @num_rows ? :fixed_rows : :fixed_columns super end |
Instance Attribute Details
#num_columns ⇒ Integer (readonly)
14 15 16 |
# File 'lib/fidgit/elements/grid.rb', line 14 def num_columns @num_columns end |
#num_rows ⇒ Integer (readonly)
11 12 13 |
# File 'lib/fidgit/elements/grid.rb', line 11 def num_rows @num_rows end |
#type ⇒ Symbol (readonly)
8 9 10 |
# File 'lib/fidgit/elements/grid.rb', line 8 def type @type end |