home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mozil06.zip / bin / chrome / toolkit.jar / content / global / wizardOverlay.js < prev    next >
Text File  |  2001-02-14  |  2KB  |  70 lines

  1. /**
  2.  *  Wizard button controllers.
  3.  *  - Note: 
  4.  *  -   less infrastructure is provided here than for dialog buttons, as 
  5.  *  -   closing is not automatically desirable for many wizards (e.g. profile
  6.  *  -   creation) where proper application shutdown is required. thus these 
  7.  *  -   functions simply pass this responsibility on to the wizard designer.
  8.  *  -
  9.  *  - Use: Include this JS file in your wizard XUL and the accompanying 
  10.  *  -      wizardOverlay.xul file as an overlay. Then set the overlay handlers
  11.  *  -      with doSetWizardButtons(). It is recommended you use this overlay
  12.  *  -      with the WizardManager wizard infrastructure. If you do that, you
  13.  *  -      don't need to do anything here. Otherwise, use doSetWizardButtons()
  14.  *  -      with false or null passed in as the first parameter, and the names
  15.  *  -      of your functions passed in as the remaining parameters, see below.
  16.  *  -
  17.  *  - Ben Goodger (04/11/99)  
  18.  **/
  19.  
  20. var doNextFunction    = null;
  21. var doBackFunction    = null;
  22. var doFinishFunction  = null;
  23. var doCancelFunction  = null;
  24.  
  25. // call this from dialog onload() to allow buttons to call your code.
  26. function doSetWizardButtons( wizardManager, nextFunc, backFunc, finishFunc, cancelFunc )
  27. {
  28.   if(wizardManager) {
  29.     doNextFunction    = wizardManager.onNext;
  30.     doBackFunction    = wizardManager.onBack;
  31.     doFinishFunction  = wizardManager.onFinish;
  32.     doCancelFunction  = wizardManager.onCancel;
  33.   } else {
  34.       doNextFunction    = nextFunc;
  35.     doBackFunction    = backFunc;
  36.     doFinishFunction  = finishFunc;
  37.     doCancelFunction  = cancelFunc; 
  38.   }
  39. }
  40.  
  41. // calls function specified for "next" button click.
  42. function doNextButton()
  43. {
  44.     if ( doNextFunction )
  45.         doNextFunction();
  46. }
  47.  
  48. // calls function specified for "back" button click.
  49. function doBackButton()
  50. {
  51.     if ( doBackFunction )
  52.         doBackFunction();
  53. }
  54.  
  55. // calls function specified for "finish" button click.
  56. function doFinishButton()
  57. {
  58.     if ( doFinishFunction )
  59.       doFinishFunction();
  60. }
  61.  
  62. // calls function specified for "cancel" button click.
  63. function doCancelButton()
  64. {
  65.     if ( doCancelFunction )
  66.         doCancelFunction();
  67. }
  68.  
  69.  
  70.