home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_07_03 / v7n3052b.txt < prev    next >
Text File  |  1989-01-01  |  802b  |  23 lines

  1. class   ScreenList  {   // keep a list of ScreenObjs
  2. struct  Window  {
  3.     ScreenObj * head;       // a private structure
  4.     Window * next; };       // to make a linked list
  5.     Window * head;              // start of list
  6.     Window * current;       // so we can step through list
  7. public:
  8.     void add(ScreenObj &);      // add to the list
  9.     void remove(ScreenObj &);   // remove a ScreenObj
  10.     void reset() { current = head; } // go to beginning
  11.     ScreenObj & GetNext();
  12.                         // return the next one or zero at end
  13. };
  14.  
  15. main()  {
  16.     Message M; Reader R; Dialog D;
  17.     Screenlist  List;
  18.     List.add(M); List.add(R); List.add(D);
  19.     List.reset();
  20.     while( (ScreenObj & Win = List.GetNext()) != 0)
  21.         Win.ReDraw();       // ReDraw the whole list
  22. }
  23.