project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitCornersView.m
author antonc27 <antonc27@mail.ru>
Sun, 20 Sep 2015 02:52:49 +0200
branchios-revival
changeset 11188 3dbea499390d
parent 11115 3729ac42189b
child 11217 e68b3e392091
permissions -rwxr-xr-x
- 'Construction Mode' ammo set and game parameters added to iOS front-end
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     1
//
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     2
//  MGSplitCornersView.m
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     3
//  MGSplitView
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     4
//
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     5
//  Created by Matt Gemmell on 28/07/2010.
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     6
//  Copyright 2010 Instinctive Code.
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     7
//
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     8
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
     9
#import "MGSplitCornersView.h"
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    10
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    11
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    12
@implementation MGSplitCornersView
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    13
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    14
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    15
#pragma mark -
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    16
#pragma mark Setup and teardown
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    17
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    18
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    19
- (id)initWithFrame:(CGRect)frame
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    20
{
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    21
    if ((self = [super initWithFrame:frame])) {
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    22
		self.contentMode = UIViewContentModeRedraw;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    23
		self.userInteractionEnabled = NO;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    24
		self.opaque = NO;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    25
		self.backgroundColor = [UIColor clearColor];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    26
		cornerRadius = 0.0; // actual value is set by the splitViewController.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    27
		cornersPosition = MGCornersPositionLeadingVertical;
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    28
    }
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    29
	
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    30
    return self;
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    31
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    32
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    33
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    34
- (void)dealloc
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    35
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    36
	self.cornerBackgroundColor = nil;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    37
    
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    38
    [super dealloc];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    39
}
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    40
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    41
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    42
#pragma mark -
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    43
#pragma mark Geometry helpers
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    44
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    45
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    46
static double deg2Rad(double degrees)
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    47
{
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    48
    // Converts degrees to radians.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    49
    return degrees * (M_PI / 180.0);
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    50
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    51
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    52
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    53
#pragma mark -
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    54
#pragma mark Drawing
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    55
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    56
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    57
- (void)drawRect:(CGRect)rect
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    58
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    59
	// Draw two appropriate corners, with cornerBackgroundColor behind them.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    60
	if (cornerRadius > 0) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    61
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    62
		float maxX = CGRectGetMaxX(self.bounds);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    63
		float maxY = CGRectGetMaxY(self.bounds);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    64
		UIBezierPath *path = [UIBezierPath bezierPath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    65
		CGPoint pt = CGPointZero;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    66
		switch (cornersPosition) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    67
			case MGCornersPositionLeadingVertical: // top of screen for a left/right split
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    68
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    69
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    70
				[path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:(float)deg2Rad(90) endAngle:0 clockwise:YES]];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    71
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    72
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    73
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    74
				[path addLineToPoint:CGPointZero];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    75
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    76
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    77
				pt.x = maxX - cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    78
				pt.y = 0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    79
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    80
				pt.y = maxY;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    81
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    82
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    83
				[path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:(float)deg2Rad(180) endAngle:(float)deg2Rad(90) clockwise:YES]];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    84
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    85
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    86
				pt.x -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    87
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    88
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    89
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    90
				break;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    91
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    92
			case MGCornersPositionTrailingVertical: // bottom of screen for a left/right split
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    93
				pt.y = maxY;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    94
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    95
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    96
				[path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:(float)deg2Rad(270) endAngle:(float)deg2Rad(360) clockwise:NO]];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    97
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    98
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    99
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   100
				pt.x -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   101
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   102
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   103
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   104
				pt.x = maxX - cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   105
				pt.y = maxY;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   106
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   107
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   108
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   109
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   110
				[path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:(float)deg2Rad(180) endAngle:(float)deg2Rad(270) clockwise:NO]];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   111
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   112
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   113
				pt.x -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   114
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   115
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   116
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   117
				break;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   118
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   119
			case MGCornersPositionLeadingHorizontal: // left of screen for a top/bottom split
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   120
				pt.x = 0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   121
				pt.y = cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   122
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   123
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   124
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   125
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   126
				[path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:(float)deg2Rad(180) endAngle:(float)deg2Rad(270) clockwise:NO]];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   127
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   128
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   129
				pt.x -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   130
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   131
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   132
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   133
				pt.x = 0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   134
				pt.y = maxY - cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   135
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   136
				pt.y = maxY;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   137
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   138
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   139
				[path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:(float)deg2Rad(180) endAngle:(float)deg2Rad(90) clockwise:YES]];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   140
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   141
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   142
				pt.x -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   143
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   144
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   145
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   146
				break;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   147
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   148
			case MGCornersPositionTrailingHorizontal: // right of screen for a top/bottom split
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   149
				pt.y = cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   150
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   151
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   152
				[path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:(float)deg2Rad(270) endAngle:(float)deg2Rad(360) clockwise:NO]];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   153
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   154
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   155
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   156
				pt.x -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   157
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   158
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   159
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   160
				pt.y = maxY - cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   161
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   162
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   163
				[path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:(float)deg2Rad(90) endAngle:0 clockwise:YES]];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   164
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   165
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   166
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   167
				pt.x -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   168
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   169
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   170
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   171
				break;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   172
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   173
			default:
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   174
				break;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   175
		}
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   176
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   177
		[self.cornerBackgroundColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   178
		[path fill];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   179
	}
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   180
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   181
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   182
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   183
#pragma mark -
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   184
#pragma mark Accessors and properties
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   185
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   186
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   187
- (void)setCornerRadius:(float)newRadius
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   188
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   189
	if (newRadius != cornerRadius) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   190
		cornerRadius = newRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   191
		[self setNeedsDisplay];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   192
	}
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   193
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   194
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   195
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   196
- (void)setSplitViewController:(MGSplitViewController *)theController
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   197
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   198
	if (theController != splitViewController) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   199
		splitViewController = theController;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   200
		[self setNeedsDisplay];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   201
	}
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   202
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   203
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   204
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   205
- (void)setCornersPosition:(MGCornersPosition)posn
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   206
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   207
	if (cornersPosition != posn) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   208
		cornersPosition = posn;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   209
		[self setNeedsDisplay];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   210
	}
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   211
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   212
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   213
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   214
- (void)setCornerBackgroundColor:(UIColor *)color
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   215
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   216
	if (color != cornerBackgroundColor) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   217
		cornerBackgroundColor = color;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   218
		[self setNeedsDisplay];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   219
	}
6658
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   220
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   221
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   222
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   223
@synthesize cornerRadius;
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   224
@synthesize splitViewController;
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   225
@synthesize cornersPosition;
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   226
@synthesize cornerBackgroundColor;
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   227
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   228
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   229
@end