Annotation of gforth/moof-exm.fs, revision 1.1
1.1 ! pazsan 1: \ usage:
! 2:
! 3: object class
! 4: cell var text
! 5: cell var len
! 6: cell var x
! 7: cell var y
! 8: method init
! 9: method draw
! 10: end-class button
! 11:
! 12: :noname ( o -- ) >r
! 13: r@ x @ r@ y @ at-xy r@ text @ r> len @ type ;
! 14: button defines draw
! 15: :noname ( addr u o -- ) >r
! 16: 0 r@ x ! 0 r@ y ! r@ len ! r> text ! ;
! 17: button defines init
! 18:
! 19: \ interitance
! 20:
! 21: : bold 27 emit ." [1m" ;
! 22: : normal 27 emit ." [0m" ;
! 23:
! 24: button class end-class bold-button
! 25: :noname bold [ button :: draw ] normal ; bold-button defines draw
! 26:
! 27: \ Create and draw a button:
! 28:
! 29: button new Constant foo
! 30: s" thin foo" foo init
! 31: page
! 32: foo draw
! 33: bold-button new Constant bar
! 34: s" fat bar" bar init
! 35: 1 bar y !
! 36: bar draw
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>