Class: CGRect

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

Overview

Complete definition of a rectangle in a 2D coordinate system

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin = CGPoint.new, size = CGSize.new) ⇒ CGRect

Returns a new instance of CGRect.

Parameters:

  • origin (CGPoint, #to_point) (defaults to: CGPoint.new)
  • size (CGSize, #to_size) (defaults to: CGSize.new)


69
70
71
# File 'lib/accessibility/bridge/mri.rb', line 69

def initialize origin = CGPoint.new, size = CGSize.new
  super(origin.to_point, size.to_size)
end

Instance Attribute Details

#originCGPoint, #to_point

The origin point

Returns:



65
66
67
# File 'lib/accessibility/bridge/mri.rb', line 65

def origin
  @origin
end

#sizeCGSize, #to_size

The size of the rectangle

Returns:



65
66
67
# File 'lib/accessibility/bridge/mri.rb', line 65

def size
  @size
end

Class Method Details

.ax_valueNumber

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

Returns:

  • (Number)


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

def ax_value; KAXValueCGRectType end

Instance Method Details

#inspectString

Return a nice string representation of the rectangle

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

Returns:



87
88
89
# File 'lib/accessibility/bridge/mri.rb', line 87

def inspect
  "#<CGRect origin=#{self.origin.inspect} size=#{self.size.inspect}>"
end

#to_rectCGRect

Returns the receiver, since the receiver is already a CGRect

Returns:



26
27
28
# File 'lib/accessibility/bridge/common.rb', line 26

def to_rect
  self
end