Class: SilkLayout::Layout::Box
- Inherits:
-
Object
- Object
- SilkLayout::Layout::Box
- Defined in:
- lib/silk_layout/layout/box.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#background_color ⇒ Object
Returns the value of attribute background_color.
-
#border ⇒ Object
Returns the value of attribute border.
-
#border_color ⇒ Object
Returns the value of attribute border_color.
-
#children ⇒ Object
Returns the value of attribute children.
-
#display ⇒ Object
Returns the value of attribute display.
-
#explicit_height ⇒ Object
Returns the value of attribute explicit_height.
-
#explicit_width ⇒ Object
Returns the value of attribute explicit_width.
-
#flex ⇒ Object
Returns the value of attribute flex.
-
#has_border ⇒ Object
Returns the value of attribute has_border.
-
#height ⇒ Object
Returns the value of attribute height.
-
#margin ⇒ Object
Returns the value of attribute margin.
-
#node ⇒ Object
Returns the value of attribute node.
-
#padding ⇒ Object
Returns the value of attribute padding.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #add_child(box) ⇒ Object
- #border_box_height ⇒ Object
- #border_box_width ⇒ Object
- #border_box_x ⇒ Object
- #border_box_y ⇒ Object
-
#initialize(node) ⇒ Box
constructor
A new instance of Box.
Constructor Details
#initialize(node) ⇒ Box
Returns a new instance of Box.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/silk_layout/layout/box.rb', line 23 def initialize(node) @node = node @children = [] @x = 0 @y = 0 @width = 0 @height = 0 @margin = {top: 0, right: 0, bottom: 0, left: 0} @padding = {top: 0, right: 0, bottom: 0, left: 0} @border = {top: 0, right: 0, bottom: 0, left: 0} @border_color = { top: nil, right: nil, bottom: nil, left: nil } @background_color = nil @explicit_width = false @explicit_height = false @flex = {} @display = nil end |
Instance Attribute Details
#background_color ⇒ Object
Returns the value of attribute background_color.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def background_color @background_color end |
#border ⇒ Object
Returns the value of attribute border.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def border @border end |
#border_color ⇒ Object
Returns the value of attribute border_color.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def border_color @border_color end |
#children ⇒ Object
Returns the value of attribute children.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def children @children end |
#display ⇒ Object
Returns the value of attribute display.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def display @display end |
#explicit_height ⇒ Object
Returns the value of attribute explicit_height.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def explicit_height @explicit_height end |
#explicit_width ⇒ Object
Returns the value of attribute explicit_width.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def explicit_width @explicit_width end |
#flex ⇒ Object
Returns the value of attribute flex.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def flex @flex end |
#has_border ⇒ Object
Returns the value of attribute has_border.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def has_border @has_border end |
#height ⇒ Object
Returns the value of attribute height.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def height @height end |
#margin ⇒ Object
Returns the value of attribute margin.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def margin @margin end |
#node ⇒ Object
Returns the value of attribute node.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def node @node end |
#padding ⇒ Object
Returns the value of attribute padding.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def padding @padding end |
#width ⇒ Object
Returns the value of attribute width.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
6 7 8 |
# File 'lib/silk_layout/layout/box.rb', line 6 def y @y end |
Instance Method Details
#add_child(box) ⇒ Object
49 50 51 |
# File 'lib/silk_layout/layout/box.rb', line 49 def add_child(box) @children << box end |
#border_box_height ⇒ Object
65 66 67 |
# File 'lib/silk_layout/layout/box.rb', line 65 def border_box_height height end |
#border_box_width ⇒ Object
61 62 63 |
# File 'lib/silk_layout/layout/box.rb', line 61 def border_box_width width end |
#border_box_x ⇒ Object
53 54 55 |
# File 'lib/silk_layout/layout/box.rb', line 53 def border_box_x x end |
#border_box_y ⇒ Object
57 58 59 |
# File 'lib/silk_layout/layout/box.rb', line 57 def border_box_y y end |