1// 2// PXCheckeredBackground.m 3// Pixen-XCode 4// 5// Created by Joe Osborn on Tue Oct 28 2003. 6// Copyright (c) 2003 Open Sword Group. All rights reserved. 7// 8 9#import "PXCheckeredBackground.h" 10 11 12@implementation PXCheckeredBackground 13 14- defaultName 15{ 16 return NSLocalizedString(@"CHECKERED_BACKGROUND", @"Checkered Background"); 17} 18 19- (void)drawRect:(NSRect)rect withinRect:(NSRect)wholeRect 20{ 21#ifdef __COCOA__ 22 [backColor set]; 23#else 24 [[backWell color] set]; 25#endif 26 NSRectFill(wholeRect); 27#ifdef __COCOA__ 28 [color set]; 29#else 30 [[colorWell color] set]; 31#endif 32 int i, j; 33 BOOL drawForeground = NO; 34 for(i = 0; i < wholeRect.size.width; i+=10) 35 { 36 drawForeground = i % 20 == 0; 37 for(j = 0; j < wholeRect.size.height; j+=10) 38 { 39 if(drawForeground) 40 { 41 NSRectFill(NSMakeRect(wholeRect.origin.x+i, wholeRect.origin.y+j, 10, 10)); 42 } 43 drawForeground = !drawForeground; 44 } 45 } 46} 47 48@end 49