home *** CD-ROM | disk | FTP | other *** search
- //
- // A loadable Preference Bundle example.
- // Greg Burd
- // Copyright NeXT Computer, Inc 1992 All Rights Reserved
- //
- // Created 8-24-92
- //
- // You may freely copy, distribute and reuse the code in this example.
- // NeXT disclaims any warranty of any kind, expressed or implied, as to
- // its fitness for any particular use.
- //
-
- #import <appkit/appkit.h>
-
- #import "PersonalPreferences.h"
- #import "Text_Console.h"
-
- @implementation PersonalPreferences
-
- + new
- /*
- Called first time this section's button is clicked.
- */
- {
- self = [super new];
-
- if( ![NXApp loadNibForLayout:"PersonalPreferences" owner: self] )
- return 0;
-
- // 'window' is an interface builder outlet.
- view = [window contentView]; // 'view' MUST be initialized
- [view removeFromSuperview];
- [window setContentView: 0]; // Don't need the window for anything
- [window free]; // So free it.
-
- // Do any other set up here.
-
- return self;
- }
-
- - willSelect: sender
- /*
- Before the view is added via addSubview
- */
- {
- [text printf:"In - willSelect:\n"];
- return self;
- }
-
- - didSelect: sender
- /*
- After the view is added via addSubview
- */
- {
- /*
- Enable all of the edit and window menu items, just for the heck of it.
- */
- [text printf:"In - didSelect:\n"];
-
- // These just allow you to restrict actions that the use might
- // want to do.
- [NXApp enableEdit: CUT_ITEM|COPY_ITEM|PASTE_ITEM|SELECTALL_ITEM];
- [NXApp enableWindow: MINIATURIZE_ITEM|CLOSE_ITEM];
- return self;
- }
-
-
- - willUnselect: sender
- /*
- Before removeFromSuperview
- */
- {
- /* Make sure that we aren't editing any text fields. For instance if
- you were doing something like the password preference, you would
- not send the endEditingFor: if the user had not completed the
- process of creating a new password.
- */
- [text printf:"In - willUnselect:\n"];
- [[NXApp appWindow] endEditingFor: self];
- return self;
- }
-
- - didUnselect: sender
- /*
- Before removeFromSuperview
- */
- {
- /*
- Disable all of the edit and window menu items, just for the heck of it.
- */
- [text printf:"In - didUnselect:\n"];
- [NXApp enableEdit: NO];
- [NXApp enableWindow: NO];
- return self;
- }
-
- - didHide: sender
- /*
- Application was just hidden.
- */
- {
- [text printf:"In - didHide:\n"];
- // in here you should be nice and free all the memory you can, you don't
- // want to waste memory just sitting there while the clock ticks away...
- return self;
- }
-
- - didUnhide: sender
- /*
- Application was just unhidden.
- */
- {
- [text printf:"In - didUnhide:\n"];
- // time to reconstruct that memory that you freed earlier. :-)
- return self;
- }
-
- - button1Clicked: sender
- {
- [text printf:"In - button1Clicked:\n"];
- return self;
- }
-
- - button2Clicked: sender
- {
- [text printf:"In - button2Clicked:\n"];
- return self;
- }
-
- - gotText:sender
- {
- [text printf:"In - gotText:(%s)\n",[sender stringValue]];
- return self;
- }
-
- - free
- {
- [text printf:"In - free\n"];
- // don't forget to be nice and free everything that you malloc'ed!
- return [super free];
- }
- @end
-
-