home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CADSP 1.0 / Demo / CNBPPane.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  1.2 KB  |  65 lines  |  [TEXT/KAHL]

  1. /***
  2.  * CNBPPane
  3.  *
  4.  *        ArrayPane to display NBP names
  5.  *
  6.  *        needs the table classes
  7.  *
  8.  *        Copyright © 1992 Bernard Bernstein. All rights reserved.
  9.  ***/ 
  10.  
  11. #include "CNBPPane.h"
  12. #include "CNBP.h"
  13. #include <CArray.h>
  14.  
  15. /***
  16.  * INBPPane
  17.  *
  18.  *        Initialize the pane
  19.  ***/
  20. void CNBPPane::INBPPane( CView *anEnclosure, CBureaucrat *aSupervisor,
  21.                          short aWidth, short aHeight,
  22.                          short aHEncl, short aVEncl,
  23.                          SizingOption aHSizing, SizingOption aVSizing)
  24. {
  25.     CArrayPane::IArrayPane( anEnclosure, aSupervisor, aWidth, aHeight,
  26.                     aHEncl, aVEncl, aHSizing, aVSizing);
  27. }
  28.  
  29. /***
  30.  * GetCellText
  31.  *
  32.  *        return the text to print in the list
  33.  ***/
  34. void CNBPPane::GetCellText(Cell aCell, short availableWidth, StringPtr itsText)
  35. {
  36.     if (itsArray)
  37.         {
  38.         NBPAddrNameRec addr;
  39.         itsArray->GetItem( &addr, aCell.v+1);
  40.         BlockMove(addr.name, itsText, addr.name[0]+1);
  41.         }
  42. }
  43.  
  44. /***
  45.  * GetSelectedAddr
  46.  *
  47.  *        return the AddrBlock of the selected NBP name
  48.  ***/
  49. AddrBlock CNBPPane::GetSelectedAddr(void)
  50. {
  51.     Cell aCell;
  52.     NBPAddrNameRec addr;
  53.     
  54.     addr.addr.aNet = 0;
  55.     addr.addr.aNode = 0x00;
  56.     addr.addr.aSocket = 0x00;
  57.     SetCell(aCell, 0, 0);
  58.     if (GetSelect( TRUE, &aCell))
  59.         {
  60.         itsArray->GetItem(&addr, ++aCell.v);
  61.         }
  62.     return addr.addr;
  63. }
  64.  
  65.