• R/O
  • HTTP
  • SSH
  • HTTPS

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

iSightを使ってBooklog,MediaMarkerインポート用CSVファイルを生成するアプリ


File Info

Rev. deec2c46d1e4b89d37ea473242737695cab87712
크기 1,330 bytes
Time 2012-03-25 16:55:28
Author masakih
Log Message

[Mod] PPCサポートをやめた

Content

//
//  MyGraphView.m

#import "MyGraphView.h"


@implementation MyGraphView

- (id)initWithFrame:(NSRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code here.
		pathsAndColor = [[NSMutableDictionary alloc] init];
    }
    return self;
}

- (void) dealloc {
	[super dealloc];
}


- (void)drawRect:(NSRect)rect {
	
	if ([pathsAndColor count] == 0)
		return;  //Leave the last paths that were drawn
	
    // Drawing code here.
	[[NSColor whiteColor] set];
	[NSBezierPath fillRect:rect];
	
	NSEnumerator *allKeysEnum = [[pathsAndColor allKeys] objectEnumerator];
	NSColor *nextColor;
	while (nextColor = [allKeysEnum nextObject]) {
		NSBezierPath *nextPath = [pathsAndColor objectForKey:nextColor];
		if (nextPath) {
			[nextColor set];
			[nextPath stroke];
		}
	}
}

- (void)setGreenPath:(NSBezierPath *)aPath {
	[self setPath:aPath withColor:[NSColor greenColor]];
}

- (void)setRedPath:(NSBezierPath *)aPath {
	[self setPath:aPath withColor:[NSColor redColor]];
}

- (void)setBluePath:(NSBezierPath *)aPath {
	[self setPath:aPath withColor:[NSColor blueColor]];
}

- (void)setPath:(NSBezierPath *)aPath withColor:(NSColor *)aColor {
	[pathsAndColor setObject:aPath forKey:aColor];
	[self setNeedsDisplay:YES];
}

-(void)removeAllPaths {
	[pathsAndColor removeAllObjects];
}



@end