home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / MiscKit / Source / MiscInfo.m < prev    next >
Encoding:
Text File  |  1994-02-13  |  2.1 KB  |  74 lines

  1. //
  2. //    MiscInfo.m -- a class to sit underneath an Info panel
  3. //        Written by Don Yacktman (c) 1994 by Don Yacktman.
  4. //                Version 1.0.  All rights reserved.
  5. //
  6. //        This notice may not be removed from this source code.
  7. //
  8. //    This object is included in the MiscKit by permission from the author
  9. //    and its use is governed by the MiscKit license, found in the file
  10. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  11. //    for a list of all applicable permissions and restrictions.
  12. //    
  13.  
  14. #import <misckit/misckit.h>
  15.  
  16. #define _versionString [strings valueForStringKey:"Version"]
  17. #define _versionDate [strings valueForStringKey:"VersionDate"]
  18.  
  19. // This interface is to avoid compile time warnings until the MiscAnimatedView
  20. // class is completed.  When the class is added, I'll remove this.
  21. @interface Object(MiscAnimatedViewMethods)
  22. - autoUpdate:sender;
  23. - start:sender;
  24. - stop:sender;
  25. @end
  26.  
  27. @implementation MiscInfo
  28.  
  29. - init                // make sure that *Panel is nil.
  30. {
  31.     self = [super init];
  32.     infoPanel = nil;
  33.     return self;
  34. }
  35.  
  36. - setController:sender { controller = sender; return self; }
  37. - niftyView { return niftyView; }
  38. - (const char *)versionString { return _versionString; }
  39. - (const char *)versionDateString { return _versionDate; }
  40.  
  41. - infoPanel        // return the infoPanel, load it if needed.
  42. {
  43.     if( !infoPanel) {
  44.         [NXApp loadNibSection:"InfoPanel.nib" owner:self withNames:NO];
  45.         if (!strings) { // attempt to load a ".strings" file *****
  46.         }
  47.         if (!strings) { // failing that, use the controller's string table
  48.             strings = [controller strings];
  49.         }
  50.     }
  51.     return infoPanel;
  52. }
  53.  
  54. - info:sender        // make the info panel be up there.
  55. {
  56.     id tempPanel = [self infoPanel]; // force load, but no display yet
  57.  
  58.     // set up the panel's info
  59.     [versionText setStringValue:_versionString];
  60.     [versionDateText setStringValue:_versionDate];
  61.     [[controller registration] fillRegistrationText:regText];
  62.  
  63.     // bring out the panel
  64.     [tempPanel orderFront:sender];
  65.  
  66.     // start up animation, if any.
  67.     if ([niftyView respondsTo:@selector(start:)])
  68.         [niftyView start:self]; // will stop automatically on close by
  69.         // using window's delegate method -windowWillClose:
  70.     return self;
  71. }
  72.  
  73. @end
  74.