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

display.c

Go to the documentation of this file.
00001 /*************************************************************************
00002 *   FILE: display.c
00003 * AUTHOR: CAL
00004 * DATE: 25 April 1993
00005 * PURPOSE:
00006 *   A display is a viewport which can contain "screen objects",
00007 *   such as windows and buttons.
00008 **************************************************************************/
00009 
00010 #include "display.h"
00011 
00012 
00013 void Display::Add (ScrnObj *a, int x, int y)
00014 {
00015   list.Append (a);
00016   a->Init (this, x, y);
00017 }
00018 
00019 
00020 void Display::Draw (void)
00021 {
00022   if (list.Reset ())
00023     do {
00024       list.GetCurrent()->Draw ();
00025     } while (list.Next ());
00026 }
00027 
00028 void Display::Erase (void)
00029 {
00030   if (list.Reset ())
00031     do {
00032       list.GetCurrent()->Erase ();
00033     } while (list.Next ());
00034 }
00035 
00036 
00037 Message Display::Dispatch (Message& msg)
00038 {
00039   if (! list.Reset ())        // if list is empty
00040     return NullMsg;         //   return
00041   else
00042   {
00043 
00044     Message m = msg;
00045     switch (msg.origin)
00046     {
00047       case MouseMsg:      // Do d1,d2 represent coordinates?
00048   m.d1 = TransX (msg.d1);   // Translate them.
00049   m.d2 = TransY (msg.d2);
00050 //  if (!InBounds (m.d1, m.d2))
00051 //    return NullMsg;
00052   break;
00053     }
00054 
00055     Message ret;
00056     do {
00057       ret = list.GetCurrent()->Dispatch (m);  // pass to next scrnobj
00058     } while ((ret == NullMsg) && list.Next ());
00059 
00060     return ret;
00061   }
00062 }
00063 
00064 

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