home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 4611 / fw16d.ins / SOURCE / CLASSES / PDMENU.PRG < prev    next >
Text File  |  1994-04-29  |  1KB  |  53 lines

  1. #include "FiveWin.ch"
  2.  
  3. #define MENU  1
  4. #define ITEMS 2
  5.  
  6. static aMenus := {}
  7.  
  8. //----------------------------------------------------------------------------//
  9.  
  10. function MenuBegin( lPopup, lSystem, oWnd )
  11.  
  12.    DEFAULT lSystem := .f.
  13.  
  14.    if lSystem
  15.       AAdd( aMenus, { TMenu():NewSys( oWnd ), {} } )
  16.       oWnd:oSysMenu = ATail( aMenus )[ MENU ]
  17.    else
  18.       AAdd( aMenus, { TMenu():New( lPopup ), {} } )
  19.    endif
  20.  
  21. return ATail( aMenus )[ MENU ]
  22.  
  23. //----------------------------------------------------------------------------//
  24.  
  25. function MenuAddItem( cPrompt, cMsg, lChecked, lActive, bAction, cBmpFile,;
  26.                       cResName, oMenu, bBlock, nVKState, nVirtKey )
  27.  
  28.    local oItem := TMenuItem():New( cPrompt, cMsg, lChecked, lActive,;
  29.                                    If( bBlock != nil, bBlock, bAction ),;
  30.                                    cBmpFile, cResName, nVKState, nVirtKey )
  31.  
  32.    AAdd( ATail( aMenus )[ ITEMS ], oItem )
  33.  
  34. return oItem
  35.  
  36. //----------------------------------------------------------------------------//
  37.  
  38. function MenuEnd()
  39.  
  40.    local oMenu  := ATail( aMenus )[ MENU ]
  41.    local aItems := ATail( aMenus )[ ITEMS ]
  42.  
  43.    AEval( aItems, { | oItem | oMenu:Add( oItem ) } )
  44.  
  45.    ASize( aMenus, Len( aMenus ) - 1 )
  46.    if Len( aMenus ) > 0
  47.       ATail( ATail( aMenus )[ ITEMS ] ):bAction = oMenu
  48.    endif
  49.  
  50. return oMenu
  51.  
  52. //----------------------------------------------------------------------------//
  53.