02.04.2013 Views

QuickTime Kit Programming Guide - filibeto.org

QuickTime Kit Programming Guide - filibeto.org

QuickTime Kit Programming Guide - filibeto.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C H A P T E R 4<br />

Adding New Capabilities to the QT<strong>Kit</strong>Player Application<br />

{<br />

}<br />

NSMutableString *sizeString = [NSMutableString string];<br />

NSSize movSize = NSMakeSize(0,0);<br />

movSize = [[mMovie attributeForKey:QTMovieNaturalSizeAttribute] sizeValue];<br />

[sizeString appendFormat:@"%.0f", movSize.width];<br />

[sizeString appendString:@" x "];<br />

[sizeString appendFormat:@"%.0f", movSize.height];<br />

[mNormalSize setStringValue:sizeString];<br />

11. To set the current size text field, add:<br />

- (void)setCurrentSizeDisplay<br />

{<br />

NSSize movCurrentSize = NSMakeSize(0,0);<br />

movCurrentSize = [[mMovie attributeForKey:QTMovieCurrentSizeAttribute]<br />

sizeValue];<br />

NSMutableString *sizeString = [NSMutableString string];<br />

}<br />

if (mMovie && [mMovieView isControllerVisible])<br />

movCurrentSize.height -= [mMovieView controllerBarHeight];<br />

[sizeString appendFormat:@"%.0f", movCurrentSize.width];<br />

[sizeString appendString:@" x "];<br />

[sizeString appendFormat:@"%.0f", movCurrentSize.height];<br />

[mCurrentSize setStringValue:sizeString];<br />

12. To set the source text field, add:<br />

- (void)setSource:(NSString *)name<br />

{<br />

NSArray *pathComponents = [[NSFileManager defaultManager]<br />

componentsToDisplayForPath:name];<br />

NSEnumerator *pathEnumerator = [pathComponents objectEnumerator];<br />

NSString *component = [pathEnumerator nextObject];<br />

NSMutableString *displayablePath = [NSMutableString string];<br />

}<br />

while (component != nil) {<br />

if ([component length] > 0) {<br />

[displayablePath appendString:component];<br />

}<br />

component = [pathEnumerator nextObject];<br />

if (component != nil)<br />

[displayablePath appendString:@":"];<br />

} else {<br />

component = [pathEnumerator nextObject];<br />

}<br />

[mSourceName setStringValue:displayablePath];<br />

76 Adding Code To Your QT<strong>Kit</strong>Player Project<br />

2005-11-09 | © 2004, 2005 Apple Computer, Inc. All Rights Reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!