Merge pull request #1364 from walisser/master

Doc-modal/window-modal sheets and other sheet issues [+1]
This commit is contained in:
Alexander Ljungberg committed 2012-08-11 15:59:52 +01:00
commit 1e55b79b49
32 files changed
+6295 -75

No files matched your search

+3
View File
@@ -631,7 +631,10 @@ CPCriticalAlertStyle = 2;
- (@action)_takeReturnCodeFrom:(id)aSender
{
if ([_window isSheet])
{
[CPApp endSheet:_window returnCode:[aSender tag]];
[_window orderOut:nil];
}
else
{
[CPApp abortModal];
+16 -7
View File
@@ -933,15 +933,21 @@ CPRunContinuesResponse = -1002;
*/
- (void)beginSheet:(CPWindow)aSheet modalForWindow:(CPWindow)aWindow modalDelegate:(id)aModalDelegate didEndSelector:(SEL)aDidEndSelector contextInfo:(id)aContextInfo
{
var styleMask = [aSheet styleMask];
if (!(styleMask & CPDocModalWindowMask))
if ([aWindow isSheet])
{
[CPException raise:CPInternalInconsistencyException reason:@"Currently only CPDocModalWindowMask style mask is supported for attached sheets"];
[CPException raise:CPInternalInconsistencyException reason:@"The target window of beginSheet: cannot be a sheet"];
return;
}
[aWindow orderFront:self];
[aSheet setPlatformWindow:[aWindow platformWindow]];
[aSheet._windowView _enableSheet:YES];
// -dw- if a sheet is already visible, we skip this since it serves no purpose and causes
// orderOut: to be called on the sheet, which is not what we want.
if (![aWindow isVisible])
{
[aWindow orderFront:self];
[aSheet setPlatformWindow:[aWindow platformWindow]];
}
[aWindow _attachSheet:aSheet modalDelegate:aModalDelegate didEndSelector:aDidEndSelector contextInfo:aContextInfo];
}
@@ -970,7 +976,7 @@ CPRunContinuesResponse = -1002;
if (context != nil && context["sheet"] === sheet)
{
context["returnCode"] = returnCode;
[aWindow _detachSheetWindow];
[aWindow _endSheet];
return;
}
}
@@ -1192,7 +1198,10 @@ _CPRunModalLoop = function(anEvent)
// yet it works when there is a modal window. Maybe it starts its own modal session, but interaction with the original
// modal window seems to continue working as well. Regardless of correctness, this solution beats popovers not working
// at all from sheets.
if (theWindow == modalSession._window || [theWindow worksWhenModal] || ([theWindow isKindOfClass:_CPAttachedWindow] && [[theWindow targetView] window] === modalSession._window))
if (theWindow == modalSession._window ||
[theWindow worksWhenModal] ||
[theWindow attachedSheet] == modalSession._window || // -dw- allow modal parent of sheet to be repositioned
([theWindow isKindOfClass:_CPAttachedWindow] && [[theWindow targetView] window] === modalSession._window))
[theWindow sendEvent:anEvent];
};
+287 -60
View File
@@ -259,6 +259,16 @@ var CPWindowActionMessageKeys = [
@param window the window to close
@return \c YES allows the window to close. \c NO
vetoes the close operation and leaves the window open.
@delegate -(BOOL)windowWillBeginSheet:(CPNotification)notification;
Sent from the notification center before sheet is visible on
the delegate's window.
@param notification contains information about the event
@delegate -(BOOL)windowDidEndSheet:(CPNotification)notification;
Sent from the notification center when an attached sheet on the
delegate's window has been animated out and is no longer visible.
@param notification contains information about the event
*/
@implementation CPWindow : CPResponder
{
@@ -335,7 +345,6 @@ var CPWindowActionMessageKeys = [
CPDictionary _sheetContext;
CPWindow _parentView;
BOOL _isSheet;
_CPWindowFrameAnimation _frameAnimation;
}
@@ -405,10 +414,13 @@ CPTexturedBackgroundWindowMask
_isFullPlatformWindow = NO;
_registeredDraggedTypes = [CPSet set];
_registeredDraggedTypesArray = [];
_isSheet = NO;
_acceptsMouseMovedEvents = YES;
_isMovable = YES;
_isSheet = NO;
_sheetContext = nil;
_parentView = nil;
// Set up our window number.
_windowNumber = [CPApp._windows count];
CPApp._windows[_windowNumber] = self;
@@ -764,7 +776,21 @@ CPTexturedBackgroundWindowMask
[_windowView setFrameSize:size];
if (_hasShadow)
[_shadowView setFrameSize:_CGSizeMake(SHADOW_MARGIN_LEFT + size.width + SHADOW_MARGIN_RIGHT, SHADOW_MARGIN_BOTTOM + size.height + SHADOW_MARGIN_TOP + SHADOW_DISTANCE)];
{
// if the shadow would be taller/wider than the window height,
// make it the same as the window height. this allows views to
// become 0,0 with no shadow on them and makes the sheet
// animation look nicer
var shadowSize = _CGSizeMake(size.width,size.height);
if (size.width >= (SHADOW_MARGIN_LEFT + SHADOW_MARGIN_RIGHT))
shadowSize.width += SHADOW_MARGIN_LEFT + SHADOW_MARGIN_RIGHT;
if (size.height >= (SHADOW_MARGIN_BOTTOM + SHADOW_MARGIN_TOP + SHADOW_DISTANCE))
shadowSize.height += SHADOW_MARGIN_BOTTOM + SHADOW_MARGIN_TOP + SHADOW_DISTANCE;
[_shadowView setFrameSize:shadowSize];
}
if (!_isAnimating)
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowDidResizeNotification object:self];
@@ -801,6 +827,10 @@ CPTexturedBackgroundWindowMask
- (void)setFrameOrigin:(CGPoint)anOrigin
{
[self _setClippedFrame:_CGRectMake(anOrigin.x, anOrigin.y, _CGRectGetWidth(_frame), _CGRectGetHeight(_frame)) display:YES animate:NO];
// reposition sheet
if ([self attachedSheet])
[self _setAttachedSheetFrameOrigin];
}
/*!
@@ -819,6 +849,10 @@ CPTexturedBackgroundWindowMask
- (void)orderFront:(id)aSender
{
#if PLATFORM(DOM)
// -dw- if a sheet is clicked, the parent window should come up too
if ([self isSheet])
[_parentView orderFront:self];
[_platformWindow orderFront:self];
[_platformWindow order:CPWindowAbove window:self relativeTo:nil];
#endif
@@ -849,6 +883,13 @@ CPTexturedBackgroundWindowMask
*/
- (void)orderOut:(id)aSender
{
if ([self isSheet])
{
// -dw- as in Cocoa, orderOut: detaches the sheet and animates out
[self._parentView _detachSheetWindow];
return;
}
#if PLATFORM(DOM)
if ([self _sharesChromeWithPlatformWindow])
[_platformWindow orderOut:self];
@@ -1209,6 +1250,8 @@ CPTexturedBackgroundWindowMask
[defaultCenter removeObserver:_delegate name:CPWindowDidResignMainNotification object:self];
[defaultCenter removeObserver:_delegate name:CPWindowDidMoveNotification object:self];
[defaultCenter removeObserver:_delegate name:CPWindowDidResizeNotification object:self];
[defaultCenter removeObserver:_delegate name:CPWindowWillBeginSheetNotification object:self];
[defaultCenter removeObserver:_delegate name:CPWindowDidEndSheetNotification object:self];
_delegate = aDelegate;
_delegateRespondsToWindowWillReturnUndoManagerSelector = [_delegate respondsToSelector:@selector(windowWillReturnUndoManager:)];
@@ -1254,6 +1297,20 @@ CPTexturedBackgroundWindowMask
selector:@selector(windowDidResize:)
name:CPWindowDidResizeNotification
object:self];
if ([_delegate respondsToSelector:@selector(windowWillBeginSheet:)])
[defaultCenter
addObserver:_delegate
selector:@selector(windowWillBeginSheet:)
name:CPWindowWillBeginSheetNotification
object:self];
if ([_delegate respondsToSelector:@selector(windowDidEndSheet:)])
[defaultCenter
addObserver:_delegate
selector:@selector(windowDidEndSheet:)
name:CPWindowDidEndSheetNotification
object:self];
}
/*!
@@ -1534,6 +1591,31 @@ CPTexturedBackgroundWindowMask
var type = [anEvent type],
point = [anEvent locationInWindow];
// If a sheet is attached events get filtered here.
// It is not clear what events should be passed to the view, perhaps all?
// CPLeftMouseDown is needed for window moving and resizing to work.
// CPMouseMoved is needed for rollover effects on title bar buttons.
var sheet = [self attachedSheet];
if (sheet)
{
switch (type)
{
case CPLeftMouseDown:
[_windowView mouseDown:anEvent];
// -dw- if the window is clicked, the sheet should come to front, and become key,
// and the window should be immediately behind
[self orderFront:self];
[sheet makeKeyAndOrderFront:self];
break;
case CPMouseMoved:
[_windowView mouseMoved:anEvent];
break;
}
return;
}
switch (type)
{
case CPFlagsChanged: return [[self firstResponder] flagsChanged:anEvent];
@@ -2284,62 +2366,124 @@ CPTexturedBackgroundWindowMask
[attachedSheet setFrame:sheetFrame display:YES animate:NO];
}
/* @ignore */
- (void)_attachSheet:(CPWindow)aSheet modalDelegate:(id)aModalDelegate didEndSelector:(SEL)aDidEndSelector contextInfo:(id)aContextInfo
/* @ignore
Starting point for sheet session, called from CPApplication beginSheet:
*/
- (void)_attachSheet:(CPWindow)aSheet modalDelegate:(id)aModalDelegate
didEndSelector:(SEL)aDidEndSelector contextInfo:(id)aContextInfo
{
if (_sheetContext)
{
[CPException raise:CPInternalInconsistencyException
reason:@"The target window of beginSheet: already has a sheet, did you forget orderOut: ?"];
return;
}
var sheetFrame = [aSheet frame];
_sheetContext = {"sheet":aSheet, "modalDelegate":aModalDelegate, "endSelector":aDidEndSelector, "contextInfo":aContextInfo, "frame":CGRectMakeCopy(sheetFrame), "returnCode":-1, "opened": NO};
_sheetContext = {"sheet":aSheet, "modalDelegate":aModalDelegate, "endSelector":aDidEndSelector,
"contextInfo":aContextInfo, "frame":CGRectMakeCopy(sheetFrame), "returnCode":-1,
"opened": NO };
[self _attachSheetWindow:aSheet];
[self _attachSheetWindow];
}
/* @ignore */
- (void)_attachSheetWindow:(CPWindow)aSheet
/* @ignore
Called to animate the sheet in. The timer seems to solve a bug where sheets would
be partially animated under certain conditions.
*/
- (void)_attachSheetWindow
{
var sheetFrame = [aSheet frame],
frame = [self frame],
sheetContent = [aSheet contentView];
_sheetContext["isAttached"] = YES;
[self _setUpMasksForView:sheetContent];
aSheet._isSheet = YES;
aSheet._parentView = self;
var originx = frame.origin.x + FLOOR((frame.size.width - sheetFrame.size.width) / 2),
originy = frame.origin.y + [[self contentView] frame].origin.y,
startFrame = CGRectMake(originx, originy, sheetFrame.size.width, 0),
endFrame = CGRectMake(originx, originy, sheetFrame.size.width, sheetFrame.size.height);
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowWillBeginSheetNotification object:self];
[CPApp runModalForWindow:aSheet];
[aSheet orderFront:self];
[aSheet setFrame:startFrame display:YES animate:NO];
_sheetContext["opened"] = YES;
[aSheet _setFrame:endFrame delegate:self duration:[self animationResizeTime:endFrame] curve:CPAnimationEaseOut];
// Should run the main loop here until _isAnimating = FALSE
[aSheet becomeKeyWindow];
// it would be ideal to block here and spin an event loop, until attach is complete
[CPTimer scheduledTimerWithTimeInterval:0.0
target:self
selector:@selector(_sheetShouldAnimateIn:)
userInfo:nil
repeats:NO];
}
/* @ignore */
/* @ignore
Called to end the sheet. Note that orderOut: is needed to animate the sheet out, as in Cocoa.
The sheet isn't completely gone until _cleanupSheetWindow gets called.
*/
- (void)_endSheet
{
var delegate = _sheetContext["modalDelegate"],
endSelector = _sheetContext["endSelector"];
// if the sheet has been ordered out, defer didEndSelector until after sheet animates out,
// this must be done since we cannot block an wait for the animation to complete
if (delegate != nil && endSelector != nil)
{
if (_sheetContext["isAttached"])
objj_msgSend(delegate, endSelector, _sheetContext["sheet"], _sheetContext["returnCode"],
_sheetContext["contextInfo"]);
else
_sheetContext["deferDidEndSelector"] = YES;
}
}
/* @ignore
Called to animate the sheet out. If called while animating in, schedules an animate
out at completion
*/
- (void)_detachSheetWindow
{
var sheet = [self attachedSheet],
startFrame = [sheet frame],
endFrame = CGRectMakeCopy(startFrame);
_sheetContext["isAttached"] = NO;
endFrame.size.height = 0;
// it would be ideal to block here and spin the event loop, until attach is complete
[CPTimer scheduledTimerWithTimeInterval:0.0
target:self
selector:@selector(_sheetShouldAnimateOut:)
userInfo:nil
repeats:NO];
}
_sheetContext["frame"] = startFrame;
/* @ignore
Called to cleanup sheet, when we are definitely done with it
*/
- (void)_cleanupSheetWindow
{
var sheet = _sheetContext["sheet"],
lastFrame = _sheetContext["frame"],
deferDidEnd = _sheetContext["deferDidEndSelector"];
var sheetContent = [sheet contentView];
[self _setUpMasksForView:sheetContent];
[sheet setFrame:lastFrame];
[self _restoreMasksForView:[sheet contentView]];
_sheetContext["opened"] = NO;
[sheet _setFrame:endFrame delegate:self duration:[self animationResizeTime:endFrame] curve:CPAnimationEaseIn];
// if the parent window is modal, the sheet started its own modal session
if (sheet._isModal)
[CPApp stopModal];
// restore the state of window before it was sheetified
[sheet._windowView _enableSheet:NO];
// close it
sheet._isSheet = NO;
[sheet orderOut:self];
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowDidEndSheetNotification object:self];
if (deferDidEnd)
{
var delegate = _sheetContext["modalDelegate"],
selector = _sheetContext["endSelector"],
returnCode = _sheetContext["returnCode"],
contextInfo = _sheetContext["contextInfo"];
// context must be destroyed, since didEnd might want to attach another sheet
_sheetContext = nil;
sheet._parentView = nil;
objj_msgSend(delegate, selector, sheet, returnCode, contextInfo);
}
else
{
_sheetContext = nil;
sheet._parentView = nil;
}
}
/* @ignore */
@@ -2349,34 +2493,117 @@ CPTexturedBackgroundWindowMask
if (anim._window != sheet)
return;
var sheetContent = [sheet contentView];
[CPTimer scheduledTimerWithTimeInterval:0.0
target:self
selector:@selector(_sheetAnimationDidEnd:)
userInfo:nil
repeats:NO];
}
if (_sheetContext["opened"] === YES)
/* @ignore */
- (void)_sheetShouldAnimateIn:(CPTimer)timer
{
// can't open sheet while opening or closing animation is going on
if (_sheetContext["isOpening"] ||
_sheetContext["isClosing"])
return;
var sheet = _sheetContext["sheet"],
sheetFrame = [sheet frame],
frame = [self frame];
[self _setUpMasksForView:[sheet contentView]];
sheet._isSheet = YES;
sheet._parentView = self;
var originx = frame.origin.x + FLOOR((frame.size.width - sheetFrame.size.width) / 2),
originy = frame.origin.y + [[self contentView] frame].origin.y,
startFrame = CGRectMake(originx, originy, sheetFrame.size.width, 0),
endFrame = CGRectMake(originx, originy, sheetFrame.size.width, sheetFrame.size.height);
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowWillBeginSheetNotification object:self];
// if sheet is attached to a modal window, the sheet runs
// as if itself and the parent window are modal
sheet._isModal = NO;
if ([CPApp modalWindow] === self)
{
[self _restoreMasksForView:sheetContent];
[CPApp runModalForWindow:sheet];
sheet._isModal = YES;
}
[sheet orderFront:self];
[sheet setFrame:startFrame display:YES animate:NO];
_sheetContext["opened"] = YES;
_sheetContext["shouldClose"] = NO;
_sheetContext["isOpening"] = YES;
[sheet _setFrame:endFrame delegate:self duration:[self animationResizeTime:endFrame] curve:CPAnimationEaseOut];
// NOTE: cocoa doesn't make window key until animation is done, but a
// keypress while animating eventually gets to the window. Therefore,
// there must be a runloop specifically designed for sheets?
[sheet becomeKeyWindow];
}
/* @ignore */
- (void)_sheetShouldAnimateOut:(CPTimer)timer
{
var sheet = _sheetContext["sheet"],
startFrame = [sheet frame],
endFrame = CGRectMakeCopy(startFrame);
if (_sheetContext["isOpening"])
{
// allow sheet to be closed while opening, it will close when animate in completes
_sheetContext["shouldClose"] = YES;
return;
}
[CPApp stopModal];
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowDidEndSheetNotification object:self];
if (_sheetContext["isClosing"])
return;
[sheet orderOut:self];
_sheetContext["opened"] = NO;
_sheetContext["frame"] = startFrame;
_sheetContext["isClosing"] = YES;
var lastFrame = _sheetContext["frame"];
[sheet setFrame:lastFrame];
// the parent window can be orderedOut to disable the sheet animate out, as in Cocoa
if ([self isVisible])
{
endFrame.size.height = 0;
[self _setUpMasksForView:[sheet contentView]];
[sheet _setFrame:endFrame delegate:self duration:[self animationResizeTime:endFrame] curve:CPAnimationEaseIn];
}
else
{
[self _sheetAnimationDidEnd:nil];
}
}
[self _restoreMasksForView:sheetContent];
/* @ignore */
- (void)_sheetAnimationDidEnd:(CPTimer)timer
{
var sheet = _sheetContext["sheet"];
var delegate = _sheetContext["modalDelegate"],
endSelector = _sheetContext["endSelector"],
returnCode = _sheetContext["returnCode"],
contextInfo = _sheetContext["contextInfo"];
_sheetContext["isOpening"] = NO;
_sheetContext["isClosing"] = NO;
_sheetContext = nil;
sheet._parentView = nil;
if (_sheetContext["opened"] === YES)
{
// sheet is open and completely visible
[self _restoreMasksForView:[sheet contentView]];
if (delegate != nil && endSelector != nil)
objj_msgSend(delegate, endSelector, sheet, returnCode, contextInfo);
// we wanted to close the sheet while it animated in, do that now
if (_sheetContext["shouldClose"] === YES)
[self _detachSheetWindow];
}
else
{
// sheet is closed and not visible
[self _cleanupSheetWindow];
}
}
- (void)_setUpMasksForView:(CPView)aView
+6
View File
@@ -54,4 +54,10 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
return aContentRect;
}
- (void)_enableSheet:(BOOL)enable
{
// do nothing, already a sheet
}
@end
+31 -1
View File
@@ -208,8 +208,38 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
[_titleField setFrame:CGRectMake(20.0, 3.0, width - 40.0, CGRectGetHeight([_titleField frame]))];
var maxY = [self toolbarMaxY];
if ([_titleField isHidden])
maxY -= ([self toolbarOffset]).height;
[[theWindow contentView] setFrameOrigin:CGPointMake(0.0, maxY, width, CGRectGetHeight(bounds) - maxY)];
var contentRect = CGRectMake(0.0, maxY, width, CGRectGetHeight(bounds) - maxY);
[[theWindow contentView] setFrame:contentRect];
}
- (void)_enableSheet:(BOOL)enable
{
[super _enableSheet:enable];
[_closeButton setHidden:enable];
[_titleField setHidden:enable];
// resize the window
var window = [self window],
frame = [window frame];
var dy = ([self toolbarOffset]).height;
if (enable)
dy = -dy;
var newHeight = CGRectGetMaxY(frame) + dy,
newWidth = CGRectGetMaxX(frame);
frame.size.height += dy;
[self setFrameSize:CGSizeMake(newWidth, newHeight)];
[self tile];
[window setFrame:frame display:NO animate:NO];
[window setMovableByWindowBackground:!enable];
}
@end
+42 -4
View File
@@ -331,7 +331,9 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
[_headView setFrameSize:CGSizeMake(width, [self toolbarMaxY])];
[_dividerView setFrame:CGRectMake(0.0, CGRectGetMaxY([_headView frame]), width, 1.0)];
var dividerMaxY = CGRectGetMaxY([_dividerView frame]);
var dividerMaxY = 0;
if (![_dividerView isHidden])
dividerMaxY = CGRectGetMaxY([_dividerView frame]);
[_bodyView setFrame:CGRectMake(0.0, dividerMaxY, width, CGRectGetHeight(bounds) - dividerMaxY)];
@@ -344,7 +346,9 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
[_titleField setFrame:CGRectMake(leftOffset, 5.0, width - leftOffset * 2.0, CGRectGetHeight([_titleField frame]))];
[[theWindow contentView] setFrameOrigin:CGPointMake(0.0, CGRectGetMaxY([_dividerView frame]))];
var contentRect = CGRectMake(0.0, dividerMaxY, width, CGRectGetHeight([_bodyView frame]));
[[theWindow contentView] setFrame:contentRect];
}
/*
- (void)setAnimatingToolbar:(BOOL)isAnimatingToolbar
@@ -401,10 +405,44 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
- (void)mouseDown:(CPEvent)anEvent
{
if (CGRectContainsPoint([_headView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil]))
return [self trackMoveWithEvent:anEvent];
if (![_headView isHidden])
if (CGRectContainsPoint([_headView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil]))
return [self trackMoveWithEvent:anEvent];
[super mouseDown:anEvent];
}
- (void)_enableSheet:(BOOL)enable
{
[super _enableSheet:enable];
[_headView setHidden:enable];
[_dividerView setHidden:enable];
[_closeButton setHidden:enable];
[_minimizeButton setHidden:enable];
[_titleField setHidden:enable];
if (enable)
[_bodyView setBackgroundColor:[_CPDocModalWindowView bodyBackgroundColor]];
else
[_bodyView setBackgroundColor:[[self class] bodyBackgroundColor]];
// resize the window
var window = [self window],
frame = [window frame];
var dy = CGRectGetHeight([_headView frame]) + CGRectGetHeight([_dividerView frame]);
if (enable)
dy = -dy;
var newHeight = CGRectGetMaxY(frame) + dy,
newWidth = CGRectGetMaxX(frame);
frame.size.height += dy;
[self setFrameSize:CGSizeMake(newWidth, newHeight)];
[self tile];
[window setFrame:frame display:NO animate:NO];
}
@end
+30 -1
View File
@@ -41,6 +41,8 @@ var _CPWindowViewResizeIndicatorImage = nil;
CGPoint _mouseDraggedPoint;
CGRect _cachedScreenFrame;
CPView _sheetShadowView;
}
+ (void)initialize
@@ -195,7 +197,6 @@ var _CPWindowViewResizeIndicatorImage = nil;
location = [theWindow convertBaseToGlobal:[anEvent locationInWindow]],
origin = [self _pointWithinScreenFrame:CGPointMake(_CGRectGetMinX(frame) + (location.x - _mouseDraggedPoint.x),
_CGRectGetMinY(frame) + (location.y - _mouseDraggedPoint.y))];
[theWindow setFrameOrigin:origin];
_mouseDraggedPoint = [self _pointWithinScreenFrame:location];
@@ -204,6 +205,17 @@ var _CPWindowViewResizeIndicatorImage = nil;
[CPApp setTarget:self selector:@selector(trackMoveWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
}
- (void)setFrameSize:(CGSize)newSize
{
[super setFrameSize:newSize];
// reposition sheet if the parent window resizes or moves
var theWindow = [self window];
if ([theWindow attachedSheet])
[theWindow _setAttachedSheetFrameOrigin];
}
- (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator
{
if (shouldShowResizeIndicator)
@@ -367,4 +379,21 @@ var _CPWindowViewResizeIndicatorImage = nil;
[self addSubview:_resizeIndicator];
}
- (void)_enableSheet:(BOOL)enable
{
if (enable)
{
var bundle = [CPBundle bundleForClass:[CPWindow class]];
_sheetShadowView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([self bounds]), 8)];
[_sheetShadowView setAutoresizingMask:CPViewWidthSizable];
[_sheetShadowView setBackgroundColor:[CPColor colorWithPatternImage:[[CPImage alloc]
initWithContentsOfFile:[bundle pathForResource:@"CPWindow/CPWindowAttachedSheetShadow.png"] size:CGSizeMake(9,8)]]];
[self addSubview:_sheetShadowView];
}
else
{
[_sheetShadowView removeFromSuperview];
}
}
@end
@@ -0,0 +1,25 @@
@import <Foundation/CPObject.j>
@import "SheetWindowController.j"
@implementation AppController : CPObject
{
SheetController _sheetController;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
}
- (void)awakeFromCib
{
_sheetController = [ [SheetWindowController alloc] initWithWindowCibName:@"Window"];
[self newDocument:self];
}
- (void)newDocument:(id)sender
{
[_sheetController newWindow:self];
}
@end
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>TestSheet</string>
</dict>
</plist>
+93
View File
@@ -0,0 +1,93 @@
/*
* Jakefile
* AttachedSheet2
*
* Created by Saikat Chakrabarti on March 16, 2010.
* Copyright 2010, gomockingbird.com All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("AttachedSheet2", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "AttachedSheet2.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("AttachedSheet2");
task.setIdentifier("com.gomockingbird.AttachedSheet2");
task.setVersion("1.0");
task.setAuthor("Saikat Chakrabarti and Sheena Pakanati");
task.setEmail("contact @nospam@ gomockingbird.com");
task.setSummary("AttachedSheet2");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/*"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
function printResults(configuration)
{
print("----------------------------")
print(configuration+" app built at path: "+FILE.join("Build", configuration, "AttachedSheet2"));
print("----------------------------")
}
task ("default", ["AttachedSheet2"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "AttachedSheet2", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "AttachedSheet2", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "AttachedSheet2"));
OS.system(["press", "-f", FILE.join("Build", "Release", "AttachedSheet2"), FILE.join("Build", "Deployment", "AttachedSheet2")]);
printResults("Deployment")
});
task ("press", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Press", "AttachedSheet2"));
OS.system(["press", "-f", FILE.join("Build", "Release", "AttachedSheet2"), FILE.join("Build", "Press", "AttachedSheet2")]);
});
task ("flatten", ["press"], function()
{
FILE.mkdirs(FILE.join("Build", "Flatten", "AttachedSheet2"));
OS.system(["flatten", "-f", "--verbose", "--split", "3", "-c", "closure-compiler", FILE.join("Build", "Press", "AttachedSheet2"), FILE.join("Build", "Flatten", "AttachedSheet2")]);
});
@@ -0,0 +1 @@
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;D;K;6;CP$UIDd;2;17E;D;K;6;CP$UIDd;2;18E;D;K;6;CP$UIDd;2;19E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;21E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;27E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;29E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;31E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;2;36E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;2;49E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;52E;D;K;6;CP$UIDd;2;53E;D;K;6;CP$UIDd;2;54E;D;K;6;CP$UIDd;2;55E;D;K;6;CP$UIDd;2;56E;D;K;6;CP$UIDd;2;57E;D;K;6;CP$UIDd;2;58E;D;K;6;CP$UIDd;2;59E;D;K;6;CP$UIDd;2;60E;D;K;6;CP$UIDd;2;61E;D;K;6;CP$UIDd;2;62E;D;K;6;CP$UIDd;2;63E;D;K;6;CP$UIDd;2;64E;D;K;6;CP$UIDd;2;65E;D;K;6;CP$UIDd;2;66E;D;K;6;CP$UIDd;2;67E;D;K;6;CP$UIDd;2;68E;D;K;6;CP$UIDd;2;69E;D;K;6;CP$UIDd;2;70E;D;K;6;CP$UIDd;2;71E;D;K;6;CP$UIDd;2;72E;D;K;6;CP$UIDd;2;73E;D;K;6;CP$UIDd;2;74E;D;K;6;CP$UIDd;2;75E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;76E;D;K;6;CP$UIDd;2;78E;D;K;6;CP$UIDd;2;80E;D;K;6;CP$UIDd;2;81E;D;K;6;CP$UIDd;2;82E;D;K;6;CP$UIDd;2;83E;D;K;6;CP$UIDd;2;84E;D;K;6;CP$UIDd;2;85E;D;K;6;CP$UIDd;2;86E;D;K;6;CP$UIDd;2;87E;D;K;6;CP$UIDd;2;88E;D;K;6;CP$UIDd;2;89E;D;K;6;CP$UIDd;2;90E;D;K;6;CP$UIDd;2;91E;D;K;6;CP$UIDd;2;92E;D;K;6;CP$UIDd;2;93E;D;K;6;CP$UIDd;2;94E;D;K;6;CP$UIDd;2;95E;D;K;6;CP$UIDd;2;96E;D;K;6;CP$UIDd;2;97E;D;K;6;CP$UIDd;2;98E;D;K;6;CP$UIDd;2;99E;D;K;6;CP$UIDd;3;100E;D;K;6;CP$UIDd;3;101E;D;K;6;CP$UIDd;3;102E;D;K;6;CP$UIDd;3;103E;D;K;6;CP$UIDd;3;104E;D;K;6;CP$UIDd;3;105E;D;K;6;CP$UIDd;3;106E;D;K;6;CP$UIDd;3;107E;D;K;6;CP$UIDd;3;108E;D;K;6;CP$UIDd;3;109E;D;K;6;CP$UIDd;3;110E;D;K;6;CP$UIDd;3;111E;D;K;6;CP$UIDd;3;112E;D;K;6;CP$UIDd;3;113E;D;K;6;CP$UIDd;3;114E;D;K;6;CP$UIDd;3;115E;D;K;6;CP$UIDd;3;116E;D;K;6;CP$UIDd;3;117E;D;K;6;CP$UIDd;3;118E;D;K;6;CP$UIDd;3;119E;D;K;6;CP$UIDd;3;120E;D;K;6;CP$UIDd;3;121E;D;K;6;CP$UIDd;3;122E;D;K;6;CP$UIDd;3;123E;D;K;6;CP$UIDd;3;124E;D;K;6;CP$UIDd;3;125E;D;K;6;CP$UIDd;3;126E;D;K;6;CP$UIDd;3;127E;D;K;6;CP$UIDd;3;128E;D;K;6;CP$UIDd;3;129E;D;K;6;CP$UIDd;3;130E;D;K;6;CP$UIDd;3;131E;D;K;6;CP$UIDd;3;132E;D;K;6;CP$UIDd;3;133E;D;K;6;CP$UIDd;3;134E;D;K;6;CP$UIDd;3;135E;D;K;6;CP$UIDd;3;136E;D;K;6;CP$UIDd;3;137E;D;K;6;CP$UIDd;3;138E;D;K;6;CP$UIDd;3;139E;D;K;6;CP$UIDd;3;140E;D;K;6;CP$UIDd;3;141E;D;K;6;CP$UIDd;3;142E;D;K;6;CP$UIDd;3;143E;D;K;6;CP$UIDd;3;144E;D;K;6;CP$UIDd;3;145E;D;K;6;CP$UIDd;3;146E;D;K;6;CP$UIDd;3;147E;D;K;6;CP$UIDd;3;148E;D;K;6;CP$UIDd;3;149E;D;K;6;CP$UIDd;3;150E;D;K;6;CP$UIDd;3;151E;D;K;6;CP$UIDd;3;152E;D;K;6;CP$UIDd;3;153E;D;K;6;CP$UIDd;3;154E;D;K;6;CP$UIDd;3;155E;D;K;6;CP$UIDd;3;156E;D;K;6;CP$UIDd;3;157E;D;K;6;CP$UIDd;3;158E;D;K;6;CP$UIDd;3;159E;D;K;6;CP$UIDd;3;160E;D;K;6;CP$UIDd;3;161E;D;K;6;CP$UIDd;3;162E;D;K;6;CP$UIDd;3;163E;D;K;6;CP$UIDd;3;164E;D;K;6;CP$UIDd;3;165E;D;K;6;CP$UIDd;3;166E;D;K;6;CP$UIDd;3;167E;D;K;6;CP$UIDd;3;168E;D;K;6;CP$UIDd;3;169E;D;K;6;CP$UIDd;3;170E;D;K;6;CP$UIDd;3;171E;D;K;6;CP$UIDd;3;172E;D;K;6;CP$UIDd;3;173E;D;K;6;CP$UIDd;3;174E;D;K;6;CP$UIDd;3;175E;D;K;6;CP$UIDd;3;176E;D;K;6;CP$UIDd;3;177E;D;K;6;CP$UIDd;3;178E;D;K;6;CP$UIDd;3;179E;D;K;6;CP$UIDd;3;180E;D;K;6;CP$UIDd;3;181E;D;K;6;CP$UIDd;3;182E;D;K;6;CP$UIDd;3;183E;D;K;6;CP$UIDd;3;184E;D;K;6;CP$UIDd;3;185E;D;K;6;CP$UIDd;3;186E;D;K;6;CP$UIDd;3;187E;D;K;6;CP$UIDd;3;188E;D;K;6;CP$UIDd;3;189E;D;K;6;CP$UIDd;3;190E;D;K;6;CP$UIDd;3;191E;D;K;6;CP$UIDd;3;192E;D;K;6;CP$UIDd;3;193E;D;K;6;CP$UIDd;3;194E;D;K;6;CP$UIDd;3;195E;D;K;6;CP$UIDd;3;196E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;78E;D;K;6;CP$UIDd;2;80E;D;K;6;CP$UIDd;2;81E;D;K;6;CP$UIDd;2;81E;D;K;6;CP$UIDd;2;81ELine truncated
File diff suppressed because it is too large. Load diff
@@ -0,0 +1 @@
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;17E;D;K;6;CP$UIDd;2;18E;D;K;6;CP$UIDd;2;19E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;21E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;27E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;31E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;35E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;36E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;49E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;52E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;53E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;55E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;56E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;57E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;58E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;59E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;60E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;61E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;63E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;64E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;65E;D;K;6;CP$UIDd;1;0E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;49E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;52E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;53E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;55E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;56E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;57E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;58E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;59E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;60E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;61E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;63E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;64E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;65E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;66E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;67E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;61E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;68E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;49E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;69E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;60E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;70E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;51E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;71E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;53E;K;23;_CPCibConnectorLabelLine truncated
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,484 @@
@implementation SheetWindowController : CPWindowController
{
@outlet CPButton _closeButton;
@outlet CPButton _sheetWindowHackCheckbox;
@outlet CPButton _altCloseButton;
@outlet CPButton _otherCloseButton;
@outlet CPButton _orderOutAfterCheckbox;
@outlet CPRadioGroup _windowTypeMatrix;
@outlet CPButton _titledMaskButton;
@outlet CPButton _closableMaskButton;
@outlet CPButton _miniaturizableMaskButton;
@outlet CPButton _resizableMaskButton;
@outlet CPButton _shadeWindowView;
@outlet CPButton _shadeContentView;
@outlet CPButton _shadeParentWindow;
CPModalSession _modalSession;
CPWindow _parentWindow;
CPWindow _sheet;
int _returnCode;
CPColor _savedColor;
}
- (void)initWithWindowCibName:(CPString)cibName
{
CPLog.debug("[%@ %@]", [self class], _cmd);
self = [super initWithWindowCibName:cibName];
_closeButton = nil;
return self;
}
- (void)positionWindow
{
var keyWindow = [CPApp keyWindow],
origin = CPPointMake(40,40);
if (keyWindow)
{
origin = ([keyWindow frame]).origin;
origin = CPPointMake(origin.x + 20, origin.y + 20);
}
[[self window] setFrameOrigin:origin];
}
- (void)awakeFromCib
{
CPLog.debug("[%@ %@]", [self class], _cmd);
if (!_closeButton)
CPLog.fatal("_closeButton is not connected!");
[_closeButton setTarget:self];
[_closeButton setAction:@selector(unsetAction:)];
[_altCloseButton setTarget:self];
[_altCloseButton setAction:@selector(unsetAction:)];
[_otherCloseButton setTarget:self];
[_otherCloseButton setAction:@selector(unsetAction:)];
}
- (void)unsetAction:(id)sender
{
CPLog.warn("No action set on this %@", [sender class]);
}
- (void)addButtons:(CPWindow)window
{
var x = 10,
unsetAction = @selector(unsetAction:);
_closeButton = [ [CPButton alloc] initWithFrame:CGRectMake(x,10,32,100)];
[_closeButton setTitle:@"Close"];
[_closeButton setButtonType:CPMomentaryPushInButton];
[_closeButton setBezelStyle:CPBezelBorder];
[_closeButton sizeToFit];
[_closeButton setTarget:self];
[_closeButton setAction:unsetAction];
[[window contentView] addSubview:_closeButton positioned:CPWindowAbove relativeTo:nil];
x += 10 + CGRectGetWidth([_closeButton frame]);
_altCloseButton = [ [CPButton alloc] initWithFrame:CGRectMake(x, 10,32,100)];
[_altCloseButton setTitle:@"Close Parent Too"];
[_altCloseButton setButtonType:CPMomentaryPushInButton];
[_altCloseButton setBezelStyle:CPBezelBorder];
[_altCloseButton sizeToFit];
[_altCloseButton setTarget:self];
[_altCloseButton setAction:unsetAction];
[[window contentView] addSubview:_altCloseButton positioned:CPWindowAbove relativeTo:nil];
x += 10 + CGRectGetWidth([_altCloseButton frame]);
_otherCloseButton = [ [CPButton alloc] initWithFrame:CGRectMake(x, 10,32,100)];
[_otherCloseButton setTitle:@"Chain Sheets"];
[_otherCloseButton setButtonType:CPMomentaryPushInButton];
[_otherCloseButton setBezelStyle:CPBezelBorder];
[_otherCloseButton sizeToFit];
[_otherCloseButton setTarget:self];
[_otherCloseButton setAction:unsetAction];
[[window contentView] addSubview:_otherCloseButton positioned:CPWindowAbove relativeTo:nil];
}
- (SheetWindowController)initWithStyleMask:(int)styleMask debug:(int)debug
{
CPLog.debug("[%@ %@] mask=%d radioGroup=%@", [self class], _cmd, styleMask, _windowTypeMatrix);
if (styleMask < 0)
return [self initWithWindowCibName:@"Window"];
var window = [ [CPWindow alloc] initWithContentRect:CGRectMake(0,0,400,300) styleMask:styleMask];
if (debug & 1)
[window setBackgroundColor:[CPColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:0.5]];
if (debug & 2)
[[window contentView] setBackgroundColor:[CPColor colorWithCalibratedRed:0.0 green:0.0 blue:1.0 alpha:0.5]];
if (self = [super initWithWindow:window])
[self addButtons:window];
return self;
}
- (SheetWindowController)allocController
{
CPLog.debug("[%@ %@] groupClass=%@", [self class], _cmd,
[ [ [ [ [_windowTypeMatrix subviews] objectAtIndex:0] radioGroup] selectedRadio] tag]);
var type = 1;
if (_windowTypeMatrix)
type = [ [ [ [ [_windowTypeMatrix subviews] objectAtIndex:0] radioGroup] selectedRadio] tag];
var styleMask = 0;
if ([_titledMaskButton state])
styleMask |= CPTitledWindowMask;
if ([_closableMaskButton state])
styleMask |= CPClosableWindowMask;
if ([_miniaturizableMaskButton state])
styleMask |= CPMiniaturizableWindowMask;
switch (type)
{
case 2:
styleMask |= CPHUDBackgroundWindowMask;
break;
case 3:
styleMask = CPBorderlessWindowMask;
break;
case 4:
styleMask |= CPTexturedBackgroundWindowMask;
break;
case 5:
styleMask = CPDocModalWindowMask;
break;
default:
}
if ([_resizableMaskButton state])
styleMask |= CPResizableWindowMask;
if (type == 1)
styleMask = -1;
var debug = 0;
if ([_shadeWindowView state])
debug |= 1;
if ([_shadeContentView state])
debug |= 2;
return [[SheetWindowController alloc] initWithStyleMask:styleMask debug:debug];
}
- (SheetWindowController)allocWithPanel:(CPPanel)panel
{
return [[SheetWindowController alloc] initWithWindow:panel];
}
- (void)disableUnlinkedButtons
{
CPLog.debug("[%@ %@]", [self class], _cmd);
var unsetSelector = @selector(unsetAction:);
if (_closeButton)
[_closeButton setEnabled:[_closeButton action] != unsetSelector];
if (_altCloseButton)
[_altCloseButton setEnabled:[_altCloseButton action] != unsetSelector];
if (_otherCloseButton)
[_otherCloseButton setEnabled:[_otherCloseButton action] != unsetSelector];
}
//
// Normal window
//
- (void)newDocument:(id)sender
{
[self newWindow:sender];
}
- (void)newWindow:(id)sender
{
[[self allocController] runNormalWindow];
}
- (void)runNormalWindow
{
CPLog.debug("[%@ %@]", [self class], _cmd);
[self positionWindow];
[[self window] setTitle:@"Normal Window"];
[_closeButton setTarget:[self window]];
[_closeButton setAction:@selector(orderOut:)];
[self disableUnlinkedButtons];
[self showWindow:self];
}
//
// Modal window
//
- (void)newModalWindow:(id)sender
{
[[self allocController] runModalWindow];
}
- (void)runModalWindow
{
CPLog.debug("[%@ %@]", [self class], _cmd);
[[self window] setTitle:@"Modal Window"];
[[self window] setDelegate:self];
[_closeButton setTarget:self];
[_closeButton setAction:@selector(endModalWindow:)];
[self disableUnlinkedButtons];
//[self showWindow:self];
[CPApp runModalForWindow:[self window]];
}
- (void)endModalWindow:(id)sender
{
CPLog.debug("[%@ %@]", [self class], _cmd);
// performClose shouldn't work, if the window has no close button
if ([[self window] styleMask] & CPClosableWindowMask)
[[self window] performClose:self];
else
[[self window] close];
}
- (void)windowWillClose:(NSNotification*)notification
{
CPLog.debug("[%@ %@]", [self class], _cmd);
// this is one way to handle close button on modal window
if ([CPApp modalWindow])
[CPApp stopModal];
}
//
// Sheet
//
- (void)newSheet:(id)sender
{
[[self allocController] runSheetForWindow:[self window]];
}
- (void)runSheetForWindow:(CPWindow)parentWindow
{
CPLog.debug("[%@ %@]", [self class], _cmd);
var sheet = [self window];
[parentWindow setDelegate:self];
_parentWindow = parentWindow;
_sheet = sheet;
// NOTE: _closeButton doesn't exist until we call [self window] to load window from cib!
[_closeButton setTarget:self];
[_closeButton setAction:@selector(closeSheet:)];
[_altCloseButton setAction:@selector(closeSheetAndParent:)];
[_otherCloseButton setAction:@selector(closeSheetAndRepeat:)];
[self disableUnlinkedButtons];
[CPApp beginSheet:sheet
modalForWindow:parentWindow
modalDelegate:self
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
contextInfo:parentWindow];
}
- (void)closeSheet:(id)sender
{
CPLog.debug("[%@ %@]", [self class], _cmd);
_returnCode = 1;
var orderOutAfter = [_orderOutAfterCheckbox state];
if (!orderOutAfter)
[[self window] orderOut:nil];
[CPApp endSheet:[self window] returnCode:_returnCode];
if (orderOutAfter)
[[self window] orderOut:nil];
}
- (void)closeSheetAndParent:(id)sender
{
CPLog.debug("[%@ %@]", [self class], _cmd);
// common use case is saving document in response to a close,
// in this case we don't want to show the animation at all,
// and also get rid of the parent window
[_parentWindow close];
var orderOutAfter = [_orderOutAfterCheckbox state];
if (!orderOutAfter)
[[self window] orderOut:nil];
_returnCode = 99;
[CPApp endSheet:[self window] returnCode:_returnCode];
if (orderOutAfter)
[[self window] orderOut:nil];
}
- (void)closeSheetAndRepeat:(id)sender
{
CPLog.debug("[%@ %@]", [self class], _cmd);
// common use case is showing a progress bar after a save command,
// the orderout gets rid of the current sheet,
// the return code indicates to open another sheet up
var orderOutAfter = [_orderOutAfterCheckbox state];
if (!orderOutAfter)
[[self window] orderOut:nil];
_returnCode = 77;
[CPApp endSheet:[self window] returnCode:_returnCode];
if (orderOutAfter)
[[self window] orderOut:nil];
}
//
// "Modal" Sheet implemented by using modal session
//
- (void)newModalSheet:(id)sender
{
[[self allocController] runModalSheetForWindow:[self window]];
}
- (void)runModalSheetForWindow:(CPWindow)parentWindow
{
CPLog.debug("[%@ %@]", [self class], _cmd);
var sheet = [self window];
[parentWindow setDelegate:self];
_parentWindow = parentWindow;
_sheet = sheet;
[_closeButton setTarget:self];
[_closeButton setAction:@selector(closeModalSheet:)];
[self disableUnlinkedButtons];
[CPApp beginSheet:sheet
modalForWindow:parentWindow
modalDelegate:self
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
contextInfo:parentWindow];
// what is the difference between these two approaches?
[CPApp runModalForWindow:sheet];
//var session = [CPApp beginModalSessionForWindow:sheet];
//[CPApp runModalSession:session];
}
- (void)closeModalSheet:(id)sender
{
CPLog.debug("[%@ %@]", [self class], _cmd);
var orderOutAfter = [_orderOutAfterCheckbox state];
if (!orderOutAfter)
[[self window] orderOut:nil];
_returnCode = 2;
[CPApp endSheet:[self window] returnCode:_returnCode];
// what return should we get, the sheet or modal?
[CPApp stopModalWithCode:999];
if (orderOutAfter)
[[self window] orderOut:nil];
}
//
// Test alert panels
//
- (void)newAlertSheet:(id)sender
{
[self runAlertSheet:[self window]];
}
- (void)runAlertSheet:(CPWindow)parentWindow
{
// BUG: capp 0.9.5 on WebKit will chop off "bug." in the info text
var alert = [CPAlert alertWithMessageText:@"Alert message text goes here"
defaultButton:@"DefaultButton"
alternateButton:@"AltButton"
otherButton:@"OtherButton"
informativeTextWithFormat:@"This informative text sentence shows text wrapping bug."];
[parentWindow setDelegate:self];
_parentWindow = parentWindow;
_sheet = alert;
_returnCode = -1;
[alert beginSheetModalForWindow:parentWindow
modalDelegate:self
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
contextInfo:parentWindow];
}
//
// Test notifications/delegate methods
//
- (void)didEndSheet:(CPWindow)sheet returnCode:(int)returnCode contextInfo:(id)parentWindow
{
CPLog.debug("[%@ %@] returnCode=%d", [self class], _cmd, returnCode);
if (sheet !== _sheet)
CPLog.fatal("sheet invalid");
if (_returnCode >= 0 && returnCode != _returnCode)
CPLog.fatal("returnCode invalid");
if (_parentWindow !== parentWindow)
CPLog.fatal("contextInfo invalid");
// test sheet chaining. it should be possible to start another sheet from didEndSheet,
// but only if we orderOut: the sheet before we called endSheet: This is how cocoa works too.
if (returnCode == 77)
[self runSheetForWindow:parentWindow];
//[self runAlertSheet:parentWindow];
}
- (BOOL)shadeWindow
{
return [_shadeParentWindow state];
}
- (void)windowWillBeginSheet:(NSNotification*)notification
{
CPLog.debug("[%@ %@]", [self class], _cmd);
if ([notification object] !== _parentWindow)
CPLog.fatal("notification object should be delegate's window");
if ([[_parentWindow windowController] shadeWindow])
{
_savedColor = [[_parentWindow contentView] backgroundColor];
[[_parentWindow contentView] setBackgroundColor:
[CPColor colorWithCalibratedRed:0.0 green:0.7 blue:0.0 alpha:1.0]];
}
}
- (void)windowDidEndSheet:(NSNotification *)notification
{
CPLog.debug("[%@ %@]", [self class], _cmd);
if ([notification object] !== _parentWindow)
CPLog.fatal("notification object should be delegate's window");
if ([[_parentWindow windowController] shadeWindow])
[[_parentWindow contentView] setBackgroundColor:_savedColor];
}
@end
+77
View File
@@ -0,0 +1,77 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index.html
TestSheet
Created by You on April 14, 2012.
Copyright 2012, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>TestSheet</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading TestSheet...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
/*
* AppController.j
* TestSheet
*
* Created by You on April 14, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPLogRegister(CPLogDefault);
CPApplicationMain(args, namedArgs);
}
@@ -0,0 +1,304 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
B210EF7E153B0A8D005D15EE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B210EF7D153B0A8D005D15EE /* Cocoa.framework */; };
B210EF88153B0A8D005D15EE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B210EF86153B0A8D005D15EE /* InfoPlist.strings */; };
B210EF8A153B0A8D005D15EE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B210EF89153B0A8D005D15EE /* main.m */; };
B210EF8E153B0A8D005D15EE /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = B210EF8C153B0A8D005D15EE /* Credits.rtf */; };
B210EF91153B0A8D005D15EE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B210EF90153B0A8D005D15EE /* AppDelegate.m */; };
B2129637153B0B3000E15669 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = B2129636153B0B3000E15669 /* MainMenu.xib */; };
B212963B153B0B4900E15669 /* Window.xib in Resources */ = {isa = PBXBuildFile; fileRef = B2129639153B0B4900E15669 /* Window.xib */; };
B212963C153B0E6A00E15669 /* SheetWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = B2129630153B0ADF00E15669 /* SheetWindow.m */; };
B212963D153B0E6C00E15669 /* SheetWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2129632153B0ADF00E15669 /* SheetWindowController.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
B210EF79153B0A8D005D15EE /* TestSheet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestSheet.app; sourceTree = BUILT_PRODUCTS_DIR; };
B210EF7D153B0A8D005D15EE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
B210EF80153B0A8D005D15EE /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
B210EF81153B0A8D005D15EE /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
B210EF82153B0A8D005D15EE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
B210EF85153B0A8D005D15EE /* TestSheet-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TestSheet-Info.plist"; sourceTree = "<group>"; };
B210EF87153B0A8D005D15EE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
B210EF89153B0A8D005D15EE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
B210EF8B153B0A8D005D15EE /* TestSheet-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TestSheet-Prefix.pch"; sourceTree = "<group>"; };
B210EF8D153B0A8D005D15EE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
B210EF8F153B0A8D005D15EE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
B210EF90153B0A8D005D15EE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
B212962F153B0ADF00E15669 /* SheetWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SheetWindow.h; sourceTree = "<group>"; };
B2129630153B0ADF00E15669 /* SheetWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SheetWindow.m; sourceTree = "<group>"; };
B2129631153B0ADF00E15669 /* SheetWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SheetWindowController.h; sourceTree = "<group>"; };
B2129632153B0ADF00E15669 /* SheetWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SheetWindowController.m; sourceTree = "<group>"; };
B2129636153B0B3000E15669 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = ../Resources/MainMenu.xib; sourceTree = "<group>"; };
B2129639153B0B4900E15669 /* Window.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Window.xib; path = ../Resources/Window.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
B210EF76153B0A8D005D15EE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B210EF7E153B0A8D005D15EE /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
B210EF6E153B0A8D005D15EE = {
isa = PBXGroup;
children = (
B2129639153B0B4900E15669 /* Window.xib */,
B2129636153B0B3000E15669 /* MainMenu.xib */,
B210EF83153B0A8D005D15EE /* TestSheet */,
B210EF7C153B0A8D005D15EE /* Frameworks */,
B210EF7A153B0A8D005D15EE /* Products */,
);
sourceTree = "<group>";
};
B210EF7A153B0A8D005D15EE /* Products */ = {
isa = PBXGroup;
children = (
B210EF79153B0A8D005D15EE /* TestSheet.app */,
);
name = Products;
sourceTree = "<group>";
};
B210EF7C153B0A8D005D15EE /* Frameworks */ = {
isa = PBXGroup;
children = (
B210EF7D153B0A8D005D15EE /* Cocoa.framework */,
B210EF7F153B0A8D005D15EE /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
B210EF7F153B0A8D005D15EE /* Other Frameworks */ = {
isa = PBXGroup;
children = (
B210EF80153B0A8D005D15EE /* AppKit.framework */,
B210EF81153B0A8D005D15EE /* CoreData.framework */,
B210EF82153B0A8D005D15EE /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
B210EF83153B0A8D005D15EE /* TestSheet */ = {
isa = PBXGroup;
children = (
B210EF8F153B0A8D005D15EE /* AppDelegate.h */,
B210EF90153B0A8D005D15EE /* AppDelegate.m */,
B212962F153B0ADF00E15669 /* SheetWindow.h */,
B2129630153B0ADF00E15669 /* SheetWindow.m */,
B2129631153B0ADF00E15669 /* SheetWindowController.h */,
B2129632153B0ADF00E15669 /* SheetWindowController.m */,
B210EF84153B0A8D005D15EE /* Supporting Files */,
);
path = TestSheet;
sourceTree = "<group>";
};
B210EF84153B0A8D005D15EE /* Supporting Files */ = {
isa = PBXGroup;
children = (
B210EF85153B0A8D005D15EE /* TestSheet-Info.plist */,
B210EF86153B0A8D005D15EE /* InfoPlist.strings */,
B210EF89153B0A8D005D15EE /* main.m */,
B210EF8B153B0A8D005D15EE /* TestSheet-Prefix.pch */,
B210EF8C153B0A8D005D15EE /* Credits.rtf */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
B210EF78153B0A8D005D15EE /* TestSheet */ = {
isa = PBXNativeTarget;
buildConfigurationList = B210EF97153B0A8D005D15EE /* Build configuration list for PBXNativeTarget "TestSheet" */;
buildPhases = (
B210EF75153B0A8D005D15EE /* Sources */,
B210EF76153B0A8D005D15EE /* Frameworks */,
B210EF77153B0A8D005D15EE /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = TestSheet;
productName = TestSheet;
productReference = B210EF79153B0A8D005D15EE /* TestSheet.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
B210EF70153B0A8D005D15EE /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
};
buildConfigurationList = B210EF73153B0A8D005D15EE /* Build configuration list for PBXProject "TestSheet" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = B210EF6E153B0A8D005D15EE;
productRefGroup = B210EF7A153B0A8D005D15EE /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
B210EF78153B0A8D005D15EE /* TestSheet */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
B210EF77153B0A8D005D15EE /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B210EF88153B0A8D005D15EE /* InfoPlist.strings in Resources */,
B2129637153B0B3000E15669 /* MainMenu.xib in Resources */,
B212963B153B0B4900E15669 /* Window.xib in Resources */,
B210EF8E153B0A8D005D15EE /* Credits.rtf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
B210EF75153B0A8D005D15EE /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B210EF8A153B0A8D005D15EE /* main.m in Sources */,
B210EF91153B0A8D005D15EE /* AppDelegate.m in Sources */,
B212963D153B0E6C00E15669 /* SheetWindowController.m in Sources */,
B212963C153B0E6A00E15669 /* SheetWindow.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
B210EF86153B0A8D005D15EE /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
B210EF87153B0A8D005D15EE /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
B210EF8C153B0A8D005D15EE /* Credits.rtf */ = {
isa = PBXVariantGroup;
children = (
B210EF8D153B0A8D005D15EE /* en */,
);
name = Credits.rtf;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
B210EF95153B0A8D005D15EE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
B210EF96153B0A8D005D15EE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
B210EF98153B0A8D005D15EE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "TestSheet/TestSheet-Prefix.pch";
INFOPLIST_FILE = "TestSheet/TestSheet-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
B210EF99153B0A8D005D15EE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "TestSheet/TestSheet-Prefix.pch";
INFOPLIST_FILE = "TestSheet/TestSheet-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
B210EF73153B0A8D005D15EE /* Build configuration list for PBXProject "TestSheet" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B210EF95153B0A8D005D15EE /* Debug */,
B210EF96153B0A8D005D15EE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B210EF97153B0A8D005D15EE /* Build configuration list for PBXNativeTarget "TestSheet" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B210EF98153B0A8D005D15EE /* Debug */,
B210EF99153B0A8D005D15EE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = B210EF70153B0A8D005D15EE /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:TestSheet.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,16 @@
//
// AppDelegate.h
// TestSheet
//
// Created by Joe Semolian on 4/15/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "SheetWindowController.h"
@interface AppController : NSObject <NSApplicationDelegate>
{
SheetWindowController* _sheetController;
}
@end
@@ -0,0 +1,29 @@
//
// AppDelegate.m
// TestSheet
//
// Created by Joe Semolian on 4/15/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "AppDelegate.h"
#import "SheetWindowController.h"
@implementation AppController
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
// Insert code here to initialize your application
_sheetController = [[SheetWindowController alloc] initWithWindowNibName:@"Window"];
[_sheetController newWindow:self];
}
- (void)newDocument:(id)sender
{
[_sheetController newWindow:sender];
}
@end
@@ -0,0 +1,13 @@
//
// SheetWindow.h
//
//
// Created by Joe Semolian on 4/14/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface SheetWindow : NSWindow
@end
@@ -0,0 +1,13 @@
//
// SheetWindow.m
//
//
// Created by Joe Semolian on 4/14/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "SheetWindow.h"
@implementation SheetWindow
@end
@@ -0,0 +1,43 @@
//
// SheetWindowController.h
//
//
// Created by Joe Semolian on 4/14/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface SheetWindowController : NSWindowController
{
IBOutlet NSButton* _closeButton;
IBOutlet NSButton* _altCloseButton;
IBOutlet NSButton* _otherCloseButton;
IBOutlet NSButton* _orderOutAfterCheckbox;
IBOutlet NSMatrix* _windowTypeMatrix;
IBOutlet NSButton* _titledMaskButton;
IBOutlet NSButton* _closableMaskButton;
IBOutlet NSButton* _miniaturizableMaskButton;
IBOutlet NSButton* _resizableMaskButton;
IBOutlet NSButton* _shadeWindowView;
IBOutlet NSButton* _shadeContentView;
IBOutlet NSButton* _shadeParentWindow;
NSArray* _childControllers;
NSWindow* _parentWindow;
}
-(IBAction)newWindow:(id)sender;
-(IBAction)newModalWindow:(id)sender;
-(IBAction)newSheet:(id)sender;
-(IBAction)newModalSheet:(id)sender;
-(IBAction)newAlertSheet:(id)sender;
-(IBAction)newColorPanelSheet:(id)sender;
-(IBAction)newOpenPanelSheet:(id)sender;
-(IBAction)newSavePanelSheet:(id)sender;
- (void)windowWillBeginSheet:(NSNotification *)notification;
- (void)windowDidEndSheet:(NSNotification *)notification;
@end
@@ -0,0 +1,343 @@
//
// SheetWindowController.m
//
//
// Created by Joe Semolian on 4/14/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "SheetWindowController.h"
@interface SheetWindowController ()
@end
@implementation SheetWindowController
- (id)initWithWindow:(NSWindow *)window
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
self = [super initWithWindow:window];
if (self)
{
_closeButton = nil;
_childControllers = [NSArray array];
}
return self;
}
- (void)windowDidLoad
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
[super windowDidLoad];
if (!_closeButton)
NSLog(@"[%@ %s]: _closeButton is not connected!", [self className], sel_getName(_cmd));
}
-(void)positionWindow
{
NSWindow* keyWindow = [NSApp keyWindow];
CGPoint origin = ([keyWindow frame]).origin;
origin = CGPointMake(origin.x + 20, origin.y + 20);
[[self window] setFrameOrigin:origin];
}
//
// Normal window
//
-(void)newDocument:(id)sender
{
[self newWindow:sender];
}
-(SheetWindowController*)initWithStyleMask:(int)styleMask
{
if (styleMask==0)
return [self initWithWindowNibName:@"Window"];
NSWindow* window = [ [NSWindow alloc]
initWithContentRect:CGRectMake(0,0,400,300)
styleMask:styleMask
backing:NSBackingStoreBuffered
defer:YES];
if (self = [super initWithWindow:window])
{
_closeButton = [ [NSButton alloc] initWithFrame:CGRectMake(0,0,32,100)];
[_closeButton setTitle:@"Close"];
[_closeButton setButtonType:NSMomentaryPushInButton];
[_closeButton setBezelStyle:NSBezelBorder];
[_closeButton sizeToFit];
[[window contentView] addSubview:_closeButton];
}
return self;
}
-(SheetWindowController*)allocController
{
long type = 1;
if (_windowTypeMatrix)
type = [ [_windowTypeMatrix selectedCell] tag];
int styleMask = 0;
if ([_titledMaskButton state])
styleMask |= NSTitledWindowMask;
if ([_closableMaskButton state])
styleMask |= NSClosableWindowMask;
if ([_miniaturizableMaskButton state])
styleMask |= NSMiniaturizableWindowMask;
switch (type)
{
case 2:
styleMask |= NSTexturedBackgroundWindowMask;
break;
case 3:
styleMask = NSBorderlessWindowMask;
break;
case 4:
break;
case 5:
styleMask = NSDocModalWindowMask;
break;
}
if ([_resizableMaskButton state])
styleMask |= NSResizableWindowMask;
if (type == 1)
styleMask = 0;
return [[SheetWindowController alloc] initWithStyleMask:styleMask];
}
-(void)newWindow:(id)sender
{
SheetWindowController* controller = [self allocController];
_childControllers = [_childControllers arrayByAddingObject:controller];
[controller runNormalWindow];
}
-(void)runNormalWindow
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
[self positionWindow];
[[self window] setTitle:@"Normal Window"];
[_closeButton setTarget:[self window]];
[_closeButton setAction:@selector(orderOut:)];
[self showWindow:self];
}
-(void)newModalWindow:(id)sender
{
SheetWindowController* controller = [self allocController];
_childControllers = [_childControllers arrayByAddingObject:controller];
[controller runModalWindow];
}
-(void)runModalWindow
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
[[self window] setTitle:@"Modal Window"];
[[self window] setDelegate:self];
[_closeButton setTarget:self];
[_closeButton setAction:@selector(endModalWindow:)];
//[self showWindow:self];
[NSApp runModalForWindow:[self window]];
}
-(void)endModalWindow:(id)sender
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
[[self window] performClose:self];
}
-(void)windowWillClose:(NSNotification*)notification
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
if ([NSApp modalWindow])
[NSApp stopModal];
}
-(void)newSheet:(id)sender
{
SheetWindowController* controller = [self allocController];
_childControllers = [_childControllers arrayByAddingObject:controller];
[controller runSheetForWindow:[self window]];
}
-(void)runSheetForWindow:(NSWindow*)parentWindow
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
NSWindow* sheet = [self window];
[parentWindow setDelegate:self];
_parentWindow = parentWindow;
[_closeButton setTarget:self];
[_closeButton setAction:@selector(closeSheet:)];
[_altCloseButton setAction:@selector(closeSheetAndParent:)];
[_otherCloseButton setAction:@selector(closeSheetAndRepeat:)];
[NSApp beginSheet:sheet
modalForWindow:parentWindow
modalDelegate:self
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
contextInfo:(void*)self];
}
-(void)closeSheet:(id)sender
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
// NOTE: orderOut is not required for Capp, but is for Cocoa. It does
// not seem to matter when it is called in relation to endSheet:
BOOL orderOutAfter = [_orderOutAfterCheckbox state];
if (!orderOutAfter)
[[self window] close];
//[[self window] orderOut:nil];
[NSApp endSheet:[self window] returnCode:99];
if (orderOutAfter)
//[[self window] orderOut:nil];
[[self window] close];
}
-(void)closeSheetAndParent:(id)sender
{
// common use case is saving document in response to a close,
// in this case we don't want to show the animation at all
[_parentWindow close];
BOOL orderOutAfter = [_orderOutAfterCheckbox state];
if (!orderOutAfter)
[[self window] orderOut:nil];
[NSApp endSheet:[self window] returnCode:99];
if (orderOutAfter)
[[self window] orderOut:nil];
}
-(void)closeSheetAndRepeat:(id)sender
{
// common use case is showing a progress bar after a save command,
// the orderout gets rid of the current sheet,
// the return code indicates to open another sheet up
BOOL orderOutAfter = [_orderOutAfterCheckbox state];
if (!orderOutAfter)
[[self window] orderOut:nil];
[NSApp endSheet:[self window] returnCode:77];
if (orderOutAfter)
[[self window] orderOut:nil];
}
-(void)newModalSheet:(id)sender
{
SheetWindowController* controller = [self allocController];
_childControllers = [_childControllers arrayByAddingObject:controller];
[controller runModalSheetForWindow:[self window]];
}
-(void)runModalSheetForWindow:(NSWindow*)parentWindow
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
NSWindow* sheet = [self window];
[parentWindow setDelegate:self];
_parentWindow = parentWindow;
[_closeButton setTarget:self];
[_closeButton setAction:@selector(closeModalSheet:)];
[NSApp beginSheet:sheet
modalForWindow:parentWindow
modalDelegate:self
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
contextInfo:(void*)self];
// what is the difference between these two approaches?
[NSApp runModalForWindow:sheet];
//var session = [CPApp beginModalSessionForWindow:sheet];
//[CPApp runModalSession:session];
}
-(void)closeModalSheet:(id)sender
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
[[self window] orderOut:self];
[NSApp endSheet:[self window]];
// FIXME: there is no endModalSession: per Cocoa
[NSApp stopModalWithCode:999];
}
-(void)newAlertSheet:(id)sender
{
[[self window] setDelegate:self];
_parentWindow = [self window];
[self runAlertSheet:_parentWindow];
}
-(void)runAlertSheet:(NSWindow*)parentWindow
{
NSAlert* alert = [NSAlert alertWithMessageText:@"Oops, something went wrong!"
defaultButton:@"DefaultButton"
alternateButton:@"AltButton"
otherButton:@"OtherButton"
informativeTextWithFormat:@"If we knew why it went wrong, we would describe it here."];
[alert beginSheetModalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
contextInfo:nil];
}
- (void)didEndSheet:(NSWindow*)sheet returnCode:(NSInteger)returnCode contextInfo:(void*)contextInfo
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
//NSAssert(sheet == [self window], @"sheet object is incorrect");
// repeat with another sheet
if (returnCode == 77)
//[self runSheetForWindow:_parentWindow];
[self runAlertSheet:_parentWindow];
}
- (void)windowWillBeginSheet:(NSNotification *)notification
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
NSAssert([notification object]==_parentWindow, @"notification object is not parent window");
}
- (void)windowDidEndSheet:(NSNotification *)notification
{
NSLog(@"[%@ %s]", [self className], sel_getName(_cmd));
NSAssert([notification object]==_parentWindow, @"notification object is not parent window");
}
@end
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.github.walisser.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 __MyCompanyName__. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
@@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'TestSheet' target in the 'TestSheet' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
@@ -0,0 +1,29 @@
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw9840\paperh8400
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\b\fs24 \cf0 Engineering:
\b0 \
Some people\
\
\b Human Interface Design:
\b0 \
Some other people\
\
\b Testing:
\b0 \
Hopefully not nobody\
\
\b Documentation:
\b0 \
Whoever\
\
\b With special thanks to:
\b0 \
Mom\
}
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */
@@ -0,0 +1,14 @@
//
// main.m
// TestSheet
//
// Created by Joe Semolian on 4/15/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}
+2 -2
View File
@@ -78,12 +78,12 @@
_controlSize = (flags2 & 0xE0000) >> 17;
_sendsActionOnEndEditing = (flags2 & 0x00400000) ? YES : NO;
_tag = [aCoder decodeIntForKey:@"NSTag"];
_objectValue = [aCoder decodeObjectForKey:@"NSContents"];
_font = [aCoder decodeObjectForKey:@"NSSupport"];
_formatter = [aCoder decodeObjectForKey:@"NSFormatter"];
_tag = [aCoder decodeIntForKey:@"NSTag"];
}
return self;