project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitCornersView.m
author nemo
Wed, 09 Oct 2013 20:23:06 -0400
changeset 9507 821452415337
parent 8441 a00b0fa0dbd7
child 11115 3729ac42189b
permissions -rwxr-xr-x
kill rope on wrap
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"
6908
896ed2afcfb8 ios: turn on more warning messages and start correcting them
koda
parents: 6659
diff changeset
    10
#import "CGPointUtils.h"
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])) {
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    22
        self.contentMode = UIViewContentModeRedraw;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    23
        self.userInteractionEnabled = NO;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    24
        self.opaque = NO;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    25
        self.backgroundColor = [UIColor clearColor];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    26
        cornerRadius = 0.0; // actual value is set by the splitViewController.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
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
    }
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
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
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    36
    self.cornerBackgroundColor = nil;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    37
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    38
    [super dealloc];
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
    39
}
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
    40
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
    41
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
    42
#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
    43
#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
    44
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
    45
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
    46
- (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
    47
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    48
    // Draw two appropriate corners, with cornerBackgroundColor behind them.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    49
    if (cornerRadius > 0) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    50
        if (NO) { // just for debugging.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    51
            [[UIColor redColor] set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    52
            UIRectFill(self.bounds);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    53
        }
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    54
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    55
        float maxX = CGRectGetMaxX(self.bounds);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    56
        float maxY = CGRectGetMaxY(self.bounds);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    57
        UIBezierPath *path = [UIBezierPath bezierPath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    58
        CGPoint pt = CGPointZero;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    59
        switch (cornersPosition) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    60
            case MGCornersPositionLeadingVertical: // top of screen for a left/right split
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    61
                [path moveToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    62
                pt.y += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    63
                [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(90) endAngle:0 clockwise:YES]];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    64
                pt.x += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    65
                pt.y -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    66
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    67
                [path addLineToPoint:CGPointZero];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    68
                [path closePath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    69
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    70
                pt.x = maxX - cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    71
                pt.y = 0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    72
                [path moveToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    73
                pt.y = maxY;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    74
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    75
                pt.x += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    76
                [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(180) endAngle:degreesToRadians(90) clockwise:YES]];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    77
                pt.y -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    78
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    79
                pt.x -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    80
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    81
                [path closePath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    82
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    83
                break;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    84
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    85
            case MGCornersPositionTrailingVertical: // bottom of screen for a left/right split
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    86
                pt.y = maxY;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    87
                [path moveToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    88
                pt.y -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    89
                [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(270) endAngle:degreesToRadians(360) clockwise:NO]];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    90
                pt.x += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    91
                pt.y += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    92
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    93
                pt.x -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    94
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    95
                [path closePath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    96
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    97
                pt.x = maxX - cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    98
                pt.y = maxY;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
    99
                [path moveToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   100
                pt.y -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   101
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   102
                pt.x += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   103
                [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(180) endAngle:degreesToRadians(270) clockwise:NO]];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   104
                pt.y += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   105
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   106
                pt.x -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   107
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   108
                [path closePath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   109
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   110
                break;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   111
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   112
            case MGCornersPositionLeadingHorizontal: // left of screen for a top/bottom split
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   113
                pt.x = 0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   114
                pt.y = cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   115
                [path moveToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   116
                pt.y -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   117
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   118
                pt.x += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   119
                [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(180) endAngle:degreesToRadians(270) clockwise:NO]];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   120
                pt.y += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   121
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   122
                pt.x -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   123
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   124
                [path closePath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   125
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   126
                pt.x = 0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   127
                pt.y = maxY - cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   128
                [path moveToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   129
                pt.y = maxY;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   130
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   131
                pt.x += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   132
                [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(180) endAngle:degreesToRadians(90) clockwise:YES]];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   133
                pt.y -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   134
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   135
                pt.x -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   136
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   137
                [path closePath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   138
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   139
                break;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   140
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   141
            case MGCornersPositionTrailingHorizontal: // right of screen for a top/bottom split
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   142
                pt.y = cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   143
                [path moveToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   144
                pt.y -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   145
                [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(270) endAngle:degreesToRadians(360) clockwise:NO]];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   146
                pt.x += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   147
                pt.y += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   148
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   149
                pt.x -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   150
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   151
                [path closePath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   152
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   153
                pt.y = maxY - cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   154
                [path moveToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   155
                pt.y += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   156
                [path appendPath:[UIBezierPath bezierPathWithArcCenter:pt radius:cornerRadius startAngle:degreesToRadians(90) endAngle:0 clockwise:YES]];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   157
                pt.x += cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   158
                pt.y -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   159
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   160
                pt.x -= cornerRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   161
                [path addLineToPoint:pt];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   162
                [path closePath];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   163
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   164
                break;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   165
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   166
            default:
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   167
                break;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   168
        }
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   169
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   170
        [self.cornerBackgroundColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   171
        [path fill];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   172
    }
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
   173
}
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
   174
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
   175
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
   176
#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
   177
#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
   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
- (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
   181
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   182
    if (newRadius != cornerRadius) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   183
        cornerRadius = newRadius;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   184
        [self setNeedsDisplay];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   185
    }
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
   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
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
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
   189
- (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
   190
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   191
    if (theController != splitViewController) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   192
        splitViewController = theController;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   193
        [self setNeedsDisplay];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   194
    }
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
   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
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
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
   198
- (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
   199
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   200
    if (cornersPosition != posn) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   201
        cornersPosition = posn;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   202
        [self setNeedsDisplay];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   203
    }
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
   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
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
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
   207
- (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
   208
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   209
    if (color != cornerBackgroundColor) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   210
        [cornerBackgroundColor release];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   211
        cornerBackgroundColor = [color retain];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   212
        [self setNeedsDisplay];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6908
diff changeset
   213
    }
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
   214
}
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
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
   216
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
   217
@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
   218
@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
   219
@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
   220
@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
   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
@end