Class: CALayer

Inherits:
Object
  • Object
show all
Includes:
PurplishFrame::View
Defined in:
lib/purplish-frame/ui/ca_layer.rb,
lib/purplish-frame/ui/ios/ca_layer.rb,
lib/purplish-frame/ui/osx/ca_layer.rb

Instance Method Summary collapse

Methods included from PurplishFrame::View

#center_x, #center_x=, #center_y, #center_y=, #height, #inset!, #left, #left=, #right, #right=, #size_height_to_fit, #size_height_to_fit_align_bottom, #size_height_to_fit_max, #size_height_to_fit_min, #size_width_to_fit, #size_width_to_fit_align_right, #size_width_to_fit_max, #size_width_to_fit_min, #width, #width=

Instance Method Details

#bottomObject



17
18
19
# File 'lib/purplish-frame/ui/ios/ca_layer.rb', line 17

def bottom
  frame.origin.y + frame.size.height
end

#bottom=(bottom) ⇒ Object



21
22
23
24
25
# File 'lib/purplish-frame/ui/ios/ca_layer.rb', line 21

def bottom=(bottom)
  f = frame
  f.origin.y = bottom - f.size.height
  self.frame = f
end

#centerObject



2
3
4
# File 'lib/purplish-frame/ui/ios/ca_layer.rb', line 2

def center
  CGPointMake(left+width/2, top+height/2)
end

#center=(pt) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/purplish-frame/ui/ca_layer.rb', line 8

def center=(pt)
  #We need to check because pt might be HIPoint or some Boxed type
  pt = pt.to_point if pt.respond_to? :to_point
  f = frame
  f.origin.x = pt.x-width/2
  f.origin.y = pt.y-height/2
  self.frame = f
end

#height=(height) ⇒ Object



27
28
29
30
31
# File 'lib/purplish-frame/ui/ios/ca_layer.rb', line 27

def height=(height)
  f = frame
  f.size.height = height
  self.frame = f
end

#topObject



7
8
9
# File 'lib/purplish-frame/ui/ios/ca_layer.rb', line 7

def top
  frame.origin.y
end

#top=(y) ⇒ Object



11
12
13
14
15
# File 'lib/purplish-frame/ui/ios/ca_layer.rb', line 11

def top=(y)
  f = frame
  f.origin.y = y
  self.frame = f
end

#view_frameObject



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

def view_frame
  frame
end