Class: CGSize

Inherits:
Struct
  • Object
show all
Defined in:
lib/accessibility/bridge/mri.rb,
lib/accessibility/bridge/common.rb

Overview

A structure that contains the size of a rectangle in a 2D co-ordinate system

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width = 0.0, height = 0.0) ⇒ CGSize

Returns a new instance of CGSize.

Parameters:

  • width (Number) (defaults to: 0.0)
  • height (Number) (defaults to: 0.0)


38
39
40
# File 'lib/accessibility/bridge/mri.rb', line 38

def initialize width = 0.0, height = 0.0
  super
end

Instance Attribute Details

#heightNumber

The heighth of the box

Returns:

  • (Number)


34
35
36
# File 'lib/accessibility/bridge/mri.rb', line 34

def height
  @height
end

#widthNumber

The width of the box

Returns:

  • (Number)


34
35
36
# File 'lib/accessibility/bridge/mri.rb', line 34

def width
  @width
end

Class Method Details

.ax_valueNumber

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

Returns:

  • (Number)


120
# File 'lib/accessibility/bridge/macruby.rb', line 120

def ax_value; KAXValueCGSizeType end

Instance Method Details

#inspectString

Return a nice string representation of the size

Overrides Object#inspect to more closely mimic MacRuby Boxed#inspect.

Returns:



56
57
58
# File 'lib/accessibility/bridge/mri.rb', line 56

def inspect
  "#<CGSize width=#{self.width.to_f} height=#{self.height.to_f}>"
end

#to_sizeCGSize

Returns the receiver, since the receiver is already a CGSize

Returns:



16
17
18
# File 'lib/accessibility/bridge/common.rb', line 16

def to_size
  self
end