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

scrnobj.h

Go to the documentation of this file.
00001 /*************************************************************************
00002 *   FILE: scrnobj.h
00003 * AUTHOR: CAL
00004 * DATE: 25 April 1993
00005 * PURPOSE:
00006 *   A ScreenObject is any interactive object which can be drawn on
00007 *   the screen, like a window or a button.  It generates and
00008 *   responds to messages.  ScrnObj is a virtual base class;
00009 *   it exists only so that various types of windows and buttons
00010 *   can inherit from it.
00011 **************************************************************************/
00012 
00013 #ifndef _SCRNOBJ_H
00014 #define _SCRNOBJ_H
00015 
00016 #include <stddef.h>
00017 #include "messages.h"
00018 
00019 class Display;        // foreward declaration
00020 
00021 
00022 class ScrnObj {
00023   friend class ScrnObjList;
00024 protected:
00025   ScrnObj* Next;
00026   Display *Disp;      // Display upon which the object exists
00027   int X, Y;           // Top-Left of object (relative to Disp)
00028   bool Drawn;
00029 public:
00030   ScrnObj ()  { Disp = NULL; Next = NULL; }
00031   virtual ~ScrnObj () { delete Next; }
00032   virtual int GetXDim (void) { return 0; }
00033   virtual int GetYDim (void) { return 0; }
00034   virtual void Init (Display *d, int x, int y)
00035     { Disp = d;  X = x;  Y = y; }
00036   virtual void Draw () = 0;
00037   virtual void Erase () {}
00038   virtual Message Dispatch (Message&)  { return NullMsg; }
00039 };
00040 
00041 
00042 class ScrnObjList {
00043   ScrnObj *First;
00044   ScrnObj *Last;
00045   ScrnObj *Current;
00046 public:
00047   ScrnObjList () { First = Last = Current = NULL; }
00048   ~ScrnObjList () { Nuke (); }
00049   void Insert (ScrnObj *a);
00050   void Append (ScrnObj *a);
00051   void Remove (ScrnObj *a);
00052   ScrnObj* GetCurrent (void) { return Current; }
00053   bool Reset (void);
00054   bool Next (void);
00055   void Nuke (void);
00056 };
00057 
00058 
00059 
00060 #endif

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