Anonymous avatar Anonymous committed 521771d

Sheet controller - API change: delegate method now gets passed the appropriate button instead of the window

Comments (0)

Files changed (4)

BWControllersLibrary.nib/designable.nib

 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
 	<data>
 		<int key="IBDocument.SystemTarget">1050</int>
-		<string key="IBDocument.SystemVersion">9E17</string>
+		<string key="IBDocument.SystemVersion">9G55</string>
 		<string key="IBDocument.InterfaceBuilderVersion">677</string>
-		<string key="IBDocument.AppKitVersion">949.33</string>
-		<string key="IBDocument.HIToolboxVersion">352.00</string>
+		<string key="IBDocument.AppKitVersion">949.43</string>
+		<string key="IBDocument.HIToolboxVersion">353.00</string>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
 			<integer value="7"/>
 						<string key="identifier">FB2E7CB9-EA98-4C6F-B4EE-7CFA4E1599D2</string>
 						<string key="briefDescription">Controller object for loading and dismissing sheets.</string>
 						<object class="NSAttributedString" key="fullDescription">
-							<string key="NSString">Controller object for loading and dismissing sheets. To use, connect its outlets and actions. Optionally, you can connect the delegate outlet if you want to execute code when an action occurs on the sheet. The delegate should implement the method -(BOOL)shouldCloseSheet:(NSWindow *)sheet.</string>
+							<string key="NSString">Controller object for loading and dismissing sheets. To use, connect its outlets and actions. Optionally, you can connect the delegate outlet if you want to execute code when an action occurs on the sheet. The delegate should implement the method -(BOOL)shouldCloseSheet:(id)sender.</string>
 							<object class="NSMutableArray" key="NSAttributes">
 								<bool key="EncodedWithXMLCoder">YES</bool>
 								<object class="NSDictionary">
 								</object>
 							</object>
 							<object class="NSMutableData" key="NSAttributeInfo">
-								<bytes key="NS.bytes">9wEAAgEEAhMBCAMDAQYEA</bytes>
+								<bytes key="NS.bytes">9wEAAgEEAhUBBwMBBA</bytes>
 							</object>
 						</object>
 						<string key="initialCategoryPath">Controllers</string>
 						<object class="NSMutableArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>closeSheet:</string>
-							<string>closeSheetAndMessageDelegate:</string>
+							<string>messageDelegateAndCloseSheet:</string>
 							<string>openSheet:</string>
 						</object>
 						<object class="NSMutableArray" key="dict.values">
Add a comment to this file

BWControllersLibrary.nib/keyedobjects.nib

Binary file modified.

BWSheetController.h

 - (IBAction)closeSheet:(id)sender;
 - (IBAction)messageDelegateAndCloseSheet:(id)sender;
 
+// The optional delegate should implement the method:
+// - (BOOL)shouldCloseSheet:(id)sender
+// Return YES if you want the sheet to close after the button click, NO if it shouldn't close. The sender
+// object is the button that requested the close. This is helpful because in the event that there are multiple buttons
+// hooked up to the messageDelegateAndCloseSheet: method, you can distinguish which button called the method. 
+
 @end

BWSheetController.m

 	[sheet setAlphaValue:0];
 	[sheet performSelector:@selector(orderOut:) withObject:nil afterDelay:0];
 	
-	// If the sheet has a toolbar, make sure it isn't movable (private API)
-	[sheet setMovable:NO];
+	// If the sheet has a toolbar or a bottom bar, make sure those elements can't move the window (private API)
+	if ([sheet respondsToSelector:@selector(setMovable:)])
+		[sheet setMovable:NO];
 }
 
 - (id)initWithCoder:(NSCoder *)decoder;
 {
 	if (delegate != nil && [delegate respondsToSelector:@selector(shouldCloseSheet:)])
 	{	
-		if ([delegate performSelector:@selector(shouldCloseSheet:) withObject:sheet])	
+		if ([delegate performSelector:@selector(shouldCloseSheet:) withObject:sender])	
 			[self closeSheet:self];
 	}
 	else
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.