home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 9.ddi / TVSRC.ZIP / MENU.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.4 KB  |  88 lines

  1. /*------------------------------------------------------------*/
  2. /* filename -       menu.cpp                                  */
  3. /*                                                            */
  4. /* function(s)                                                */
  5. /*                  TSubMenu member functions                 */
  6. /*------------------------------------------------------------*/
  7.  
  8. /*------------------------------------------------------------*/
  9. /*                                                            */
  10. /*    Turbo Vision -  Version 1.0                             */
  11. /*                                                            */
  12. /*                                                            */
  13. /*    Copyright (c) 1991 by Borland International             */
  14. /*    All Rights Reserved.                                    */
  15. /*                                                            */
  16. /*------------------------------------------------------------*/
  17.  
  18. #define Uses_TKeys
  19. #define Uses_TSubMenu
  20. #define Uses_TStatusDef
  21. #define Uses_TStatusItem
  22. #define Uses_TMenu
  23. #include <tv.h>
  24.  
  25. #if !defined( __STRING_H )
  26. #include <String.h>
  27. #endif  // __STRING_H
  28.  
  29. TSubMenu::TSubMenu( const char *nm, ushort key, ushort helpCtx ) : 
  30.     TMenuItem( nm, 0, key, helpCtx )
  31. {
  32. }
  33.  
  34. TSubMenu& operator + ( TSubMenu& s, TMenuItem& i )
  35. {
  36.     TSubMenu *sub = &s;
  37.     while( sub->next != 0 )
  38.         sub = (TSubMenu *)(sub->next);
  39.  
  40.     if( sub->subMenu == 0 )
  41.         sub->subMenu = new TMenu( i );
  42.     else
  43.         {
  44.         TMenuItem *cur = sub->subMenu->items;
  45.         while( cur->next != 0 )
  46.             cur = cur->next;
  47.         cur->next = &i;
  48.         }
  49.     return s;
  50. }
  51.  
  52. TSubMenu& operator + ( TSubMenu& s1, TSubMenu& s2 )
  53. {
  54.     TMenuItem *cur = &s1;
  55.     while( cur->next != 0 )
  56.         cur = cur->next;
  57.     cur->next = &s2;
  58.     return s1;
  59. }
  60.  
  61. TStatusDef& operator + ( TStatusDef& s1, TStatusItem& s2 )
  62. {
  63.     TStatusDef *def = &s1;
  64.     while( def->next != 0 )
  65.         def = def->next;
  66.     if( def->items == 0 )
  67.         def->items = &s2;
  68.     else
  69.         {
  70.         TStatusItem *cur = def->items;
  71.         while( cur->next != 0 )
  72.             cur = cur->next;
  73.         cur->next = &s2;
  74.         }
  75.     return s1;
  76. }
  77.  
  78. TStatusDef& operator + ( TStatusDef& s1, TStatusDef& s2 )
  79. {
  80.     TStatusDef *cur = &s1;
  81.     while( cur->next != 0 )
  82.         cur = cur->next;
  83.     cur->next = &s2;
  84.     return s1;
  85. }
  86.  
  87.  
  88.