home *** CD-ROM | disk | FTP | other *** search
- /*
- MenuItem.prg
-
- Copyright (c) 1991 Chris Muller and Anton van Straaten
- */
-
- #include "class(y).ch"
- #include "win.ch" // Class(y) sample window library header file
-
-
- create class MenuItem
- instvar label
- instvar action
-
- export:
- instvar row, col readonly
- instvar isActive readonly
-
- method draw
- method exec
- method nextCol
- method nextRow
- endclass
-
-
- constructor new(nRow, nCol, cLabel, oAction, isActive)
- ::row := nRow
- ::col := nCol
- ::label := cLabel
- ::action := oAction
- ::isActive := if(isActive == NIL, .t., isActive)
- return
-
-
- method procedure draw
- if ::isActive
- @ ::row, ::col prompt ::label
- else
- @ ::row, ::col say ::label
- end
- return
-
-
- method function nextRow
- return ::row + 1
-
-
- method function nextCol
- return ::col + len(::label)
-
-
- method procedure exec(oParent)
- ::action:exec(oParent)
- return
-
-
- // eof menuitem.prg
-