home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / business / printcar / printcar.exe / src / UI / Application.cc next >
C/C++ Source or Header  |  2000-06-06  |  882b  |  43 lines

  1. //
  2. //  $Id: Application.cc,v 1.2 2000/06/06 09:31:09 sergey Exp $
  3. //
  4.  
  5. #include <Pilot.h>
  6. #include "Application.h"
  7. #include "Form.h"
  8.  
  9.  
  10. namespace UI
  11. {
  12.     void Application::run(Form& mainForm, long eventLoopDelay)
  13.     {
  14.         mainForm.create();
  15.         FrmPopupForm(mainForm.formID());
  16.  
  17.         eventLoop(eventLoopDelay);
  18.  
  19.         mainForm.destroy();   // do it here due to the problems with static variables
  20.     }
  21.  
  22.     void Application::eventLoop(long delay)
  23.     {
  24.         Word error;
  25.         EventType event;
  26.  
  27.         do
  28.         {
  29.             EvtGetEvent(&event, delay);
  30.  
  31.             if (SysHandleEvent(&event))
  32.                 continue;
  33.  
  34.             if (MenuHandleEvent(NULL, &event, &error))
  35.                 continue;
  36.  
  37.             FrmDispatchEvent(&event);
  38.         }
  39.         while (event.eType != appStopEvent);
  40.     }
  41. }
  42. // namespace UI
  43.