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

Group Class Reference

#include <group.h>

Inheritance diagram for Group:

ScrnObj List of all members.

Public Methods

 Group ()
 Group (int, int)
 ~Group ()
void Add (CheckBox *, int, int)
Message Dispatch (Message &)
void Init (Display *d, int x, int y)
void Draw ()
void Erase ()
void DisableBox (int)
void EnableBox (int)

Protected Methods

void off_last ()
int id_to_int (int)

Protected Attributes

int NumObj
int CurrentObj
int CurrentId
int IdNum
int Default

Private Methods

void disable_proc ()
void enable_proc ()

Private Attributes

CheckBox ** Boxes

Constructor & Destructor Documentation

Group::Group   [inline]
 

Definition at line 27 of file group.h.

00028     {};

Group::Group int   ,
int   
[inline]
 

Definition at line 49 of file group.h.

References Boxes, CurrentId, CurrentObj, Default, IdNum, and NumObj.

00050   {NumObj=numobj; CurrentObj=0; Default=0; CurrentId=0; IdNum=idnum;
00051    Boxes = (CheckBox **) calloc (NumObj, sizeof (CheckBox*));}

Group::~Group  
 

Definition at line 15 of file group.c.

References Boxes, and CurrentObj.

00016 {
00017   for(int count=0; count<CurrentObj; count++)
00018     delete Boxes[count];
00019 
00020   free (Boxes);
00021 }


Member Function Documentation

void Group::Add CheckBox  ,
int   ,
int   
 

Definition at line 23 of file group.c.

References Boxes, CurrentObj, ScrnObj::Disp, CheckBox::Init(), and NumObj.

Referenced by UserInterface::TransPop(), and UserInterface::UFWOOM().

00024 {
00025   if(CurrentObj!=NumObj) {
00026     Boxes[CurrentObj] = newbox;
00027     newbox->Init(Disp, x, y);
00028 
00029     CurrentObj++;
00030   }
00031 }

void Group::disable_proc   [private]
 

Definition at line 124 of file group.c.

References Boxes, CheckBox::BoxId(), CurrentObj, Disable, ScrnObj::Disp, CheckBox::Dispatch(), Viewport::Done(), Viewport::FastDraw(), and GodMsg.

Referenced by Dispatch().

00125 {
00126   int idnum;
00127 
00128   Disp->FastDraw();
00129   for(int count=0; count<CurrentObj; count++) {
00130     idnum=Boxes[count]->BoxId();
00131     Boxes[count]->Dispatch (Message (GodMsg, Disable, idnum));
00132   }
00133 
00134   Disp->Done();
00135 }

void Group::DisableBox int   
 

Definition at line 82 of file group.c.

References Boxes, CheckBox::ChangeStatus(), CurrentId, CurrentObj, Default, Disable, CheckBox::Dispatch(), GodMsg, id_to_int(), Off, and On.

Referenced by UserInterface::TransPop().

00083 {
00084   int iteration;
00085   iteration=id_to_int(idnum);
00086 
00087   Boxes[iteration]->Dispatch (Message (GodMsg, Disable, idnum));
00088 
00089   if(Default==CurrentObj)
00090     Default=-1;
00091 
00092   if(Default==iteration) {
00093     Default=iteration+1;
00094     CurrentId=iteration+1;
00095     Boxes[iteration]->ChangeStatus(Off);
00096     Boxes[iteration]->Dispatch (Message (GodMsg, Disable, idnum));
00097     Boxes[Default]->ChangeStatus(On);
00098   }
00099 }

Message Group::Dispatch Message   [virtual]
 

Reimplemented from ScrnObj.

Definition at line 33 of file group.c.

References Boxes, Message::code, CurrentId, CurrentObj, Message::d1, Message::d2, Disable, disable_proc(), CheckBox::Dispatch(), Enable, enable_proc(), GodMsg, IdNum, Off, off_last(), On, Message::origin, and Status.

00034 {
00035   int count=0;
00036   Message msg2;
00037 
00038   do{
00039     if((msg.origin==GodMsg)&&(msg.code==Disable)&&(msg.d1==IdNum))
00040       disable_proc();
00041     if((msg.origin==GodMsg)&&(msg.code==Enable)&&(msg.d1==IdNum))
00042       enable_proc();
00043 
00044     msg2=Boxes[count]->Dispatch(msg);
00045     if (msg2.code==Status) {
00046       switch(msg2.d2) {
00047         case On:
00048           off_last();
00049           break;
00050         case Off:
00051           if (CurrentId==count)
00052             Boxes[CurrentId]->ChangeStatus(On);
00053           break;
00054       }
00055       CurrentId=count;
00056     }
00057     count++;
00058   }while((count<CurrentObj)&&(msg2!=Acknowledged)&&(msg2.code!=Status));
00059 
00060   return msg2;
00061 }

