UNIT USamDialog; {Copyright 1983 by Apple Computer, Inc} (* A sample application to illustrate use of the Dialog Building Block 5April1984 01:00 *) INTERFACE USES {$U UObject} UObject, {$U QuickDraw} QuickDraw, {$U UDraw} UDraw, {$U UABC} UABC, {$U UUnivText} UTKUniversalText, {$U UText} UText, {$U UDialog} UDialog; CONST uSamDiVersion = 'Dialog Sample 5Apr84 01:00'; diCopyright = 'Copyright 1984 by Apple Computer, Inc.'; samDiTraceLevel = 12; {BP level used for all methods in this unit} { Menu constants for the test application } { The Test Dialogs } muTest = 2101; {put up test dialog in a dialog Box (it's also seen in the main window)} muScale = 2102; {put up LisaProject's time scale dialog box} muFrameSample = 2103; {Examples of alternative input-frame parameters} muPrMgr = 2104; {chunk of print manager-like dialog} muOneNumber = 2105; {simple dialog to obtain one number} xxOnLilac = 1100; {the four phrases which will be refreshed from the phrase file, not} xxOffLilac = 1101; { from the Resource file } xxWren = 1102; xxTroglodyte = 1103; TYPE TMyProcess = SUBCLASS OF TProcess FUNCTION {TMyProcess.}CREATE: TMyProcess; {FUNCTION TMyProcess. NewDocManager(volumePrefix: TFilePath; openAsTool: BOOLEAN): TDocManager;} END; TMyDocManager = SUBCLASS OF TDocManager FUNCTION {TMyDocManager.}CREATE(object: TObject; itsHeap: THeap; itsPathPrefix: TFilePath) : TMyDocManager; {FUNCTION TMyDocManager. NewWindow(heap: THeap; wmgrID: TWindowID): TWindow;} END; TMyDialogView = SUBCLASS OF TDialogView {NOTE: We only subclass TDialogView here to illustrate how client-defined non-dialog features can be incorporated into a view which shows dialogs} FUNCTION {TMyDialogView.}CREATE(object: TObject; itsHeap: THeap; itsExtentLRect: LRect; itsPanel: TPanel; inDialogBox: BOOLEAN): TMyDialogView; END; TDemoDialog = SUBCLASS OF TDialog {Big dialog that illustrates almost everything} reportMessage: TImageWithID; FUNCTION {TDemoDialog.}CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel; inDialogBox: BOOLEAN): TDemoDialog; {PROCEDURE TDemoDialog. ButtonPushed(button: TButton);} PROCEDURE {TDemoDialog.}ChangeReportMessage(newString: S255); {PROCEDURE TDemoDialog. CheckboxHit(checkbox: TCheckbox);} {PROCEDURE TDemoDialog. Draw;} END; TMyFootball = SUBCLASS OF TImageWithID {illustration of a user-defined subclass of TDialogImage} FUNCTION {TMyFootball.}CREATE(object: TObject; itsHeap: THeap; itsView: TView): TMyFootball; {PROCEDURE TMyFootball. Draw;} END; TScaleDialog = SUBCLASS OF TDialog {LisaProject-like Time-scale dialog + multiple dialog images} FUNCTION {TScaleDialog.}CREATE(object: TObject; itsheap: THeap; itsPanel:TPanel): TScaleDialog; {PROCEDURE TScaleDialog. ButtonPushed(button: TButton);} END; TExtraDialog = SUBCLASS OF TDialog {a second Dialog seen in the same view as the TScaleDialog} FUNCTION {TExtraDialog.}CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel): TExtraDialog; END; TFrameSampleDialog = SUBCLASS OF TDialog {Examples of input frame use} FUNCTION {TFrameSampleDialog.}CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel) : TFrameSampleDialog; {PROCEDURE TFrameSampleDialog. ButtonPushed(button: TButton);} END; TPrMgrDialog = SUBCLASS OF TDialog { a piece of print-manager-like dialog to illustrate dynamic adding/deleting of components } FUNCTION {TPrMgrDialog.}CREATE(object: TObject; itsHeap: THeap;itsPanel: TPanel): TPrMgrDialog; {PROCEDURE TPrMgrDialog. CheckboxHit(checkbox: TCheckbox; toggleDirection: BOOLEAN);} END; TMyWindow = SUBCLASS OF TWindow scaleWindow: TDialogWindow; frameWindow: TDialogWindow; prMgrWindow: TDialogWindow; demoWindow: TDialogWindow; demoDialog: TDemoDialog; {the dialog seen in the main window} FUNCTION {TMyWindow.}CREATE(object: TObject; itsHeap: THeap; itsWmgrID: TWindowID): TMyWindow; {PROCEDURE TMyWindow. CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN;} {PROCEDURE TMyWindow. BlankStationery;} {FUNCTION TMyWindow. NewCommand(cmdNumber: TCmdNumber): TCommand;} END; IMPLEMENTATION {$I USamDialog2.TEXT} END.