home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / SourceCode / MiscKit1.2.6 / Source / MiscOrderForm.m < prev    next >
Encoding:
Text File  |  1994-02-12  |  1.6 KB  |  60 lines

  1. //
  2. //    MiscOrderForm.m -- a class to sit underneath an Order Form 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. @implementation MiscOrderForm
  17.  
  18. - init                // make sure that *Panel is nil.
  19. {
  20.     self = [super init];
  21.     orderFormPanel = nil;
  22.     return self;
  23. }
  24.  
  25. - setController:sender { controller = sender; return self; }
  26.  
  27. - orderFormPanel        // return the orderFormPanel, load it if needed.
  28. {
  29.     if (!orderFormPanel)
  30.         [NXApp loadNibSection:"OrderForm.nib" owner:self withNames:NO];
  31.     return orderFormPanel;
  32. }
  33.  
  34. - orderForm:sender
  35. {
  36.     [[self orderFormPanel] makeKeyAndOrderFront:sender];
  37.     return self;
  38. }
  39.  
  40. - printOrderForm:sender    // Do -costCalc and then print orderForm.
  41. {
  42.     // calculate the cost (extensions, etc.) before printing.
  43.     [self costCalc:self];
  44.     // delay the print so that the button won't be highlighted
  45.     // on the printout.
  46.     [[self orderFormPanel] perform:@selector(smartPrintPSCode:)
  47.                 with:self afterDelay:1 cancelPrevious:NO];
  48.     return self;
  49. }
  50.  
  51. - costCalc:sender
  52. {    // This is the minimum and you'd probably want to override it.
  53.     [self orderFormPanel]; // make sure .nib is loaded.
  54.     [totalCostText setFloatValue:
  55.             ([numLicensesText intValue] * [costPerLicenseText floatValue])];
  56.     return self;
  57. }
  58.  
  59. @end
  60.