61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/motion-xray/views/xray_headers.rb', line 61
def drawRect(rect)
context = UIGraphicsGetCurrentContext()
color_space = CGColorSpaceCreateDeviceRGB()
if @pressed
else
cgcolors = [
:white.uicolor.CGColor,
:light_gray.uicolor.CGColor,
]
end
points = [0, 1]
gradient = CGGradientCreateWithColors(color_space, cgcolors, points.to_pointer(:float))
CGContextDrawLinearGradient(context, gradient, self.bounds.top_left, self.bounds.bottom_left, 0)
text.drawAtPoint([17, 3], withFont: :bold.uifont(11))
CGContextSaveGState(context)
triangle_bounds = CGRect.new([0, 0], [20, 20]).shrink(6)
:clear.uicolor.setStroke
:light_gray.uicolor.setFill
if false
if @exposed
CGContextMoveToPoint(context, triangle_bounds.top_right(true).x, triangle_bounds.top_right(true).y)
CGContextAddLineToPoint(context, triangle_bounds.bottom_center(true).x, triangle_bounds.bottom_center(true).y)
CGContextAddLineToPoint(context, triangle_bounds.top_left(true).x, triangle_bounds.top_left(true).y)
else
CGContextMoveToPoint(context, triangle_bounds.top_left(true).x, triangle_bounds.top_left(true).y)
CGContextAddLineToPoint(context, triangle_bounds.center_right(true).x, triangle_bounds.center_right(true).y)
CGContextAddLineToPoint(context, triangle_bounds.bottom_left(true).x, triangle_bounds.bottom_left(true).y)
end
end
CGContextDrawPath(context, KCGPathFillStroke)
CGContextRestoreGState(context)
end
|