// Text of project Splash written on 5/13/95 at 11:26 PM // Beginning of file The Splash Screen.t // Before Script for "SplashBase" // Copyright © 1994 by Apple Computer, Inc. All rights reserved. // Note that this view is NOT initially visible. This keeps it from // appearing as a child in the application. Because it is linked to // the app and declared, the template will be available to the code. SplashBase := {viewFlags: 0, viewFormat: 131665, viewBounds: {left: 0, top: 0, right: 240, bottom: 336}, viewSetupFormScript: func() begin local a := GetAppParams(); constant kMaxAppWidth := 240; constant kMaxAppHeight := 336; self.viewBounds := RelBounds(a.appAreaLeft + 4, a.appAreaTop + 4, MIN(a.appAreaWidth, kMaxAppWidth) - 8, MIN(a.appAreaHeight, kMaxAppHeight) - 8); end, viewEffect: 8521952, hideCloseBoxP: true, viewSetupDoneScript: func() begin if hideCloseBoxP then SplashClose:Hide(); end, declareSelf: 'base, UpdateStatus: func(message) begin // change the status text SetValue(StatusMessage, 'text, message) ; RefreshViews() end, debug: "SplashBase", viewClass: 74 }; AboutPic := {viewFlags: 1, icon: GetPictAsBits("newt 300", nil), viewFormat: nil, viewBounds: {left: 0, top: 20, right: 120, bottom: 120}, viewJustify: 22, debug: "AboutPic", viewClass: 76 }; AddStepForm(SplashBase, AboutPic); text1 := {viewFlags: 1, viewFormat: 0, viewLineSpacing: 20, viewFont: {family: 'newYork, face: kFaceNormal, size: 18}, viewBounds: {left: 0, top: 5, right: 0, bottom: 30}, text: "Info Button Sample!", viewJustify: 8374, debug: "text1", viewClass: 81 }; AddStepForm(SplashBase, text1); text2 := {viewFlags: 1, viewFormat: 0, viewLineSpacing: 12, viewFont: {family: 'newYork, face: kFaceNormal, size: 10}, viewBounds: {top: 5, left: 10, right: -10, bottom: 33}, text: "Copyright \u00A9\u 1994 Apple Computer, Inc., All Rights Reserved.", viewJustify: 8374, debug: "text2", viewClass: 81 }; AddStepForm(SplashBase, text2); text3 := {viewFlags: 1, viewFormat: 0, viewLineSpacing: 11, viewFont: {family: 'espy, face: kFaceNormal, size: 9}, viewBounds: {top: 5, left: 20, right: -20, bottom: 78}, viewJustify: 8374, text: "This sample gives you a proto you can use for the info button in your application. It was written at great expense at the last minute by a specially trained team of Peruvian Llamas. However, my boss will not let me say\nthat, so I have to take the credit." , debug: "text3", viewClass: 81 }; AddStepForm(SplashBase, text3); text4 := {viewFlags: 1, viewFormat: 0, viewLineSpacing: 12, viewFont: {family: 'newYork, face: kFaceNormal, size: 10}, viewBounds: {top: 0, left: 10, right: -10, bottom: 25}, text: "P.S., Have you hugged your Llama today?", viewJustify: 8374, debug: "text4", viewClass: 81 }; AddStepForm(SplashBase, text4); SplashClose := {debug: "SplashClose", _proto: @166}; AddStepForm(SplashBase, SplashClose); StepDeclare(SplashBase, SplashClose, 'SplashClose); StatusMessage := {text: "", viewBounds: {top: -20, left: 0, right: -20, bottom: 0}, viewJustify: 8388788, debug: "StatusMessage", _proto: @218 }; AddStepForm(SplashBase, StatusMessage); StepDeclare(SplashBase, StatusMessage, 'StatusMessage); constant |layout_The Splash Screen.t| := SplashBase; // End of file The Splash Screen.t // Beginning of file protoInfoButton info := {viewBounds: {left: 17, top: 0, right: 30, bottom: 12}, viewFormat: 67109457, pickCancelledScript: func() begin :Hilite(nil); end, icon: GetPictAsBits("info icon", nil), viewClickScript: func(unit) begin if :TrackHilite(unit) then begin local l := :LocalBox(); DoPopUp(AppInfoItems, l.right+3, l.top, self); end; end, viewFlags: 513, debug: "info", viewClass: 76 }; // After Script for "info" thisView := info; // Copyright ©1994 Apple Computer, Inc., All Rights Reserved. // set the bounds of the button so that it is to the right // of the clock and the correct height for the status bar // NOTE: this is the first button, so argument to the // ButtonBounds function MUST be negative thisView.viewBounds := ButtonBounds(-(thisView.viewBounds.right - thisView.viewBounds.left)); constant |layout_protoInfoButton| := info; // End of file protoInfoButton // Beginning of file The Application.t // Before Script for "theApp" // Copyright © 1994 by Apple Computer, Inc. All rights reserved. // Note that this view is NOT initially visible. This keeps it from // appearing as a child in the application. Because it is linked to // the app and declared, the template will be available to the code. theApp := {title: "Splash Screen Demo", viewBounds: {left: 0, top: 2, right: 236, bottom: 334}, viewFormat: 328017, viewSetupFormScript: func() begin // open the splash screen mySplashScreen := BuildContext(theSplashScreen._proto); mySplashScreen:Open(); // because it's initially invisible RefreshViews(); // make the screen update mySplashScreen:UpdateStatus("Initializing..."); // do the rest of the view setup local a := GetAppParams(); constant kMaxAppWidth := 240; constant kMaxAppHeight := 336; self.viewBounds := RelBounds(a.appAreaLeft, a.appAreaTop, MIN(a.appAreaWidth, kMaxAppWidth), MIN(a.appAreaHeight, kMaxAppHeight)); mySplashScreen:UpdateStatus("Wasting Time..."); // waste some time (inefficiently--to simulate a real app processing) for i := 1 to 100 do sleep(1); end, viewSetupChildrenScript: func() begin mySplashScreen:UpdateStatus("Waisting More Time..."); // waste some time (inefficiently--to simulate a real app processing) for i := 1 to 100 do sleep(1); end, viewSetupDoneScript: func() begin mySplashScreen:UpdateStatus("Last Bit of Waste..."); // waste some time (inefficiently--to simulate a real app processing) for i := 1 to 100 do sleep(1); // Finally... put the splash screen away. AddDeferredAction(CloseSplashScreen, []); end, mySplashScreen: nil, viewQuitScript: func() begin // in case close happens unexpectedly (card yanking, auto close) // close the splash screen, use :? in case it's NIL mySplashScreen:?Close(); // always nil out slots that may have big things in them. mySplashScreen := nil; end, CloseSplashScreen: func() begin mySplashScreen:?Close(); mySplashScreen := NIL; end, AppInfoItems: ["About"], declareSelf: 'base, InfoItemSelected: func(item) begin // this is where you respond to the info button // see the pickActionScript in the protoInfoButton to // to see where this script is called from. // see the infoButton sample for details on protoInfoButton // open up the About view // but make sure the close box shows theSplashScreen.hideCloseBoxP := nil ; theSplashScreen:Open(); end, viewFlags: 4, debug: "theApp", viewClass: 74 }; _view000 := {text: "THIS SPACE INTENTIONALLY LEFT BLANK", viewBounds: {left: 8, top: 120, right: 232, bottom: 144}, viewJustify: 8388614, _proto: @218 }; AddStepForm(theApp, _view000); theSplashScreen := LinkedSubview(SplashBase, {viewBounds: {left: 82, top: 208, right: 202, bottom: 240}, debug: "theSplashScreen" }); AddStepForm(theApp, theSplashScreen); StepDeclare(theApp, theSplashScreen, 'theSplashScreen); _view001 := {viewBounds: {left: 0, top: 0, right: 104, bottom: 16}, _proto: @229}; AddStepForm(theApp, _view001); _view002 := {_proto: @219}; AddStepForm(theApp, _view002); _view003 := { pickActionScript: func(index) begin // MUST do this :Hilite(nil); :InfoItemSelected(index) ; end, _proto: info }; AddStepForm(_view002, _view003); constant |layout_The Application.t| := theApp; // End of file The Application.t