You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.0 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Turbo Vision - Version 2.0
  3. *
  4. * Copyright (c) 1994 by Borland International
  5. * All Rights Reserved.
  6. *
  7. Modified by Robert H�hne to be used for RHIDE.
  8. Modified by Salvador E. Tropea to add functionality.
  9. *
  10. *
  11. */
  12. #if defined( Uses_TListBox ) && !defined( __TListBox )
  13. #define __TListBox
  14. class TRect;
  15. class TScrollBar;
  16. class TCollection;
  17. struct TListBoxRec
  18. {
  19. TCollection *items;
  20. ccIndex selection;
  21. };
  22. class TListBox : public TListViewer
  23. {
  24. public:
  25. TListBox( const TRect& bounds, ushort aNumCols, TScrollBar *aScrollBar );
  26. TListBox( const TRect& bounds, ushort aNumCols, TScrollBar *aHScrollBar,
  27. TScrollBar *aVScrollBar );
  28. ~TListBox();
  29. virtual uint32 dataSize();
  30. virtual void getData( void *rec );
  31. virtual void getText( char *dest, ccIndex item, short maxLen );
  32. virtual void newList( TCollection *aList );
  33. virtual void setData( void *rec );
  34. // SET: You not always want to destroy the items.
  35. virtual void newList( TCollection *aList, Boolean destroyItems );
  36. virtual void setData( void *rec, Boolean destroyItems );
  37. TCollection *list();
  38. protected:
  39. TCollection *items;
  40. private:
  41. #if !defined( NO_STREAM )
  42. virtual const char *streamableName() const
  43. { return name; }
  44. protected:
  45. TListBox( StreamableInit );
  46. virtual void write( opstream& );
  47. virtual void *read( ipstream& );
  48. public:
  49. static const char * const name;
  50. static TStreamable *build();
  51. #endif // NO_STREAM
  52. };
  53. #if !defined( NO_STREAM )
  54. inline ipstream& operator >> ( ipstream& is, TListBox& cl )
  55. { return is >> (TStreamable&)cl; }
  56. inline ipstream& operator >> ( ipstream& is, TListBox*& cl )
  57. { return is >> (void *&)cl; }
  58. inline opstream& operator << ( opstream& os, TListBox& cl )
  59. { return os << (TStreamable&)cl; }
  60. inline opstream& operator << ( opstream& os, TListBox* cl )
  61. { return os << (TStreamable *)cl; }
  62. #endif // NO_STREAM
  63. inline TCollection *TListBox::list()
  64. {
  65. return items;
  66. }
  67. #endif // Uses_TListBox