project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitCornersView.m
author sheepluva
Tue, 22 Jun 2021 22:13:55 +0200
changeset 15802 d5c37e78ab83
parent 11217 e68b3e392091
permissions -rwxr-xr-x
hedgewars-engine (rust): fix "protocol_version" -> "hedgewars_engine_protocol_version" That function/symbol was renamed in ef2fc0210362
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
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    39
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    40
#pragma mark -
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    41
#pragma mark Geometry helpers
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    42
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    43
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    44
static double deg2Rad(double degrees)
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
    // Converts degrees to radians.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    47
    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
    48
}
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
    49
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
#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
    52
#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
    53
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
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
- (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
    56
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    57
	// 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
    58
	if (cornerRadius > 0) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    59
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    60
		float maxX = CGRectGetMaxX(self.bounds);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    61
		float maxY = CGRectGetMaxY(self.bounds);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    62
		UIBezierPath *path = [UIBezierPath bezierPath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    63
		CGPoint pt = CGPointZero;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    64
		switch (cornersPosition) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    65
			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
    66
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    67
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    68
				[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
    69
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    70
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    71
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    72
				[path addLineToPoint:CGPointZero];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    73
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    74
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    75
				pt.x = maxX - cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    76
				pt.y = 0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    77
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    78
				pt.y = maxY;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    79
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    80
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    81
				[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
    82
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    83
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    84
				pt.x -= 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
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    87
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    88
				break;
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
			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
    91
				pt.y = maxY;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    92
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    93
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    94
				[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
    95
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    96
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    97
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    98
				pt.x -= 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
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   101
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   102
				pt.x = maxX - cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   103
				pt.y = maxY;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   104
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   105
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   106
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   107
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   108
				[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
   109
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   110
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   111
				pt.x -= 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
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   114
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   115
				break;
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
			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
   118
				pt.x = 0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   119
				pt.y = cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   120
				[path moveToPoint:pt];
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 addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   123
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   124
				[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
   125
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   126
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   127
				pt.x -= 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
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   130
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   131
				pt.x = 0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   132
				pt.y = maxY - cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   133
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   134
				pt.y = maxY;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   135
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   136
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   137
				[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
   138
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   139
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   140
				pt.x -= 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
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   143
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   144
				break;
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
			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
   147
				pt.y = cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   148
				[path moveToPoint:pt];
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 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
   151
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   152
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   153
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   154
				pt.x -= 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
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   157
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   158
				pt.y = maxY - cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   159
				[path moveToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   160
				pt.y += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   161
				[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
   162
				pt.x += cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   163
				pt.y -= cornerRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   164
				[path addLineToPoint:pt];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   165
				pt.x -= 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
				[path closePath];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   168
				
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   169
				break;
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
			default:
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   172
				break;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   173
		}
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   174
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   175
		[self.cornerBackgroundColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   176
		[path fill];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   177
	}
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
   178
}
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
   179
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
#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
   182
#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
   183
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
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
- (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
   186
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   187
	if (newRadius != cornerRadius) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   188
		cornerRadius = newRadius;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   189
		[self setNeedsDisplay];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   190
	}
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
   191
}
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
   192
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
- (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
   195
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   196
	if (theController != splitViewController) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   197
		splitViewController = theController;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   198
		[self setNeedsDisplay];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   199
	}
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
   200
}
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
   201
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
- (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
   204
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   205
	if (cornersPosition != posn) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   206
		cornersPosition = posn;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   207
		[self setNeedsDisplay];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   208
	}
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
   209
}
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
   210
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
- (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
   213
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   214
	if (color != cornerBackgroundColor) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   215
		cornerBackgroundColor = color;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   216
		[self setNeedsDisplay];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   217
	}
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
   218
}
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
   219
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
@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
   222
@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
   223
@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
   224
@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
   225
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
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
@end