Class: Glimmer::SWT::TrayProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/glimmer/swt/tray_proxy.rb

Overview

Proxy for org.eclipse.swt.widgets.Tray

Invoking ‘#swt_widget` returns the SWT Tray object wrapped by this proxy

Follows the Proxy Design Pattern and Flyweight Design Pattern (caching memoization)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display_proxy) ⇒ TrayProxy

Returns a new instance of TrayProxy.



40
41
42
# File 'lib/glimmer/swt/tray_proxy.rb', line 40

def initialize(display_proxy)
  @swt_widget = display_proxy.getSystemTray
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



44
45
46
# File 'lib/glimmer/swt/tray_proxy.rb', line 44

def method_missing(method, *args, &block)
  @swt_widget.send(method, *args, &block)
end

Instance Attribute Details

#swt_widgetObject (readonly)

Returns the value of attribute swt_widget.



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

def swt_widget
  @swt_widget
end

Class Method Details

.instanceObject



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

def instance
  @instance ||= new(Glimmer::SWT::DisplayProxy.instance)
end

Instance Method Details

#post_add_contentObject

Subclasses may override to perform post add_content work. Make sure its logic detects if it ran before since it could run multiple times when adding content multiple times post creation.



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

def post_add_content
  # No Op
end

#post_initialize_child(child) ⇒ Object



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

def post_initialize_child(child)
  # No Op
end

#respond_to?(method, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/glimmer/swt/tray_proxy.rb', line 48

def respond_to?(method, *args, &block)
  super || @swt_widget.respond_to?(method, *args, &block)
end