home *** CD-ROM | disk | FTP | other *** search
/ Master Technician / MASTER_TECHNICIAN.ISO / mtech / library / online / hardware / comtest / listbox.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-30  |  981 b   |  67 lines

  1. #define Uses_TApplication
  2. #define Uses_TNSCollection
  3. #define Uses_TCollection
  4. #define Uses_TEvent
  5. #define Uses_TListBox
  6. #include <tv.h>
  7. #include "listbox.h"
  8.  
  9.  
  10. void *ListBox::at(ccIndex index)
  11. {
  12.     return list()->at(index);
  13. }
  14.  
  15.  
  16. void ListBox::atFree(ccIndex index)
  17. {
  18.     if(!list()->getCount())
  19.         return;
  20.  
  21.     list()->atFree(index);
  22.     setRange(list()->getCount());
  23.     drawView();
  24. }
  25.  
  26.  
  27. ccIndex ListBox::getCount()
  28. {
  29.     return list()->getCount();
  30. }
  31.  
  32.  
  33. void ListBox::insert(void *item)
  34. {
  35.     list()->insert(item);
  36.     setRange(list()->getCount());
  37. }
  38.  
  39.  
  40. void ListBox::insertDraw(void *item)
  41. {
  42.     insert(item);
  43.     drawView();
  44. }
  45.  
  46.  
  47. void ListBox::removeAll()
  48. {
  49.     list()->removeAll();
  50.     setRange(list()->getCount());
  51.     drawView();
  52. }
  53.  
  54.  
  55. void ListBox::handleEvent(TEvent& event)
  56. {
  57.     if((event.what==evMouseDown) && (event.mouse.doubleClick))
  58.     {
  59.         message(owner,evBroadcast,cmListItemSelected,this);
  60.         clearEvent(event);
  61.     }
  62.  
  63.     TListBox::handleEvent(event);
  64. }
  65.  
  66.  
  67.