home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a066 / 1.img / MENUITEM.PRG < prev    next >
Encoding:
Text File  |  1992-03-20  |  997 b   |  58 lines

  1. /*
  2.     MenuItem.prg
  3.  
  4.     Copyright (c) 1991 Chris Muller and Anton van Straaten
  5. */
  6.  
  7. #include "class(y).ch"
  8. #include "win.ch"           // Class(y) sample window library header file
  9.  
  10.  
  11. create class MenuItem
  12.     instvar label
  13.     instvar action
  14.  
  15. export:
  16.     instvar row, col    readonly
  17.     instvar isActive    readonly
  18.  
  19.     method  draw
  20.     method  exec
  21.     method  nextCol
  22.     method  nextRow
  23. endclass
  24.  
  25.  
  26. constructor new(nRow, nCol, cLabel, oAction, isActive)
  27.     ::row      := nRow
  28.     ::col      := nCol
  29.     ::label    := cLabel
  30.     ::action   := oAction
  31.     ::isActive := if(isActive == NIL, .t., isActive)
  32. return
  33.  
  34.  
  35. method procedure draw
  36.     if ::isActive
  37.         @ ::row, ::col prompt ::label
  38.     else
  39.         @ ::row, ::col say ::label
  40.     end
  41. return
  42.  
  43.  
  44. method function nextRow
  45. return ::row + 1
  46.  
  47.  
  48. method function nextCol
  49. return ::col + len(::label)
  50.  
  51.  
  52. method procedure exec(oParent)
  53.     ::action:exec(oParent)
  54. return
  55.  
  56.  
  57. // eof menuitem.prg
  58.