home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK2.toast / Development Kits (Disc 2) / ScriptX / Draggable ScriptX Folders / utils / DTK / Examples / Custom Classes / NavButton.cls < prev    next >
Encoding:
Text File  |  1995-10-27  |  1.6 KB  |  55 lines  |  [TEXT/ttxt]

  1. format debug "--  Compiling NavButton Class . . .\n" undefined undefined
  2.  
  3. class NavButton(PushButton)
  4.   Instance Variables
  5.     destination
  6. end --NavButton
  7. method navigate self {class NavButton} bogus ->
  8. (
  9.     local myScene := self.presentedBy
  10.     showScene myScene.myStage self.destination
  11. )
  12.  
  13. Method init self {class NavButton}#rest args \
  14.                       #key    castNum: \
  15.                       lingo: 
  16.       ->(
  17.           local releaseBitmap := castList[castNum].boundary
  18.           releaseBitmap.invisibleColor := whiteColor
  19.           local cName := findSXKey(lingo, "PressedPresenter")
  20.           local pressedCast
  21.           if cName = undefined then (
  22.               format debug "-- ERROR! PressedPresenter keyword missing" undefined @unadorned
  23.               pressedCast := castList[castNum]
  24.           ) else (
  25.             local cNum := getKeyOne castByName (cName as string)
  26.               pressedCast := castList[cNum]
  27.           )
  28.           local pressedBitmap := pressedCast.boundary
  29.           pressedBitmap.invisibleColor := whiteColor
  30.           local rp := new TwoDShape boundary:releaseBitmap
  31.           local pp := new TwoDShape boundary:pressedBitmap
  32.           apply nextMethod self    releasedPresenter:(rp) pressedPresenter:(pp) args
  33.           for tPres in #(rp, pp) do (
  34.               local tBox := tPres.bbox
  35.             tPres.x := -(tBox.x1)
  36.             tPres.y := -(tBox.y1)
  37.         )
  38.         self.destination := findSXKey(lingo,"toScene")
  39.           self.activateAction := navigate
  40.           self.authorData := self
  41.           return self
  42. )
  43.  
  44. Method xSetter self {class NavButton} xVal ->
  45. (
  46.     nextMethod self (xVal + self.releasedPresenter.bbox.x1)
  47. )
  48.  
  49. Method ySetter self {class NavButton} yVal ->
  50. (
  51.     nextMethod self (yVal + self.releasedPresenter.bbox.y1)
  52. )
  53.  
  54. #(NavButton,#("destination"),#())
  55.