project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitDividerView.m
author koda
Wed, 03 Apr 2013 00:46:19 +0200
changeset 8835 01bcf9ea68c1
parent 8441 a00b0fa0dbd7
child 11115 3729ac42189b
permissions -rwxr-xr-x
ios compiles again (using an old version of sdl)
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
//  MGSplitDividerView.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 26/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 "MGSplitDividerView.h"
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
    10
#import "MGSplitViewController.h"
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
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
@implementation MGSplitDividerView
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
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 -
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
#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
    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
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
- (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
    21
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    22
    if ((self = [super initWithFrame:frame])) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    23
        self.userInteractionEnabled = NO;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    24
        self.allowsDragging = NO;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    25
        self.contentMode = UIViewContentModeRedraw;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    26
    }
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    27
    return self;
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
}
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
    29
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
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
- (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
    32
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    33
    self.splitViewController = nil;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    34
    [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
    35
}
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
    36
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
    37
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
    38
#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
    39
#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
    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
- (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
    43
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    44
    if (splitViewController.dividerStyle == MGSplitViewDividerStyleThin) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    45
        [super drawRect:rect];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    46
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    47
    } else if (splitViewController.dividerStyle == MGSplitViewDividerStylePaneSplitter) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    48
        // Draw gradient background.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    49
        CGRect bounds = self.bounds;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    50
        CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    51
        CGFloat locations[2] = {0, 1};
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    52
        CGFloat components[8] = {   0.988, 0.988, 0.988, 1.0,  // light
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    53
                                    0.875, 0.875, 0.875, 1.0 };// dark
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    54
        CGGradientRef gradient = CGGradientCreateWithColorComponents (rgb, components, locations, 2);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    55
        CGContextRef context = UIGraphicsGetCurrentContext();
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    56
        CGPoint start, end;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    57
        if (splitViewController.vertical) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    58
            // Light left to dark right.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    59
            start = CGPointMake(CGRectGetMinX(bounds), CGRectGetMidY(bounds));
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    60
            end = CGPointMake(CGRectGetMaxX(bounds), CGRectGetMidY(bounds));
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    61
        } else {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    62
            // Light top to dark bottom.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    63
            start = CGPointMake(CGRectGetMidX(bounds), CGRectGetMinY(bounds));
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    64
            end = CGPointMake(CGRectGetMidX(bounds), CGRectGetMaxY(bounds));
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    65
        }
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    66
        CGContextDrawLinearGradient(context, gradient, start, end, 0);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    67
        CGColorSpaceRelease(rgb);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    68
        CGGradientRelease(gradient);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    69
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    70
        // Draw borders.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    71
        float borderThickness = 1.0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    72
        [[UIColor colorWithWhite:0.7 alpha:1.0] set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    73
        CGRect borderRect = bounds;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    74
        if (splitViewController.vertical) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    75
            borderRect.size.width = borderThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    76
            UIRectFill(borderRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    77
            borderRect.origin.x = CGRectGetMaxX(bounds) - borderThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    78
            UIRectFill(borderRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    79
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    80
        } else {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    81
            borderRect.size.height = borderThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    82
            UIRectFill(borderRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    83
            borderRect.origin.y = CGRectGetMaxY(bounds) - borderThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    84
            UIRectFill(borderRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    85
        }
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    86
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    87
        // Draw grip.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    88
        [self drawGripThumbInRect:bounds];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    89
    }
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
    90
}
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
    91
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
    92
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
    93
- (void)drawGripThumbInRect:(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
    94
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    95
    float width = 9.0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    96
    float height;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    97
    if (splitViewController.vertical) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    98
        height = 30.0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    99
    } else {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   100
        height = width;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   101
        width = 30.0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   102
    }
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   103
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   104
    // Draw grip in centred in rect.
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   105
    CGRect gripRect = CGRectMake(0, 0, width, height);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   106
    gripRect.origin.x = ((rect.size.width - gripRect.size.width) / 2.0);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   107
    gripRect.origin.y = ((rect.size.height - gripRect.size.height) / 2.0);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   108
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   109
    float stripThickness = 1.0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   110
    UIColor *stripColor = [UIColor colorWithWhite:0.35 alpha:1.0];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   111
    UIColor *lightColor = [UIColor colorWithWhite:1.0 alpha:1.0];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   112
    float space = 3.0;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   113
    if (splitViewController.vertical) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   114
        gripRect.size.width = stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   115
        [stripColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   116
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   117
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   118
        gripRect.origin.x += stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   119
        gripRect.origin.y += 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   120
        [lightColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   121
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   122
        gripRect.origin.x -= stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   123
        gripRect.origin.y -= 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   124
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   125
        gripRect.origin.x += space + stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   126
        [stripColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   127
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   128
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   129
        gripRect.origin.x += stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   130
        gripRect.origin.y += 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   131
        [lightColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   132
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   133
        gripRect.origin.x -= stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   134
        gripRect.origin.y -= 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   135
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   136
        gripRect.origin.x += space + stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   137
        [stripColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   138
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   139
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   140
        gripRect.origin.x += stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   141
        gripRect.origin.y += 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   142
        [lightColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   143
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   144
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   145
    } else {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   146
        gripRect.size.height = stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   147
        [stripColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   148
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   149
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   150
        gripRect.origin.y += stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   151
        gripRect.origin.x -= 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   152
        [lightColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   153
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   154
        gripRect.origin.y -= stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   155
        gripRect.origin.x += 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   156
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   157
        gripRect.origin.y += space + stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   158
        [stripColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   159
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   160
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   161
        gripRect.origin.y += stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   162
        gripRect.origin.x -= 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   163
        [lightColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   164
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   165
        gripRect.origin.y -= stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   166
        gripRect.origin.x += 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   167
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   168
        gripRect.origin.y += space + stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   169
        [stripColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   170
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   171
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   172
        gripRect.origin.y += stripThickness;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   173
        gripRect.origin.x -= 1;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   174
        [lightColor set];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   175
        UIRectFill(gripRect);
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   176
    }
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
   177
}
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
#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
   181
#pragma mark Interaction
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
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
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
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
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   186
    UITouch *touch = [touches anyObject];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   187
    if (touch) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   188
        CGPoint lastPt = [touch previousLocationInView:self];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   189
        CGPoint pt = [touch locationInView:self];
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   190
        float offset = (splitViewController.vertical) ? pt.x - lastPt.x : pt.y - lastPt.y;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   191
        if (!splitViewController.masterBeforeDetail) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   192
            offset = -offset;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   193
        }
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   194
        splitViewController.splitPosition = splitViewController.splitPosition + offset;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   195
    }
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
   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
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
#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
   200
#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
   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)setAllowsDragging:(BOOL)flag
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
{
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   205
    if (flag != allowsDragging) {
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   206
        allowsDragging = flag;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
   207
        self.userInteractionEnabled = allowsDragging;
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
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
@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
   213
@synthesize allowsDragging;
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
@end