Class: Boxed

Inherits:
Object
  • Object
show all
Defined in:
lib/accessibility/bridge/macruby.rb

Overview

AXElements extensions to the Boxed class

The Boxed class is simply an abstract base class for structs that MacRuby can use via bridge support.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ax_valueNumber

Returns the number that AXAPI uses in order to know how to wrap a struct.

Returns:

  • (Number)

Raises:

  • (NotImplementedError)


89
90
91
# File 'lib/accessibility/bridge/macruby.rb', line 89

def self.ax_value
  raise NotImplementedError, "#{inspect}:#{self.class} cannot be wrapped"
end

Instance Method Details

#to_axAXValueRef

Create an AXValueRef from the Boxed instance. This will only work if for the most common boxed types, you will need to check the AXAPI documentation for an up to date list.

Examples:


CGPoint.new(12, 34).to_ax # => #<AXValueRef:0x455678e2>
CGSize.new(56, 78).to_ax  # => #<AXValueRef:0x555678e2>

Returns:

  • (AXValueRef)


104
105
106
107
108
109
# File 'lib/accessibility/bridge/macruby.rb', line 104

def to_ax
  klass = self.class
  ptr   = Pointer.new klass.type
  ptr.assign self
  AXValueCreate(klass.ax_value, ptr)
end