home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / Programming / MacStarter Pascal 1.0 / noCommentsProcs.p < prev    next >
Encoding:
Text File  |  1993-12-11  |  2.9 KB  |  160 lines  |  [TEXT/PJMM]

  1. { This is a copy of the file applicationProcs.p, with most comments removed.  You might }
  2. { prefer to use this file as a base for your applications instead of applicationProcs.p.  }
  3.  
  4. unit applicationProcs;
  5.  
  6. interface
  7.  
  8. uses
  9.     xWindow, xControlDecoration, xInputDecoration;
  10.  
  11. const
  12.  
  13.     maxSleepTime = 5;
  14.     ApplicationShortName = 'Generic Application';
  15.     ApplicationLongName = 'Generic Macintosh Application , version 0.9 ';
  16.     AuthorName = 'David Eck';
  17.     AuthorAddress1 = 'Hobart and William Smith Colleges';
  18.     AuthorAddress2 = 'Geneva, NY   14456';
  19.     AuthorAddress3 = '(Email Address:   eck@hws.BITNET)';
  20.     CommentLine = 'This is a shell program that you can use as a basis for writing Macintosh applications.';
  21.  
  22.  
  23.  
  24. var
  25.     editMenu: MenuHandle;
  26.     fileMenu: MenuHandle;
  27.  
  28.  
  29. procedure InitializeApplication;
  30. procedure CleanUpApplication;
  31. procedure DoEditMenu (itemNum: integer);
  32. procedure DoFileMenu (itemNum: integer;
  33.                             var done: boolean);
  34. procedure DoOtherMenu (menuNum, itemNum: integer);
  35. procedure UpdateMenus;
  36. procedure ApplicationIdle;
  37.  
  38.  
  39. implementation
  40.  
  41.  
  42. type
  43.  
  44.     myWin = object(xWindow)
  45.             procedure setDefaults;
  46.             override;
  47.             procedure openInRect (title: string;
  48.                                         left, top, right, bottom: integer);
  49.             override;
  50.             procedure doRedraw (badRect: Rect);
  51.             override;
  52.             procedure doContentClick (localPt: Point;
  53.                                         modifiers: longint);
  54.             override;
  55.             procedure doKey (ch: char;
  56.                                         modifiers: longint);
  57.             override;
  58.         end;
  59.  
  60.  
  61. procedure myWin.setDefaults;
  62.     begin
  63.         inherited setDefaults;
  64.     end;
  65.  
  66. procedure myWin.openInRect (title: string;
  67.                                 left, top, right, bottom: integer);
  68.     begin
  69.         inherited openInRect(title, left, top, right, bottom);
  70.     end;
  71.  
  72.  
  73. procedure myWin.doRedraw (badRect: Rect);
  74.     begin
  75.         inherited doRedraw(badRect);
  76.     end;
  77.  
  78.  
  79. procedure myWin.doContentClick (localPt: Point;
  80.                                 modifiers: longint);
  81.     begin
  82.         inherited doContentClick(localPt, modifiers);
  83.     end;
  84.  
  85.  
  86. procedure myWin.doKey (ch: char;
  87.                                 modifiers: longint);
  88.     begin
  89.         inherited doKey(ch, modifiers)
  90.     end;
  91.  
  92.  
  93. procedure OpenAWindow;
  94.     var
  95.         Win: myWin;
  96.     begin
  97.         new(Win);
  98.         Win.open('Sample Window');
  99.     end;
  100.  
  101. procedure InitializeApplication;
  102.     begin
  103.         OpenAWindow;
  104.     end;
  105.  
  106. procedure CleanUpApplication;
  107.     begin
  108.     end;
  109.  
  110. procedure UpdateMenus;
  111.     var
  112.         win: WindowPtr;
  113.         xWin: xWindow;
  114.     begin
  115.         win := FrontWindow;
  116.         if Window2xWindow(win, xWin) then
  117.             EnableItem(fileMenu, 2)
  118.         else
  119.             DisableItem(fileMenu, 2);
  120.     end;
  121.  
  122.  
  123. procedure CloseFrontWindow;
  124.     var
  125.         X: xWindow;
  126.     begin
  127.         if window2xWindow(FrontWindow, X) then
  128.             X.doClose
  129.     end;
  130.  
  131. procedure DoFileMenu (itemNum: integer;
  132.                                 var done: boolean);
  133.     begin
  134.         case itemNum of
  135.             1:    { New command }
  136.                 OpenAWindow;
  137.             2:    { Close command }
  138.                 CloseFrontWindow;
  139.             4:    { Quit command }
  140.                 done := true;
  141.         end;
  142.     end;
  143.  
  144. procedure DoEditMenu (itemNum: integer);
  145.     begin
  146.     end;
  147.  
  148. procedure DoOtherMenu (menuNum, itemNum: integer);
  149.     begin
  150.     end;
  151.  
  152. procedure ApplicationIdle;
  153.     var
  154.         X: xWindow;
  155.     begin
  156.         if window2xWindow(FrontWindow, X) then
  157.             X.idle;
  158.     end;
  159.  
  160. end.