// // SFContentView.m // ShinyRuler // // Created by Matteo rattotti on 12/19/07. // Copyright 2007 www.shinyfrog.net. All rights reserved. // #import "SFContentView.h" #import "SFRulerView.h" @implementation SFContentView - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { [self setWantsLayer:YES]; // Change this with the dependant frame NSRect rulerRect = NSMakeRect(0.0, 0.0, 200.0, 50.0); rulerView = [[SFRulerView alloc] initWithFrame:[self centerRect:rulerRect inRect:frame]]; //rulerView = [[SFRulerView alloc] initWithFrame:rulerRect]; [self addSubview:rulerView]; } return self; } - (NSRect) centerRect: (NSRect) smallRect inRect: (NSRect) bigRect { NSRect centerRect; centerRect.size = smallRect.size; //centerRect.origin.x = (bigRect.size.width - smallRect.size.width) / 2.0; centerRect.origin.y = (bigRect.size.height - smallRect.size.height);// / 2.0; return (centerRect); } // centerRect - (void)drawRect:(NSRect)rect { // Drawing code here. } - (BOOL)isFlipped{ return NO; } @end