Class: Glimmer::SWT::TabItemProxy

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

Overview

Proxy for org.eclipse.swt.widgets.TabItem

Functions differently from other widget proxies.

Glimmer instantiates an SWT Composite alongside the SWT TabItem and returns it for ‘#swt_widget` to allow adding widgets into it.

In order to get the SWT TabItem object, one must call ‘#swt_tab_item`.

Behind the scenes, this creates a tab item widget proxy separately from a composite that is set as the control of the tab item and ‘#swt_widget`.

In order to retrieve the tab item widget proxy, one must call ‘#widget_proxy`

Follows the Proxy Design Pattern

Direct Known Subclasses

CTabItemProxy

Constant Summary collapse

ATTRIBUTES =
%w[text image tool_tip_text]

Constants inherited from WidgetProxy

WidgetProxy::DEFAULT_INITIALIZERS, WidgetProxy::DEFAULT_STYLES, WidgetProxy::KEYWORD_ALIASES

Instance Attribute Summary collapse

Attributes inherited from WidgetProxy

#drag_source_proxy, #drag_source_style, #drag_source_transfer, #drop_target_proxy, #drop_target_transfer, #finished_add_content, #parent_proxy, #swt_widget

Attributes included from Custom::Drawable

#image_double_buffered, #requires_shape_disposal

Instance Method Summary collapse

Methods inherited from WidgetProxy

#add_observer, #async_exec, #auto_exec, #can_add_observer?, #can_handle_drag_observation_request?, #can_handle_drop_observation_request?, #can_handle_observation_request?, #content, create, #disposed?, #ensure_drag_source_proxy, #ensure_drop_target_proxy, #extract_args, #finish_add_content!, flyweight_swt_widget_classes, #handle_observation_request, #has_style?, #height, #method_missing, #pack_same_size, #post_add_content, #post_initialize_child, #proxy_source_object, #remove_observer, #respond_to?, swt_widget_class_for, swt_widget_class_manual_entries, #sync_exec, #timer_exec, underscored_widget_name, widget_exists?, #widget_property_listener_installers, widget_proxy_class, #width, #x, #y

Methods included from Custom::Drawable

#add_shape, #clear_shapes, #deregister_shape_painting, #expanded_shapes, #image_buffered_shapes, #paint_pixel_by_pixel, #setup_shape_painting, #shape_at_location, #shapes, #swt_drawable

Methods included from ProxyProperties

#has_attribute_getter?, #has_attribute_setter?, #method_missing, #proxy_source_object, #respond_to?

Methods included from Properties

attribute_getter, #attribute_getter, attribute_setter, #attribute_setter, normalized_attribute, #normalized_attribute, ruby_attribute_getter, #ruby_attribute_setter, ruby_attribute_setter

Methods included from Packages

included

Constructor Details

#initialize(parent, style, &contents) ⇒ TabItemProxy

Returns a new instance of TabItemProxy.



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

def initialize(parent, style, &contents)
  super("composite", parent, style, &contents)
  keyword = self.class.name.split('::').last.underscore.sub('_proxy', '')
  @widget_proxy = SWT::WidgetProxy.new(keyword, parent, style)
  @swt_tab_item = @widget_proxy.swt_widget
  @swt_tab_item.control = swt_widget
end

Dynamic Method Handling

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

Instance Attribute Details

#swt_tab_itemObject (readonly)

Returns the value of attribute swt_tab_item.



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

def swt_tab_item
  @swt_tab_item
end

#widget_proxyObject (readonly)

Returns the value of attribute widget_proxy.



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

def widget_proxy
  @widget_proxy
end

Instance Method Details

#attributesObject



55
56
57
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 55

def attributes
  ATTRIBUTES
end

#disposeObject



81
82
83
84
85
86
87
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 81

def dispose
  auto_exec do
    swt_tab_item.setControl(nil)
    swt_widget.dispose
    swt_tab_item.dispose
  end
end

#get_attribute(attribute_name) ⇒ Object



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

def get_attribute(attribute_name)
  attribute_name = attribute_name.to_s
  if attributes.include?(attribute_name)
    widget_proxy.get_attribute(attribute_name)
  else
    super(attribute_name)
  end
end

#has_attribute?(attribute_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


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

def has_attribute?(attribute_name, *args)
  attributes.include?(attribute_name.to_s) || super(attribute_name, *args)
end

#set_attribute(attribute_name, *args) ⇒ Object



63
64
65
66
67
68
69
70
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 63

def set_attribute(attribute_name, *args)
  attribute_name = attribute_name.to_s
  if attributes.include?(attribute_name)
    widget_proxy.set_attribute(attribute_name, *args)
  else
    super(attribute_name, *args)
  end
end