home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / DevTools / ClassEditor.0.4 / Source / CEInfo.m < prev    next >
Encoding:
Text File  |  1995-06-05  |  2.9 KB  |  145 lines

  1. /* --------------------------------------------------------------------------
  2.  
  3. Class:            CEInfo
  4. Version:        0.1
  5. File:            CEInfo.m                 
  6.  
  7. Written by:        Thomas Engel
  8. Created:        17.05.1995    (Copyleft)
  9. Last modified:    17.05.1995
  10.  
  11.  
  12. Note:    For a detailed description please read the class documentation.
  13.  
  14. -------------------------------------------------------------------------- */
  15.  
  16.  
  17. #import <CEInfo.h>
  18.  
  19. #define _InfoShowingAppIcon        1        // please use enum..
  20. #define _InfoShowingTomiIcon    2
  21. #define _InfoShowingWolfyIcon    3
  22.  
  23. #define _InfoShowingAnimation    4        // let make it a enum..
  24.  
  25. @implementation CEInfo
  26.  
  27. - init
  28. {
  29.     self = [super init];
  30.     if( !self ) return self;
  31.  
  32.     // OK. We really are an object...here we go with our init.
  33.  
  34.     currentIcon = _InfoShowingAppIcon;
  35.     animationRunning = NO;
  36.     
  37.     return self;
  38. }
  39.  
  40. - makeKeyAndOrderFront:sender
  41. {
  42.     if( !panel )
  43.     {
  44.         if( [NXApp loadNibSection:"Info.nib" owner:self] == nil )
  45.             NXRunAlertPanel( NULL, "Couldn't load Info.nib",
  46.                              "OK", NULL, NULL );
  47.     }
  48.     [panel makeKeyAndOrderFront:self];
  49.     
  50.     return self;
  51. }
  52.  
  53. - switchToNextIcon:sender
  54. {
  55.     switch( currentIcon )
  56.     {
  57.         case _InfoShowingAppIcon:
  58.             return [self switchToTomiIcon:self];
  59.         case _InfoShowingTomiIcon:
  60.             return [self switchToWolfyIcon:self];
  61.         case _InfoShowingWolfyIcon:
  62.             return [self switchToAppIcon:self];
  63.     }
  64.     return self;
  65. }
  66.  
  67. - switchToAppIcon:sender
  68. {
  69.     return [self _switchTo:_InfoShowingAppIcon with:appImage :appText];
  70. }
  71.  
  72. - switchToTomiIcon:sender
  73. {
  74.     return [self _switchTo:_InfoShowingTomiIcon with:tomiImage :tomiText];
  75. }
  76.  
  77. - switchToWolfyIcon:sender
  78. {
  79.     return [self _switchTo:_InfoShowingWolfyIcon with:wolfyImage :wolfyText];
  80. }
  81.  
  82. - _switchTo:(int)aStyle with:aImageButton :aTextField
  83. {
  84.     if( !animationRunning && currentIcon != aStyle )
  85.     {
  86.         [imageButton setImage:[aImageButton image]];
  87.         [textField setStringValue:[aTextField stringValue]];
  88.         currentIcon = aStyle;
  89.     }
  90.     return self;
  91. }
  92.  
  93. - startRandomAnimation:sender
  94. {
  95.     // if there is no animation running right now...
  96.     
  97.     if( animationRunning ) return self;
  98.     
  99.     // register that a animation will run and choose a random animator-obj
  100.     // To be able to switch to a original Image we have to tell this object
  101.     // that if is now shoning the AnimationImages
  102.     
  103.     [self switchToAppIcon:self];
  104.     animationRunning = YES;
  105.     currentIcon = _InfoShowingAnimation;
  106.  
  107.     currentAnimator = someAnimator;
  108.         
  109.     [currentAnimator setDelegate:self];
  110.     [currentAnimator startAnimation:self];
  111.     return self;
  112. }
  113.  
  114. - animationDidStop:sender
  115. {
  116.     // After the animation we have to switch to the original BeakerIcon
  117.     // we are also registered as the animators delegate.
  118.  
  119.     animationRunning = NO;
  120.     [self switchToAppIcon:self];
  121.     return self;
  122. }
  123.  
  124. - windowWillClose:sender
  125. {
  126.     // We´re the InfoPanels delegate. So we can stop an animation even if it
  127.     // has not finished yet.
  128.  
  129.     if( animationRunning ) [currentAnimator stopAnimation];
  130.  
  131.     return self;
  132. }
  133.  
  134. @end
  135.  
  136. /*
  137.  * History: 17.05.95 Adjusted the old BBInfo a little.
  138.  *
  139.  *            07.05.94 Switched to BBInfo.
  140.  *
  141.  *            19.01.94 Added the textFields.
  142.  *
  143.  *
  144.  * Bugs: - No
  145.  */