source: trunk/SapphireCompatibilityClasses/SapphireLayoutManager.m @ 938

Revision 938, 2.0 KB checked in by gbooker, 4 years ago (diff)

A lot of Take 3 compatibility. The layout stuff is just removed there until I figure it out

Line 
1/*
2 * SapphireLayoutManager.h
3 * Sapphire
4 *
5 * Created by Graham Booker on Nov. 24, 2008.
6 * Copyright 2008 Sapphire Development Team and/or www.nanopi.net
7 * All rights reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License as published by the Free Software Foundation; either version 3 of the License,
11 * or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
15 * Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with this program; if not,
18 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 */
20
21#import "SapphireLayoutManager.h"
22#import "SapphireFrontRowCompat.h"
23
24@interface BRLayerController (compat)
25- (void)setLayoutManager:(id)newLayout;
26- (id)layoutManager;
27@end
28
29@implementation SapphireLayoutManager
30
31+ (id)setCustomLayoutOnControl:(BRLayerController <SapphireLayoutDelegate> *)control
32{
33        if(![SapphireFrontRowCompat usingATypeOfTakeTwo])
34                return nil;
35        if(![control respondsToSelector:@selector(layoutManager)])
36                return nil;
37       
38        SapphireLayoutManager *newLayout = [[SapphireLayoutManager alloc] initWithReal:[control layoutManager]];
39        [newLayout setDelegate:control];
40        [control setLayoutManager:newLayout];
41        [newLayout autorelease];
42       
43        return newLayout;
44}
45
46- (id)initWithReal:(id)real
47{
48        self = [super init];
49        if(self == nil)
50                return self;
51        realLayout = [real retain];
52        return self;
53}
54
55- (void) dealloc
56{
57        [realLayout release];
58        [super dealloc];
59}
60
61- (void)setDelegate:(id <SapphireLayoutDelegate>)theDelegate
62{
63        delegate = theDelegate;
64}
65
66- (void)layoutSublayersOfLayer:(id)layer
67{
68        [realLayout layoutSublayersOfLayer:layer];
69        [delegate doMyLayout];
70}
71
72- (NSSize)preferredSizeOfLayer:(id)layer
73{
74        return [realLayout preferredSizeOfLayer:layer];
75}
76@end
Note: See TracBrowser for help on using the repository browser.