home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-11 | 2.9 KB | 160 lines | [TEXT/PJMM] |
- { This is a copy of the file applicationProcs.p, with most comments removed. You might }
- { prefer to use this file as a base for your applications instead of applicationProcs.p. }
-
- unit applicationProcs;
-
- interface
-
- uses
- xWindow, xControlDecoration, xInputDecoration;
-
- const
-
- maxSleepTime = 5;
- ApplicationShortName = 'Generic Application';
- ApplicationLongName = 'Generic Macintosh Application , version 0.9 ';
- AuthorName = 'David Eck';
- AuthorAddress1 = 'Hobart and William Smith Colleges';
- AuthorAddress2 = 'Geneva, NY 14456';
- AuthorAddress3 = '(Email Address: eck@hws.BITNET)';
- CommentLine = 'This is a shell program that you can use as a basis for writing Macintosh applications.';
-
-
-
- var
- editMenu: MenuHandle;
- fileMenu: MenuHandle;
-
-
- procedure InitializeApplication;
- procedure CleanUpApplication;
- procedure DoEditMenu (itemNum: integer);
- procedure DoFileMenu (itemNum: integer;
- var done: boolean);
- procedure DoOtherMenu (menuNum, itemNum: integer);
- procedure UpdateMenus;
- procedure ApplicationIdle;
-
-
- implementation
-
-
- type
-
- myWin = object(xWindow)
- procedure setDefaults;
- override;
- procedure openInRect (title: string;
- left, top, right, bottom: integer);
- override;
- procedure doRedraw (badRect: Rect);
- override;
- procedure doContentClick (localPt: Point;
- modifiers: longint);
- override;
- procedure doKey (ch: char;
- modifiers: longint);
- override;
- end;
-
-
- procedure myWin.setDefaults;
- begin
- inherited setDefaults;
- end;
-
- procedure myWin.openInRect (title: string;
- left, top, right, bottom: integer);
- begin
- inherited openInRect(title, left, top, right, bottom);
- end;
-
-
- procedure myWin.doRedraw (badRect: Rect);
- begin
- inherited doRedraw(badRect);
- end;
-
-
- procedure myWin.doContentClick (localPt: Point;
- modifiers: longint);
- begin
- inherited doContentClick(localPt, modifiers);
- end;
-
-
- procedure myWin.doKey (ch: char;
- modifiers: longint);
- begin
- inherited doKey(ch, modifiers)
- end;
-
-
- procedure OpenAWindow;
- var
- Win: myWin;
- begin
- new(Win);
- Win.open('Sample Window');
- end;
-
- procedure InitializeApplication;
- begin
- OpenAWindow;
- end;
-
- procedure CleanUpApplication;
- begin
- end;
-
- procedure UpdateMenus;
- var
- win: WindowPtr;
- xWin: xWindow;
- begin
- win := FrontWindow;
- if Window2xWindow(win, xWin) then
- EnableItem(fileMenu, 2)
- else
- DisableItem(fileMenu, 2);
- end;
-
-
- procedure CloseFrontWindow;
- var
- X: xWindow;
- begin
- if window2xWindow(FrontWindow, X) then
- X.doClose
- end;
-
- procedure DoFileMenu (itemNum: integer;
- var done: boolean);
- begin
- case itemNum of
- 1: { New command }
- OpenAWindow;
- 2: { Close command }
- CloseFrontWindow;
- 4: { Quit command }
- done := true;
- end;
- end;
-
- procedure DoEditMenu (itemNum: integer);
- begin
- end;
-
- procedure DoOtherMenu (menuNum, itemNum: integer);
- begin
- end;
-
- procedure ApplicationIdle;
- var
- X: xWindow;
- begin
- if window2xWindow(FrontWindow, X) then
- X.idle;
- end;
-
- end.