1 //
2 //  PXNamePrompter.h
3 //  Pixel Editor
4 //
5 //  Created by Open Sword Group on Thu May 01 2003.
6 //  Copyright (c) 2003 Open Sword Group.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12 //  of the Software, and to permit persons to whom the Software is furnished to
13 // do so, subject to the following conditions:
14 
15 // The above copyright notice and this permission notice shall be included
16 //in all copies or substantial portions of the Software.
17 
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19 //INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23 // OR OTHER DEALINGS IN THE SOFTWARE.
24 
25 
26 #import <Foundation/NSObject.h>
27 #import <AppKit/NSNibDeclarations.h>
28 @class NSTextField;
29 @class NSPanel;
30 @class NSWindow;
31 
32 @interface PXNamePrompter : NSObject
33  {
34    IBOutlet NSTextField *nameField;
35    IBOutlet NSPanel *panel;
36 @private
37    id _context;
38    id _delegate;
39 }
40 
41 - (id) init;
42 
43 - (void)setDelegate:(id) newDelegate;
44 
45 - (void)promptInWindow:(NSWindow *) window
46 	       context:(id) contextInfo;
47 
48 - (void)promptInWindow:(NSWindow *)window
49 	       context:(id)contextInfo
50 	  promptString:(NSString *)string
51 	  defaultEntry:(NSString *)entry;
52 
53 //IBactions
54 - (IBAction)useEnteredName:(id)sender;
55 - (IBAction)cancel:(id)sender;
56 
57 //Accessors
58 -(NSPanel *) namePrompterPanel;
59 @end
60 
61 
62 //
63 // Methods Implemented by the Delegate
64 //
65 @interface NSObject(PXNamePrompterDelegate)
66 
67 //The delegate receive this message when the user hit the button "Use this name"
68 //Usually the delegate save the new background using the name ( contains in nameField )
69 - (void)prompter:aPrompter didFinishWithName:aName context:context;
70 
71 //The delegate receive this message when the user hit the button Cancel
72 - (void)prompter:aPrompter didCancelWithContext:contextObject;
73 
74 @end
75 
76