void Group::Draw   [virtual]
 

Implements ScrnObj.

Definition at line 63 of file group.c.

References Boxes, CurrentObj, Default, ScrnObj::Disp, Viewport::Done(), CheckBox::Draw(), Viewport::FastDraw(), and On.

00064 {
00065   Disp->FastDraw();
00066   for (int count=0; count<CurrentObj; count++)
00067     Boxes[count]->Draw();
00068 
00069   // Set Default button On...
00070   Boxes[Default]->ChangeStatus(On);
00071   Disp->Done();
00072 }

void Group::enable_proc   [private]
 

Definition at line 137 of file group.c.

References Boxes, CheckBox::BoxId(), CurrentObj, Default, ScrnObj::Disp, CheckBox::Dispatch(), Viewport::Done(), Enable, Viewport::FastDraw(), GodMsg, and On.

Referenced by Dispatch().

00138 {
00139   int idnum;
00140 
00141   Disp->FastDraw();
00142   for(int count=0; count<CurrentObj; count++) {
00143     idnum=Boxes[count]->BoxId();
00144     Boxes[count]->Dispatch (Message (GodMsg, Enable, idnum));
00145   }
00146 
00147   // Set Default button On...
00148   Boxes[Default]->ChangeStatus(On);
00149 
00150   Disp->Done();
00151 }

void Group::EnableBox int   
 

Definition at line 101 of file group.c.

References Boxes, CurrentId, Default, CheckBox::Dispatch(), Enable, GodMsg, and id_to_int().

00102 {
00103   int iteration;
00104   iteration=id_to_int(idnum);
00105 
00106   Boxes[iteration]->Dispatch (Message (GodMsg, Enable, idnum));
00107 
00108   if(iteration==0) {
00109     Default=0;
00110     CurrentId=0;
00111   }
00112 }

void Group::Erase   [virtual]
 

Reimplemented from ScrnObj.

Definition at line 74 of file group.c.

References Boxes, CurrentObj, ScrnObj::Disp, Viewport::Done(), CheckBox::Erase(), and Viewport::FastDraw().

00075 {
00076   Disp->FastDraw();
00077   for (int count=0; count<CurrentObj; count++)
00078     Boxes[count]->Erase();
00079   Disp->Done();
00080 }

int Group::id_to_int int    [protected]
 

Definition at line 114 of file group.c.

References Boxes, and CheckBox::BoxId().

Referenced by DisableBox(), and EnableBox().

00115 {
00116   int count=0;
00117 
00118   while (Boxes[count]->BoxId()!=idnum)
00119     count++;
00120 
00121   return count;
00122 }

void Group::Init Display   d,
int    x,
int    y
[inline, virtual]
 

Reimplemented from ScrnObj.

Definition at line 33 of file group.h.

References ScrnObj::Disp, ScrnObj::X, and ScrnObj::Y.

00034     {Disp=d, X=x, Y=y;}

void Group::off_last   [inline, protected]
 

Definition at line 53 of file group.h.

References Boxes, CurrentId, and Off.

Referenced by Dispatch().

00054   {Boxes[CurrentId]->ChangeStatus(Off);}


Member Data Documentation

CheckBox** Group::Boxes [private]
 

Definition at line 23 of file group.h.

Referenced by Add(), disable_proc(), DisableBox(), Dispatch(), Draw(), enable_proc(), EnableBox(), Erase(), Group(), id_to_int(), off_last(), and ~Group().

int Group::CurrentId [protected]
 

Definition at line 25 of file group.h.

Referenced by DisableBox(), Dispatch(), EnableBox(), Group(), and off_last().

int Group::CurrentObj [protected]
 

Definition at line 25 of file group.h.

Referenced by Add(), disable_proc(), DisableBox(), Dispatch(), Draw(), enable_proc(), Erase(), Group(), and ~Group().

int Group::Default [protected]
 

Definition at line 25 of file group.h.

Referenced by DisableBox(), Draw(), enable_proc(), EnableBox(), and Group().

int Group::IdNum [protected]
 

Definition at line 25 of file group.h.

Referenced by Dispatch(), and Group().

int Group::NumObj [protected]
 

Definition at line 25 of file group.h.

Referenced by Add(), and Group().


The documentation for this class was generated from the following files:
Generated on Sun Jul 6 23:07:17 2003 for Scotland Yard by doxygen1.2.15