Class: Glimmer::SWT::CompositeProxy

Inherits:
WidgetProxy show all
Defined in:
lib/glimmer/swt/composite_proxy.rb

Constant Summary

Constants inherited from WidgetProxy

WidgetProxy::DEFAULT_INITIALIZERS, WidgetProxy::JS_KEY_CODE_TO_SWT_KEY_CODE_MAP, WidgetProxy::JS_LOCATION_TO_SWT_KEY_LOCATION_MAP, WidgetProxy::SWT_CURSOR_TO_CSS_CURSOR_MAP

Instance Attribute Summary

Attributes inherited from WidgetProxy

#args, #background, #children, #cursor, #disposed?, #enabled, #focus, #font, #foreground, #menu, #menu_requested, #menu_x, #menu_y, #parent, #path, #rendered

Instance Method Summary collapse

Methods inherited from WidgetProxy

#add_content_on_render, #add_css_class, #add_css_classes, #add_observer, #apply_property_type_converters, #attach, #build_dom, #can_handle_observation_request?, #clear_css_classes, #content, #content_on_render_blocks, #css_classes, #default_observation_request_to_event_mapping, #dialog_ancestor, #dispose, #dom_element, #effective_observation_request_to_event_mapping, #element, #event_handling_suspended?, #event_listener_proxies, for, #get_data, #handle_javascript_observation_request, #handle_observation_request, #has_style?, #id, #id=, #listener_dom_element, #listener_path, #listeners, #listeners_for, max_id_number_for, max_id_numbers, #method_missing, #name, next_id_number_for, #observation_request_to_event_mapping, #observation_requests, #parent_dom_element, #parent_path, #parents, #post_add_content, #post_dispose_child, #post_initialize_child, #print, #property_type_converters, #reattach, #remove_all_listeners, #remove_css_class, #remove_css_classes, #remove_event_listener_proxies, #render, reset_max_id_numbers!, #resume_event_handling, #selector, #set_attribute, #set_data, #set_focus, #shell, #skip_content_on_render_blocks?, #style_element, #suspend_event_handling, #swt_data, #swt_widget, underscored_widget_name, widget_class, widget_exists?, widget_handling_listener, #widget_property_listener_installers

Methods included from PropertyOwner

#attribute_getter, #attribute_setter, #get_attribute, #set_attribute

Constructor Details

#initialize(parent, args, block) ⇒ CompositeProxy

Returns a new instance of CompositeProxy.



28
29
30
31
# File 'lib/glimmer/swt/composite_proxy.rb', line 28

def initialize(parent, args, block)
  super(parent, args, block)
  @layout = default_layout
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::SWT::WidgetProxy

Instance Method Details

#background_imageObject

background image



67
68
69
# File 'lib/glimmer/swt/composite_proxy.rb', line 67

def background_image
  @background_image
end

#background_image=(value) ⇒ Object

background image is stretched by default



72
73
74
75
76
77
# File 'lib/glimmer/swt/composite_proxy.rb', line 72

def background_image=(value)
  @background_image = value
  dom_element.css('background-image', "url(#{background_image})")
  dom_element.css('background-repeat', 'no-repeat')
  dom_element.css('background-size', 'cover')
end

#default_layoutObject



33
34
35
# File 'lib/glimmer/swt/composite_proxy.rb', line 33

def default_layout
  GridLayoutProxy.new(self, [])
end

#domObject



37
38
39
40
41
42
43
44
# File 'lib/glimmer/swt/composite_proxy.rb', line 37

def dom
  div_id = id
  div_style = css
  div_class = name
  @dom ||= html {
    div(id: div_id, class: div_class, style: div_style)
  }.to_s
end

#get_layoutObject Also known as: getLayout



52
53
54
# File 'lib/glimmer/swt/composite_proxy.rb', line 52

def get_layout
  @layout
end

#layout=(the_layout) ⇒ Object Also known as: set_layout, setLayout



46
47
48
# File 'lib/glimmer/swt/composite_proxy.rb', line 46

def layout=(the_layout)
  @layout = the_layout
end

#layout​(changed = nil, all = nil) ⇒ Object



61
62
63
64
# File 'lib/glimmer/swt/composite_proxy.rb', line 61

def layout​(changed = nil, all = nil)
  # TODO implement layout(changed = nil, all = nil) just as per SWT API
  @layout&.layout(self, changed)
end

#pack(*args) ⇒ Object



57
58
59
# File 'lib/glimmer/swt/composite_proxy.rb', line 57

def pack(*args)
  # No Op (just a shim) TODO consider if it should be implemented
end