Class: Glimmer::SWT::RowLayoutProxy

Inherits:
LayoutProxy show all
Includes:
Glimmer
Defined in:
lib/glimmer/swt/row_layout_proxy.rb

Constant Summary collapse

STYLE =
".row-layout {\n  display: flex;\n  align-items: flex-start;\n}\n          \n.row-layout-pack-false {\n  align-items: stretch;\n}\n  \n.row-layout-center.row-layout-horizontal > * {\n  margin-top: auto;\n  margin-bottom: auto;\n}\n          \n.row-layout-center.row-layout-vertical > * {\n  margin-left: auto;\n  margin-right: auto;\n}\n  \n.row-layout-wrap {\n  flex-wrap: wrap;\n}\n          \n.row-layout-justify {\n  justify-content: space-around;\n}\n          \n.row-layout-horizontal {\n  flex-direction: row;\n}\n  \n.row-layout-horizontal.row-layout-pack-false {\n  flex-direction: unset;\n}\n  \n.row-layout-vertical {\n  flex-direction: column;\n}\n  \n.row-layout-vertical.row-layout-pack {\n  flex-direction: none;\n}\n"

Instance Attribute Summary collapse

Attributes inherited from LayoutProxy

#args, #parent

Instance Method Summary collapse

Methods inherited from LayoutProxy

#css_class, for, layout_class, layout_exists?, #layout​

Methods included from PropertyOwner

#attribute_getter, #attribute_setter, #get_attribute, #set_attribute

Constructor Details

#initialize(parent, args) ⇒ RowLayoutProxy

Returns a new instance of RowLayoutProxy.



55
56
57
58
59
60
61
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 55

def initialize(parent, args)
  super(parent, args)
  @parent.dom_element.add_class('row-layout')
  self.type = args.first || :horizontal
  self.pack = true
  self.wrap = true
end

Instance Attribute Details

#centerObject

Returns the value of attribute center.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def center
  @center
end

#justifyObject

Returns the value of attribute justify.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def justify
  @justify
end

#margin_bottomObject

Returns the value of attribute margin_bottom.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def margin_bottom
  @margin_bottom
end

#margin_heightObject

Returns the value of attribute margin_height.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def margin_height
  @margin_height
end

#margin_leftObject

Returns the value of attribute margin_left.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def margin_left
  @margin_left
end

#margin_rightObject

Returns the value of attribute margin_right.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def margin_right
  @margin_right
end

#margin_topObject

Returns the value of attribute margin_top.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def margin_top
  @margin_top
end

#margin_widthObject

Returns the value of attribute margin_width.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def margin_width
  @margin_width
end

#packObject

Returns the value of attribute pack.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def pack
  @pack
end

#spacingObject

Returns the value of attribute spacing.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def spacing
  @spacing
end

#typeObject

Returns the value of attribute type.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def type
  @type
end

#wrapObject

Returns the value of attribute wrap.



53
54
55
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 53

def wrap
  @wrap
end

Instance Method Details

#dom(widget_dom) ⇒ Object



76
77
78
79
80
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 76

def dom(widget_dom)
  dom_result = widget_dom
  dom_result += '<br />' if vertical? && @pack
  dom_result
end

#fillObject



91
92
93
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 91

def fill
  !pack
end

#fill=(value) ⇒ Object



95
96
97
98
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 95

def fill=(value)
  # TODO verify this is a correct implementation and interpretation of RowLayout in SWT
  self.pack = !value
end

#horizontal?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 68

def horizontal?
  @type == :horizontal
end

#vertical?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 72

def vertical?
  @type == :vertical
end