home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / SourceCode / MiscKit1.2.6 / Projects / MiscFindPanel / SearchBench / MiscFindPanelClass.m < prev    next >
Encoding:
Text File  |  1993-10-21  |  2.3 KB  |  90 lines

  1. /*
  2.  *  Copyright (c) 1993 Christopher J. Kane.  All rights reserved.
  3.  *
  4.  *  This software is subject to the terms of the MiscKit license
  5.  *  agreement.  Refer to the license document included with the
  6.  *  MiscKit distribution for these terms.
  7.  *
  8.  *  Version: 1.1 (22 October 1993)
  9.  */
  10.  
  11. #import "MiscFindPanelClass.h"
  12.  
  13. @implementation Application (MiscFindPanelClass)
  14.  
  15. static BOOL _FPloaded=NO;
  16. static BOOL _fpLoaded=NO;
  17.  
  18. - (Class)MiscFindPanelClass
  19. {
  20.   static Class _findPanelClass=Nil;
  21.   if (!_FPloaded)
  22.     {
  23.       char path[MAXPATHLEN+16];
  24.       _FPloaded = YES;
  25.       sprintf(path, "%s/MiscFindPanel.bundle", [[NXBundle mainBundle] directory]);
  26.       _findPanelClass = [[[NXBundle alloc] initForDirectory:path] classNamed:"MiscFindPanel"];
  27.       if ([[NXApp delegate] respondsTo:@selector(MiscFindPanelClassWasLoaded:)])
  28.         _findPanelClass = [[NXApp delegate] MiscFindPanelClassWasLoaded:_findPanelClass];
  29.       else if ([NXApp respondsTo:@selector(MiscFindPanelClassWasLoaded:)])
  30.         _findPanelClass = [NXApp MiscFindPanelClassWasLoaded:_findPanelClass];
  31.     }
  32.   return _findPanelClass;
  33. }
  34.  
  35. - (BOOL)isMiscFindPanelClassLoaded
  36. {
  37.   return _FPloaded;
  38. }
  39.  
  40. - (MiscFindPanel *)findPanel
  41. {
  42.   static MiscFindPanel *_findPanel=nil;
  43.   if (!_fpLoaded)
  44.     {
  45.       if ([[NXApp delegate] respondsTo:@selector(findPanelWillLoad:)])
  46.         [[NXApp delegate] findPanelWillLoad:[self MiscFindPanelClass]];
  47.       else if ([NXApp respondsTo:@selector(findPanelWillLoad:)])
  48.         [NXApp findPanelWillLoad:[self MiscFindPanelClass]];
  49.       _findPanel = [[self MiscFindPanelClass] sharedInstance];
  50.       if ([[NXApp delegate] respondsTo:@selector(findPanelDidLoad:)])
  51.         _findPanel = [[NXApp delegate] findPanelDidLoad:_findPanel];
  52.       else if ([NXApp respondsTo:@selector(findPanelDidLoad:)])
  53.         _findPanel = [NXApp findPanelDidLoad:_findPanel];
  54.       _fpLoaded = YES;
  55.     }
  56.   return _findPanel;
  57. }
  58.  
  59. - (BOOL)isFindPanelLoaded
  60. {
  61.   return _fpLoaded;
  62. }
  63.  
  64. - enterSelection:sender
  65. {
  66.   return [[self findPanel] enterSelection:sender];
  67. }
  68.  
  69. - findNext:sender
  70. {
  71.   return [[self findPanel] findForward:sender];
  72. }
  73.  
  74. - findPrevious:sender
  75. {
  76.   return [[self findPanel] findBackward:sender];
  77. }
  78.  
  79. - jumpToSelection:sender
  80. {
  81.   return [[self findPanel] jumpToSelection:sender];
  82. }
  83.  
  84. - orderFrontFindPanel:sender
  85. {
  86.   return [[self findPanel] makeKeyAndOrderFront:sender];
  87. }
  88.  
  89. @end
  90.