module PurplishFrame::View

Public Instance Methods

center_x() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 23
def center_x
  center.x
end
center_x=(center_x) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 27
def center_x=(center_x)
  self.center = [center_x, center.y]
end
center_y() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 31
def center_y
  center.y
end
center_y=(center_y) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 35
def center_y=(center_y)
  self.center = [center.x, center_y]
end
height() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 49
def height
  view_frame.size.height
end
inset!(dx, dy) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 99
def inset!(dx, dy)
  self.frame = frame.inset(dx, dy)
end
left() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 3
def left
  view_frame.origin.x
end
left=(x) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 7
def left=(x)
  f = frame
  f.origin.x = x
  self.frame = f
end
right() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 13
def right
  view_frame.origin.x + view_frame.size.width
end
right=(right) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 17
def right=(right)
  f = frame
  f.origin.x = right - f.size.width
  self.frame = f
end
size_height_to_fit() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 75
def size_height_to_fit
  w = width
  #Otherwise it doesn't expand short UILabel when it's too short to fit longer text
  self.height = 1000
  sizeToFit
  self.width = w
end
size_height_to_fit_align_bottom() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 83
def size_height_to_fit_align_bottom
  y = bottom
  size_height_to_fit
  self.bottom = y
end
size_height_to_fit_max(f) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 89
def size_height_to_fit_max(f)
  size_height_to_fit
  self.height = f if height > f
end
size_height_to_fit_min(f) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 94
def size_height_to_fit_min(f)
  size_height_to_fit
  self.height = f if height < f
end
size_width_to_fit() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 53
def size_width_to_fit
  h = height
  sizeToFit
  self.height = h
end
size_width_to_fit_align_right() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 59
def size_width_to_fit_align_right
  x = right
  size_width_to_fit
  self.right = x
end
size_width_to_fit_max(f) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 65
def size_width_to_fit_max(f)
  size_width_to_fit
  self.width = f if width > f
end
size_width_to_fit_min(f) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 70
def size_width_to_fit_min(f)
  size_width_to_fit
  self.width = f if width < f
end
width() click to toggle source
# File lib/purplish-frame/ui/view.rb, line 39
def width
  view_frame.size.width
end
width=(width) click to toggle source
# File lib/purplish-frame/ui/view.rb, line 43
def width=(width)
  f = frame
  f.size.width = width
  self.frame = f
end