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

  1. // Trees management for Clipper !!!
  2.  
  3. #include "FiveWin.ch"
  4.  
  5. static aTrees := {}
  6. static nLevel := 0
  7.  
  8. static cBmpOp, cBmpCl
  9.  
  10. //----------------------------------------------------------------------------//
  11.  
  12. function TreeBegin( cBmpOpen, cBmpClose )
  13.  
  14.    local oTree := TLinkList()
  15.  
  16.    if ! Empty( cBmpOpen )
  17.       cBmpOp = cBmpOpen
  18.       cBmpCl = cBmpClose
  19.    endif
  20.  
  21.    AAdd( aTrees, oTree )
  22.    nLevel++
  23.  
  24. return oTree
  25.  
  26. //----------------------------------------------------------------------------//
  27.  
  28. function _TreeItem( cLabel, cBmpOpen, cBmpClose )
  29.  
  30.    local hBmpOpen, hBmpClose
  31.  
  32.    DEFAULT cBmpOpen := cBmpOp, cBmpClose := cBmpCl
  33.  
  34.    if ! Empty( cBmpOpen )
  35.       hBmpOpen  = LoadBitmap( GetResources(), cBmpOpen )
  36.       hBmpClose = LoadBitmap( GetResources(), cBmpClose )
  37.    endif
  38.  
  39. return ATail( aTrees ):Add( cLabel, nLevel, hBmpOpen, hBmpClose )
  40.  
  41. //----------------------------------------------------------------------------//
  42.  
  43. function TreeEnd()
  44.  
  45.    local oTree := ATail( aTrees )
  46.  
  47.    if Len( aTrees ) > 1
  48.       ASize( aTrees, Len( aTrees ) - 1 )
  49.       ATail( aTrees ):oLast:oTree = oTree
  50.       oTree:oFirst:oPrev = ATail( aTrees ):oLast
  51.    endif
  52.  
  53.    nLevel--
  54.  
  55. return nil
  56.  
  57. //----------------------------------------------------------------------------//
  58.