class Glimmer::SWT::FillLayoutProxy
Constants
- STYLE
Attributes
margin_height[R]
margin_width[R]
spacing[R]
type[R]
Public Class Methods
new(parent, args)
click to toggle source
Calls superclass method
# 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
Public Instance Methods
horizontal?()
click to toggle source
# File lib/glimmer/swt/fill_layout_proxy.rb, line 38 def horizontal? @type == :horizontal end
margin_height=(pixels)
click to toggle source
# File lib/glimmer/swt/fill_layout_proxy.rb, line 61 def margin_height=(pixels) @margin_height = pixels @parent.dom_element.css('padding-top', @margin_height) @parent.dom_element.css('padding-bottom', @margin_height) end
margin_width=(pixels)
click to toggle source
# File lib/glimmer/swt/fill_layout_proxy.rb, line 54 def margin_width=(pixels) @margin_width = pixels # Using padding for width since margin-right isn't getting respected with width 100% @parent.dom_element.css('padding-left', @margin_width) @parent.dom_element.css('padding-right', @margin_width) end
spacing=(spacing)
click to toggle source
# File lib/glimmer/swt/fill_layout_proxy.rb, line 67 def spacing=(spacing) @spacing = spacing.to_i # TODO implement changes to accomodate layout_data in the future @parent.style_element.html css { s("##{@parent.id} > *") { if horizontal? margin_right "#{@spacing}px" elsif vertical? margin_bottom "#{@spacing}px" end } s("##{@parent.id} > :last-child") { if horizontal? margin_right 0 elsif vertical? margin_bottom 0 end } }.to_s end
type=(value)
click to toggle source
# File lib/glimmer/swt/fill_layout_proxy.rb, line 46 def type=(value) @parent.dom_element.remove_class(horizontal? ? 'fill-layout-horizontal' : 'fill-layout-vertical') @parent.css_classes.delete(horizontal? ? 'fill-layout-horizontal' : 'fill-layout-vertical') @type = value @parent.dom_element.add_class(horizontal? ? 'fill-layout-horizontal' : 'fill-layout-vertical') @parent.css_classes << horizontal? ? 'fill-layout-horizontal' : 'fill-layout-vertical' end
vertical?()
click to toggle source
# File lib/glimmer/swt/fill_layout_proxy.rb, line 42 def vertical? @type == :vertical end