Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

scrnobj.c

Go to the documentation of this file.
00001 /*************************************************************************
00002 *   FILE: scrnobj.c
00003 * AUTHOR: CAL
00004 * DATE: 25 April 1993
00005 * PURPOSE:
00006 *   Contains functions which handle a list of ScreenObjects.
00007 *   A ScreenObject is any interactive object which can be drawn on
00008 *   the screen, like a window or a button.
00009 **************************************************************************/
00010 
00011 #include "scrnobj.h"
00012 
00013 
00014 void ScrnObjList::Insert (ScrnObj *a)
00015 {
00016   a->Next = First;
00017   First = a;
00018   if (!Current)
00019     Current = First;
00020   if (!Last)
00021     Last = First;
00022 }
00023 
00024 
00025 void ScrnObjList::Append (ScrnObj *a)
00026 {
00027   if (Last)
00028   {
00029     Last->Next = a;
00030     Last = a;
00031   }
00032   else
00033     Insert (a);
00034 }
00035 
00036 
00037 void ScrnObjList::Remove (ScrnObj *a)
00038 {
00039   if (First == a)
00040   {
00041     ScrnObj* tmp = First;
00042     First = First->Next;
00043     delete tmp;
00044   }
00045   else
00046   {
00047     ScrnObj* prev = First;
00048     ScrnObj* curr = First->Next;
00049     while (curr)
00050     {
00051       if (curr == a)
00052       {
00053   prev->Next = curr->Next;
00054   if (curr == Last)
00055     Last = prev;
00056   delete curr;
00057   curr = NULL;
00058       }
00059       else
00060       {
00061   prev = curr;
00062   curr = curr->Next;
00063       }
00064     }
00065   }
00066   Current = First;
00067 }
00068 
00069 
00070 bool ScrnObjList::Reset (void)
00071 {
00072   Current = First;
00073   return (bool) (Current);
00074 }
00075 
00076 
00077 bool ScrnObjList::Next (void)
00078 {
00079   if (Current)
00080     Current = Current->Next;
00081   return (bool) (Current);
00082 }
00083 
00084 
00085 void ScrnObjList::Nuke (void)
00086 {
00087   delete First;
00088   First = Current = Last = NULL;
00089 }
00090 
00091 
00092 

Generated on Sun Jul 6 23:07:16 2003 for Scotland Yard by doxygen1.2.15