Class: Glimmer::SWT::TabItemProxy
- Inherits:
-
WidgetProxy
- Object
- WidgetProxy
- Glimmer::SWT::TabItemProxy
- 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
Constant Summary
Constants inherited from WidgetProxy
WidgetProxy::DEFAULT_INITIALIZERS, WidgetProxy::DEFAULT_STYLES, WidgetProxy::KEYWORD_ALIASES
Instance Attribute Summary collapse
-
#swt_tab_item ⇒ Object
readonly
Returns the value of attribute swt_tab_item.
-
#widget_proxy ⇒ Object
readonly
Returns the value of attribute widget_proxy.
Attributes inherited from WidgetProxy
#drag_source_proxy, #drag_source_style, #drag_source_transfer, #drop_target_proxy, #drop_target_transfer, #parent_proxy, #swt_widget
Instance Method Summary collapse
- #dispose ⇒ Object
- #get_attribute(attribute_name) ⇒ Object
- #has_attribute?(attribute_name, *args) ⇒ Boolean
-
#initialize(parent, style, &contents) ⇒ TabItemProxy
constructor
A new instance of TabItemProxy.
- #set_attribute(attribute_name, *args) ⇒ Object
Methods inherited from WidgetProxy
#add_observer, #async_exec, #can_add_observer?, #can_handle_drag_observation_request?, #can_handle_drop_observation_request?, #can_handle_observation_request?, #content, create, #ensure_drag_source_proxy, #ensure_drop_target_proxy, #extract_args, #handle_observation_request, #has_style?, #method_missing, #pack_same_size, #post_add_content, #post_initialize_child, #remove_observer, #respond_to?, swt_widget_class_for, #sync_exec, underscored_widget_name, widget_exists?, #widget_property_listener_installers, widget_proxy_class
Methods included from Packages
Constructor Details
#initialize(parent, style, &contents) ⇒ TabItemProxy
Returns a new instance of TabItemProxy.
46 47 48 49 50 51 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 46 def initialize(parent, style, &contents) super("composite", parent, style, &contents) @widget_proxy = SWT::WidgetProxy.new('tab_item', parent, style) @swt_tab_item = @widget_proxy. @swt_tab_item.control = 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_item ⇒ Object (readonly)
Returns the value of attribute swt_tab_item.
44 45 46 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 44 def swt_tab_item @swt_tab_item end |
#widget_proxy ⇒ Object (readonly)
Returns the value of attribute widget_proxy.
44 45 46 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 44 def @widget_proxy end |
Instance Method Details
#dispose ⇒ Object
79 80 81 82 83 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 79 def dispose swt_tab_item.setControl(nil) .dispose swt_tab_item.dispose end |
#get_attribute(attribute_name) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 71 def get_attribute(attribute_name) if attribute_name.to_s == "text" @swt_tab_item.getText else super(attribute_name) end end |
#has_attribute?(attribute_name, *args) ⇒ Boolean
53 54 55 56 57 58 59 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 53 def has_attribute?(attribute_name, *args) if attribute_name.to_s == "text" true else super(attribute_name, *args) end end |
#set_attribute(attribute_name, *args) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/glimmer/swt/tab_item_proxy.rb', line 61 def set_attribute(attribute_name, *args) attribute_name if attribute_name.to_s == "text" text_value = args[0] @swt_tab_item.setText text_value else super(attribute_name, *args) end end |