Class: NSRect

Inherits:
Object
  • Object
show all
Includes:
PurplishFrame::Rect
Defined in:
lib/purplish-frame/non-ui/osx/ns_rect.rb,
lib/purplish-frame/non-ui/osx/ns_array.rb

Instance Method Summary collapse

Methods included from PurplishFrame::Rect

#center_x, #center_x=, #height, #left, #left=, #right, #right=, #scale, #scale!, #width, #width=

Instance Method Details

#bottomObject



12
13
14
# File 'lib/purplish-frame/non-ui/osx/ns_rect.rb', line 12

def bottom
  origin.y
end

#bottom=(bottom) ⇒ Object



16
17
18
# File 'lib/purplish-frame/non-ui/osx/ns_rect.rb', line 16

def bottom=(bottom)
  origin.y = bottom
end

#center_yObject



20
21
22
# File 'lib/purplish-frame/non-ui/osx/ns_rect.rb', line 20

def center_y
  bottom+size.height/2
end

#center_y=(center_y) ⇒ Object



24
25
26
# File 'lib/purplish-frame/non-ui/osx/ns_rect.rb', line 24

def center_y=(center_y)
  self.bottom = center_y-size.height/2
end

#height=(h) ⇒ Object



28
29
30
# File 'lib/purplish-frame/non-ui/osx/ns_rect.rb', line 28

def height=(h)
  size.height = h
end

#inset(dx, dy) ⇒ Object



32
33
34
# File 'lib/purplish-frame/non-ui/osx/ns_rect.rb', line 32

def inset(dx, dy)
  NSInsetRect(self, dx, dy)
end

#to_rectObject



2
3
4
# File 'lib/purplish-frame/non-ui/osx/ns_array.rb', line 2

def to_rect
  self
end

#topObject



4
5
6
# File 'lib/purplish-frame/non-ui/osx/ns_rect.rb', line 4

def top
  origin.y + size.height
end

#top=(y) ⇒ Object



8
9
10
# File 'lib/purplish-frame/non-ui/osx/ns_rect.rb', line 8

def top=(y)
  origin.y = y - size.height
end