home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / Pedestal / Source / Sources / Ped1ObjectDeity.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  1.3 KB  |  74 lines

  1. /* Ped1ObjectDeity.cc */
  2.  
  3. #include "Ped1ObjectDeity.hh"
  4. #include "PedAgent.hh"
  5. #include "PedWindow.hh"
  6. #include "PedPaneTE.hh"
  7.  
  8. Ped1ObjectDeity deity, *gOD = &deity;
  9.  
  10. PedAgent *
  11. PedClassAgent::MakeAgent()
  12. {
  13.     PedAgent *agent = new PedAgent(mPrimaryTask);
  14.     agent->autorelease();
  15.     
  16.     return agent;
  17. }
  18.  
  19. void
  20. Ped1ObjectDeity::RegisterAgentClass(PedClassAgent *inClass)
  21. {
  22.     if (inClass != NULL) {
  23.         mAgentClass = inClass;
  24.     }
  25. }
  26.  
  27. PedAgent *
  28. Ped1ObjectDeity::CreateWindowAgent()
  29. {
  30.     if (mAgentClass != NULL) {
  31.         return mAgentClass->MakeAgent();
  32.     }
  33.     PedAgent *agent = new PedAgent(NULL);
  34.     agent->autorelease();
  35.     return agent;
  36. }
  37.  
  38.  
  39.  
  40. PedWindow *
  41. Ped1ObjectDeity::CreateWindow()
  42. {
  43.     return CreateTEWindow();
  44.     
  45.     PedWindow *wind = new PedWindow();
  46.     wind->autorelease();
  47.     return wind;
  48. }
  49.  
  50. PedWindow *
  51. Ped1ObjectDeity::CreateTEWindow()
  52. {
  53.     PedAgent *agent = new PedAgent(NULL);
  54.     PedWindow *wind = new PedWindow(agent);
  55.     PedPane *pane = new PedPaneTE(*wind);
  56.     wind->SetPane(pane);
  57.     // Release everything we allocated.  Windows must be autoreleased,
  58.     // because they're not retained until they're opened.
  59.     agent->release();
  60.     wind->autorelease();
  61.     pane->release();
  62.     return wind;
  63. }
  64.  
  65. /*
  66. void
  67. Ped1ObjectDeity::RegisterFabricator(ObjCode inCode, PedFabricator inFab)
  68. {
  69.     if (inCode == 'Agnt') {
  70.         mFabAgent = inFab;
  71.     }
  72. }
  73. */
  74.