// Copyright ©1994 Apple Computer, Inc., All Rights Reserved. // constants for the application constant kAppSymbol := '|InfoButton:PIEDTS|; constant kMaxAppWidth := 240 ; constant kMaxAppHeight := 336 ; // other constants constant kAppSplashSymbol := '|Splash:InfoButton:PIEDTS| ; // constants for the InfoButton items: constant kAboutItem := 0 ; constant kHelpItem := 1 ; constant kPrefsItem := 2 ; constant kThisWayItem := 4 ; constant kThatWayItem := 5 ; constant kTheOtherWayItem := 6 ; // get the sounds... r := OpenResFileX(HOME&"infoButton.rsrc") ; DefConst('kEeahSound, GetSound("eeah")) ; CloseResFileX(r) ; // ---- End Project Data ---- // ---- File infoButton.t ---- // Before Script for "myBase" // Copyright ©1994 Apple Computer, Inc., All Rights Reserved. myBase := {viewFlags: 4, viewFormat: nil, viewBounds: {left: 0, top: 0, right: 240, bottom: 328}, declareSelf: 'base, viewSetupFormScript: func() begin local l := GetAppParams(); viewBounds := RelBounds(l.AppAreaLeft, l.appAreaTop, MIN(kMaxAppWidth, l.appAreaWidth), MIN(kMaxAppHeight, l.appAreaHeight)) ; :MarkAppInfoItem(kThisWayItem); end, AppInfoItems: nil, InfoItemSelected: func(item) begin if item = kAboutItem then AboutView:Open(); else if item = kHelpItem then HelpView:Open(); else if item = kPrefsItem then PrefsView:Open(); else begin :MarkAppInfoItem(item) ; end; end, DefaultAppInfoItems: ["About", "Help", "Prefs", 'pickSeparator, "This Way", "That Way", "The Other Way"] , MarkAppInfoItem: func(item) begin AppInfoItems := DeepClone(DefaultAppInfoItems) ; AppInfoItems[item] := {item: AppInfoItems[item], mark: kCheckMarkChar} ; if item >= kThisWayItem then begin globalSortType := item ; theTitle.title := titleBase & "- Sort " & DefaultAppInfoItems[globalSortType] ; // a hack to get the title view to update itself if theTitle.viewCObject then theTitle:SyncView(); end; end, titleBase: "Info Button", globalSortType: 4, viewclass: 74, debug: "myBase" }; _view000 := /* child of myBase */ {text: "This Space Intentionally Left Blank (well, apart from this text)", viewBounds: {left: 0, top: 20, right: 0, bottom: -20}, viewJustify: 246, viewFont: {family: 'NewYork, face: kFaceNormal, size: 12}, _proto: protoStaticText }; _view001 := /* child of myBase */ {_proto: protoStatus}; // ---- File protoInfoButton ---- // Before Script for "info" // Copyright ©1994 Apple Computer, Inc., All Rights Reserved. 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, viewclass: 76, debug: "info" }; // After Script for "info" thisView := info; // 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)); // ---- Back in File infoButton.t ---- _view002 := /* child of _view001 */ { pickActionScript: func(index) begin // MUST do this :Hilite(nil); :InfoItemSelected(index) ; end, _proto: info }; theTitle := /* child of myBase */ {viewBounds: {left: -12, top: 8, right: 92, bottom: 24}, _proto: protoTitle, debug: "theTitle" }; // View theTitle is declared to myBase HelpView := /* child of myBase */ {viewBounds: {left: 0, top: 0, right: 200, bottom: 100}, viewJustify: 80, viewFlags: 0, showSound: kEeahSound, _proto: protoFloatNGo, debug: "HelpView" }; // View HelpView is declared to myBase _view003 := /* child of HelpView */ { text: "Hacker, help thyself.\n\nBut seriously, see the 'Beyond Help' sample code (version 3 or better) to see how to do help books." , viewBounds: {top: 0, left: 0, right: 0, bottom: -10}, viewJustify: 246, _proto: protoStaticText }; PrefsView := /* child of myBase */ {viewBounds: {left: 0, top: 0, right: 200, bottom: 100}, viewJustify: 80, viewFlags: 0, showSound: kEeahSound, _proto: protoFloatNGo, debug: "PrefsView" }; // View PrefsView is declared to myBase _view004 := /* child of PrefsView */ { text: "Hacker, help thyself.\n\nBut seriously, see the\n'Preefer Madness'\nsample code (version 4 or better) to see how to do Preferences." , viewBounds: {top: 10, left: 0, right: 0, bottom: -10}, viewJustify: 246, viewFlags: 2051, _proto: protoStaticText }; AboutView := /* child of myBase */ {viewBounds: {left: 0, top: 0, right: 200, bottom: 100}, viewJustify: 80, viewFlags: 0, showSound: kEeahSound, _proto: protoFloatNGo, debug: "AboutView" }; // View AboutView is declared to myBase _view005 := /* child of AboutView */ { text: "Hacker, help thyself.\n\nBut seriously, see the 'Splash Screen' sample code (version 1 or better) to see how to do an About splash screen." , viewBounds: {top: 10, left: 0, right: 0, bottom: -10}, viewJustify: 246, viewFlags: 2051, _proto: protoStaticText }; // ---- Beginning of section for non used Layout files ---- // End of output