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-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.



47
48
49
50
51
52
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 47

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

Instance Attribute Details

#centerObject

Returns the value of attribute center.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def center
  @center
end

#fillObject

Returns the value of attribute fill.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def fill
  @fill
end

#margin_bottomObject

Returns the value of attribute margin_bottom.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def margin_bottom
  @margin_bottom
end

#margin_heightObject

Returns the value of attribute margin_height.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def margin_height
  @margin_height
end

#margin_leftObject

Returns the value of attribute margin_left.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def margin_left
  @margin_left
end

#margin_rightObject

Returns the value of attribute margin_right.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def margin_right
  @margin_right
end

#margin_topObject

Returns the value of attribute margin_top.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def margin_top
  @margin_top
end

#margin_widthObject

Returns the value of attribute margin_width.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def margin_width
  @margin_width
end

#packObject

Returns the value of attribute pack.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def pack
  @pack
end

#spacingObject

Returns the value of attribute spacing.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def spacing
  @spacing
end

#typeObject

Returns the value of attribute type.



45
46
47
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 45

def type
  @type
end

Instance Method Details

#dom(widget_dom) ⇒ Object



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

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

#horizontal?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 59

def horizontal?
  @type == :horizontal
end

#vertical?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/glimmer/swt/row_layout_proxy.rb', line 63

def vertical?
  @type == :vertical
end