home *** CD-ROM | disk | FTP | other *** search
-
- 'Copyright 1994 Robert Schenk
- RESOURCES "NewButton.rsc","rsrcRSED","CDEF",20,"FiveButtons",0
- COMPILE 0,4
-
- DIM scratchRect;8
- DIM active%(5)
- "Entry"
- ENTERPROC%(varCode%, the Control&, message%, param&)
- returnValue&=0
- scratchRect;8= [theControl&]+_contrlRect
- SELECT message%
- CASE _drawCtlMsg
- GOSUB "Draw Control"
- CASE _hitCtlMsg
- GOSUB "User Action"
- CASE _calcCtlMsg
- GOSUB "Calc Control Regions"
- END SELECT
- "Exit"
- EXITPROC%=returnValue&
- END
-
- "Draw Control"
- ctlTitle$=PSTR$([theControl&]+_contrltitle)
- iconid=VAL(ctlTitle$)
-
- LONG IF PEEK ([theControl&]+_contrlVis)
- scratchRect.right=scratchRect.left+32
- scratchRect.bottom=scratchRect.top+32
- selector= PEEK([theControl&]+_contrlHilite)
- active(4)=selector/16:selector=selector-active(4)*16
- active(3)=selector/8:selector=selector-active(3)*8
- active(2)=selector/4:selector=selector-active(2)*4
- active(1)=selector/2::selector=selector-active(1)*2
- active(0)=selector
- selector= PEEK([theControl&]+_contrlHilite)
- FOR i = 0 TO 4
- id =iconid+5*i
- LONG IF selector=255
- Hndl&= FN GETICON(id+2)
- LONG IF Hndl&
- CALL PLOTICON(scratchRect,Hndl&)
- END IF
- XELSE
- LONG IF active(i)=1
- Hndl&= FN GETICON(id+1)
- LONG IF Hndl&
- CALL PLOTICON(scratchRect,Hndl&)
- END IF
- XELSE
- Hndl&= FN GETICON(id)
- LONG IF Hndl&
- CALL PLOTICON(scratchRect,Hndl&)
- END IF
- END IF
- END IF
- CALL OFFSETRECT(scratchRect,32,0)
- NEXT i
- END IF
- RETURN
- "User Action"
- scratchRect.right=scratchRect.left+32
- scratchRect.bottom=scratchRect.top+32
- FOR i% = 0 TO 4
- LONG IF FN PTINRECT(param&, scratchRect)
- returnValue&=1<<i%
- END IF
- CALL OFFSETRECT(scratchRect,32,0)
- NEXT i%
- i%=returnValue&
- POKE WORD ([theControl&]+_contrlValue), i%
- RETURN
-
- "Calc Control Regions"
- scratchRect.right=scratchRect.left+160
- scratchRect.bottom=scratchRect.top+32
- CALL OPENRGN
- CALL FRAMERECT(scratchRect)
- CALL CLOSERGN(param&)
- RETURN
-
-