home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-02 | 5.6 KB | 229 lines | [TEXT/PJMM] |
- {****************************************************}
- {}
- { CShHelpDirector.p }
- {}
- { DLOGDirector class for the director which handles the about/help dialog. }
- {}
- {****************************************************}
-
-
- unit CShHelpDirector;
-
- interface
-
- uses
- TCL, ShIntf;
-
- implementation
-
- const
- VuIDOKButton = 1;
- VuIDPicture = 2;
- VuIDAboutButton = 3;
- VuIDHelpButton = 4;
- VuIDCreditsButton = 5;
-
-
- {****************************************************}
- {}
- { IShHelpDirector }
- {}
- { Construction of the help director object. }
- {}
- {****************************************************}
-
- procedure CShHelpDirector.IShHelpDirector (aSupervisor: CShApp);
-
- begin { IShHelpDirector }
- IDLOGDirector(DLOGAboutAndHelp, aSupervisor);
-
- itsPicture := CPicture(FindViewByID(VuIDPicture));
- itsAboutButton := CButton(FindViewByID(VuIDAboutButton));
- itsHelpButton := CButton(FindViewByID(VuIDHelpButton));
- itsCreditsButton := CButton(FindViewByID(VuIDCreditsButton));
- end; { IShHelpDirector }
-
-
- {****************************************************}
- {}
- { Free }
- {}
- { Destruction of the help director object. We set our pointers to nil, for the }
- { objects to which they were pointing will be disposed of in inherited methods. }
- {}
- {****************************************************}
-
- procedure CShHelpDirector.Free;
-
- begin { Free }
- itsPicture := nil;
- itsAboutButton := nil;
- itsHelpButton := nil;
- itsCreditsButton := nil;
-
- inherited Free;
- end; { Free }
-
-
- {****************************************************}
- {}
- { DoCommand }
- {}
- { The help director is responsible for changing between help screens. }
- {}
- {****************************************************}
-
- procedure CShHelpDirector.DoCommand (theCommand: longint);
-
- begin { DoCommand }
- case theCommand of
-
- cmdAboutScreen: begin
- SetDialogPanes(AboutScreen);
- end; { cmdAboutScreen }
-
- cmdHelpScreen: begin
- SetDialogPanes(HelpScreen);
- end; { cmdHelpScreen }
-
- cmdCreditsScreen: begin
- SetDialogPanes(CreditsScreen);
- end; { cmdCreditsScreen }
-
- otherwise begin
- inherited DoCommand(theCommand);
- end; { otherwise }
- end; { case }
- end; { DoCommand }
-
-
- {****************************************************}
- {}
- { Dawdle }
- {}
- { Continuous scrolling of the credits screen. }
- {}
- {****************************************************}
-
- procedure CShHelpDirector.Dawdle (var maxSleep: longint);
-
- const
- kScrollStep = 1;
- kScrollDelay = 1;
-
- var
- theExtentH, theExtentV: LongInt;
- theSpanH, theSpanV: Integer;
- thePos: LongPt;
- oldTicks: LongInt;
-
- begin { Dawdle }
- if not itsCreditsButton.IsActive then begin
-
- itsPicture.GetExtent(theExtentH, theExtentV);
- itsPicture.GetFrameSpan(theSpanH, theSpanV);
- itsPicture.GetPosition(thePos);
-
- if thePos.v < theExtentV - theSpanV then begin
- itsPicture.Scroll(0, kScrollStep, kRedraw);
- end { if }
- else begin
- SetLongPt(thePos, 0, 0);
- itsPicture.ScrollTo(thePos, kRedraw);
- end; { else }
-
- oldTicks := TickCount;
- while TickCount <= oldTicks + kScrollDelay do begin
- { Nothing }
- end; { while }
-
- maxSleep := 0;
- end; { if }
- end; { Dawdle }
-
-
- {****************************************************}
- {}
- { SetDialogPanes }
- {}
- { Set up the panes for each of the possible screens. }
- {}
- {****************************************************}
-
- procedure CShHelpDirector.SetDialogPanes (aScreenType: HelpScreenType);
-
- var
- theTopLeftCorner: LongPt;
- theSpanH, theSpanV: Integer;
-
- begin { SetDialogPanes }
- case aScreenType of
-
- AboutScreen: begin
- itsAboutButton.Deactivate;
- itsHelpButton.Activate;
- itsCreditsButton.Activate;
- if gSystem.hasColorQD then begin
- itsPicture.UsePICT(PICTAboutColour);
- end { if }
- else begin
- itsPicture.UsePICT(PICTAboutBW);
- end; { else }
- SetLongPt(theTopLeftCorner, 0, 0);
- end; { AboutScreen }
-
- HelpScreen: begin
- itsAboutButton.Activate;
- itsHelpButton.Deactivate;
- itsCreditsButton.Activate;
- if gSystem.hasColorQD then begin
- itsPicture.UsePICT(PICTHelpColour);
- end { if }
- else begin
- itsPicture.UsePICT(PICTHelpBW);
- end; { else }
- SetLongPt(theTopLeftCorner, 0, 0);
- end; { HelpScreen }
-
- CreditsScreen: begin
- itsAboutButton.Activate;
- itsHelpButton.Activate;
- itsCreditsButton.Deactivate;
- if gSystem.hasColorQD then begin
- itsPicture.UsePICT(PICTCreditsColour);
- end { if }
- else begin
- itsPicture.UsePICT(PICTCreditsBW);
- end; { else }
- itsPicture.GetFrameSpan(theSpanH, theSpanV);
- SetLongPt(theTopLeftCorner, 0, theSpanV);
- end; { CreditsScreen }
-
- end; { case }
-
- itsPicture.ScrollTo(theTopLeftCorner, kNoRedraw);
- itsPicture.Refresh;
- end; { SetDialogPanes }
-
-
- {****************************************************}
- {}
- { DoAboutAndHelp }
- {}
- { Enter the about/help dialog, starting from the given first screen. }
- {}
- {****************************************************}
-
- procedure CShHelpDirector.DoAboutAndHelp (aFirstScreen: HelpScreenType);
-
- var
- theDismissCmd: LongInt;
-
- begin { DoAboutAndHelp }
- SetDialogPanes(aFirstScreen);
- BeginDialog;
- theDismissCmd := DoModalDialog(cmdOK);
- end; { DoAboutAndHelp }
-
-
- end. { CShHelpDirector }