Class: Glimmer::SWT::FillLayoutProxy

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

Constant Summary collapse

STYLE =
<<~CSS
  .fill-layout {
    display: flex;
  }
  
  .fill-layout > * {
    width: 100% !important;
    height: 100% !important;
  }
  
  .fill-layout-horizontal {
    flex-direction: row;
  }
  
  .fill-layout-vertical {
    flex-direction: column;
  }
CSS

Instance Attribute Summary collapse

Attributes inherited from LayoutProxy

#args, #parent

Instance Method Summary collapse

Methods inherited from LayoutProxy

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

Methods included from PropertyOwner

#attribute_getter, #attribute_setter, #get_attribute, #set_attribute

Constructor Details

#initialize(parent, args) ⇒ FillLayoutProxy

Returns a new instance of FillLayoutProxy.



29
30
31
32
33
34
35
36
# File 'lib/glimmer/swt/fill_layout_proxy.rb', line 29

def initialize(parent, args)
  super(parent, args)
  self.type = @args.first || :horizontal
  self.margin_width = 15
  self.margin_height = 15
  @parent.css_classes << 'fill-layout'
  @parent.dom_element.add_class('fill-layout')
end

Instance Attribute Details

#margin_heightObject

Returns the value of attribute margin_height.



27
28
29
# File 'lib/glimmer/swt/fill_layout_proxy.rb', line 27

def margin_height
  @margin_height
end

#margin_widthObject

Returns the value of attribute margin_width.



27
28
29
# File 'lib/glimmer/swt/fill_layout_proxy.rb', line 27

def margin_width
  @margin_width
end

#spacingObject

Returns the value of attribute spacing.



27
28
29
# File 'lib/glimmer/swt/fill_layout_proxy.rb', line 27

def spacing
  @spacing
end

#typeObject

Returns the value of attribute type.



27
28
29
# File 'lib/glimmer/swt/fill_layout_proxy.rb', line 27

def type
  @type
end

Instance Method Details

#horizontal?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/glimmer/swt/fill_layout_proxy.rb', line 38

def horizontal?
  @type == :horizontal
end

#vertical?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/glimmer/swt/fill_layout_proxy.rb', line 42

def vertical?
  @type == :vertical
end