Class: WinFFI::RECT

Inherits:
FFIStruct show all
Defined in:
lib/win-ffi/core/struct/rect.rb

Overview

Instance Method Summary collapse

Methods inherited from FFIStruct

layout

Instance Method Details

#areaObject

def initialize(left, top, right, bottom)

self.left, self.top, self.right, self.bottom = left, top, right, bottom

end



13
14
15
# File 'lib/win-ffi/core/struct/rect.rb', line 13

def area
  width * height
end

#heightObject



29
30
31
# File 'lib/win-ffi/core/struct/rect.rb', line 29

def height
  bottom - top
end

#height=(v) ⇒ Object



33
34
35
# File 'lib/win-ffi/core/struct/rect.rb', line 33

def height=(v)
  self.bottom = top + v
end

#perimeterObject



17
18
19
# File 'lib/win-ffi/core/struct/rect.rb', line 17

def perimeter
  2 * width + 2 * height
end

#to_sObject



37
38
39
# File 'lib/win-ffi/core/struct/rect.rb', line 37

def to_s
  "(left = #{left}, top = #{top}, width = #{width}, height = #{height})"
end

#widthObject



21
22
23
# File 'lib/win-ffi/core/struct/rect.rb', line 21

def width
  right - left
end

#width=(v) ⇒ Object



25
26
27
# File 'lib/win-ffi/core/struct/rect.rb', line 25

def width=(v)
  self.right = left + v
end