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

Nodes Class Reference

#include <nodes.h>

Inheritance diagram for Nodes:

CheckBox ScrnObj List of all members.

Public Methods

 Nodes (int, BOOLEAN)
 Nodes (int, int, BOOLEAN)
void Init (Display *, int, int)
 ~Nodes ()
Message Dispatch (Message &)
void Draw ()
void NewFillColor (int)
void EnableNode (int)
void DisableNode ()
void ChangeStatus (BOOLEAN)
void ChangeStatus (BOOLEAN, int)

Private Methods

void set_constants (int, int, BOOLEAN)
void image_size ()
void image_size (int, int)
void prep_screen (int)
void fill_box ()
void empty_box (int)
void animate_box ()
void animate_frame ()
Message key_msg (Message &)
Message command_msg (Message &)
Message mouse_msg (Message &)
void disable_box ()
void enable_box ()

Private Attributes

int NCOLORFILL
int NBOXSIZE

Constructor & Destructor Documentation

Nodes::Nodes int   ,
BOOLEAN   
[inline]
 

Definition at line 72 of file nodes.h.

References image_size(), and set_constants().

00073   {set_constants(Id, BLUE, state); image_size();}

Nodes::Nodes int   ,
int   ,
BOOLEAN   
[inline]
 

Definition at line 69 of file nodes.h.

References image_size(), and set_constants().

00070   {set_constants(Id, colorfill, state); image_size();}

Nodes::~Nodes   [inline]
 

Definition at line 44 of file nodes.h.

References CheckBox::Erase().

00045     {if (Drawn) Erase();}


Member Function Documentation

void Nodes::animate_box   [inline, private]
 

Reimplemented from CheckBox.

Definition at line 93 of file nodes.h.

References CheckBox::Able, empty_box(), fill_box(), NBOXCOLOR, and NOFFCOLOR.

Referenced by ChangeStatus(), command_msg(), and mouse_msg().

00094   {if (BStatus) fill_box(); else if(Able) empty_box(NBOXCOLOR);
00095    else if(!Able) empty_box(NOFFCOLOR);}

void Nodes::animate_frame   [private]
 

Reimplemented from CheckBox.

Definition at line 125 of file nodes.c.

References CCIRCLE, Viewport::Circle(), ScrnObj::Disp, Viewport::Done(), Viewport::FastDraw(), NBOXCOLOR, NBOXSIZE, NFRAME, Viewport::SetColor(), Viewport::SetLineStyle(), STOPRAD, ScrnObj::X, and ScrnObj::Y.

Referenced by mouse_msg().

00126 {
00127   Disp->FastDraw();
00128 
00129   if (Activated)
00130     Disp->SetColor(BLACK);
00131   else
00132     Disp->SetColor(NBOXCOLOR);
00133 
00134   Disp->SetLineStyle(SOLID_LINE, 0, NFRAME);
00135 
00136   int radius = (int)(CCIRCLE/2);
00137   Disp->Circle(X+NBOXSIZE/2, Y+NBOXSIZE/2+STOPRAD, radius-1);
00138 
00139   Disp->Done();
00140 }

void Nodes::ChangeStatus BOOLEAN   ,
int   
[inline]
 

Definition at line 84 of file nodes.h.

References animate_box(), CheckBox::BStatus, and NCOLORFILL.

00085   {BStatus=bswitch; NCOLORFILL=color; animate_box();}

void Nodes::ChangeStatus BOOLEAN    [inline]
 

Reimplemented from CheckBox.

Definition at line 87 of file nodes.h.

References animate_box(), and CheckBox::BStatus.

Referenced by MapWindow::HilightNode(), and MapWindow::UnHilightNode().

00088   {BStatus=bswitch; animate_box();}

Message Nodes::command_msg Message   [private]
 

Reimplemented from CheckBox.

Definition at line 187 of file nodes.c.

References animate_box(), ButtonMsg, Message::code, Message::d1, Disable, disable_box(), Enable, enable_box(), CheckBox::IdNum, RequestStatus, CheckBox::status(), and Status.

Referenced by Dispatch().

00188 {
00189   if(msg.d1 != IdNum)
00190     return NullMsg;
00191 
00192   switch (msg.code) {
00193     case Disable:
00194       animate_box();
00195       disable_box();
00196       return Acknowledged;
00197     case Enable:
00198       enable_box();
00199       return Acknowledged;
00200     case RequestStatus:
00201       return Message(ButtonMsg, Status, IdNum, (int)status());
00202   }
00203   return NullMsg;
00204 }

void Nodes::disable_box   [inline, private]
 

Reimplemented from CheckBox.

Definition at line 97 of file nodes.h.

References CheckBox::Able, CheckBox::BStatus, empty_box(), fill_box(), NOFFCOLOR, and Off.

Referenced by command_msg(), and DisableNode().

00098   {Able=Off; BOOLEAN temp=BStatus; empty_box(NOFFCOLOR);
00099    BStatus=temp; if(BStatus) fill_box();}

void Nodes::DisableNode   [inline]
 

Definition at line 78 of file nodes.h.

References disable_box().

00079   {disable_box();}

Message Nodes::Dispatch Message   [virtual]
 

Reimplemented from CheckBox.

Definition at line 142 of file nodes.c.

References command_msg(), GodMsg, key_msg(), KeyMsg, mouse_msg(), MouseMsg, and Message::origin.

00143 {
00144   switch(msg.origin) {
00145     case MouseMsg:
00146       return mouse_msg(msg);
00147     case KeyMsg:
00148       return key_msg(msg);
00149     case GodMsg:
00150       return command_msg(msg);
00151   }
00152   return msg;
00153 }

void Nodes::Draw   [virtual]
 

Reimplemented from CheckBox.

Definition at line 53 of file nodes.c.

References CCIRCLE, ScrnObj::Disp, Viewport::Done(), ScrnObj::Drawn, Viewport::FastDraw(), fill_box(), Viewport::FillEllipse(), CheckBox::IdNum, NBOXCOLOR, NBOXSIZE, NOFFCOLOR, Viewport::SetColor(), Viewport::SetFillStyle(), STOPRAD, ScrnObj::X, ScrnObj::Y, and Yes.

00054 {
00055   Disp->FastDraw();
00056 
00057   Disp->SetColor(BLACK);
00058 
00059   if(theMap.taxi(IdNum))  // Taxi Stop
00060     Disp->SetFillStyle(SOLID_FILL, YELLOW);
00061   else
00062     Disp->SetFillStyle(SOLID_FILL, GREEN);
00063   Disp->FillEllipse(X+NBOXSIZE/2, Y+NBOXSIZE/2-CCIRCLE/2+STOPRAD, STOPRAD, STOPRAD);
00064 
00065   if(theMap.bus(IdNum)) // Bus Stop
00066     Disp->SetFillStyle(SOLID_FILL, GREEN);
00067   else
00068     Disp->SetFillStyle(SOLID_FILL, YELLOW);
00069   Disp->FillEllipse(X+NBOXSIZE/2+CCIRCLE/2, Y+NBOXSIZE/2+2*STOPRAD-2, STOPRAD, STOPRAD);
00070 
00071   if(theMap.subway(IdNum))  // Subway Stop
00072     Disp->SetFillStyle(SOLID_FILL, RED);
00073   else if (theMap.taxi (IdNum))
00074     Disp->SetFillStyle(SOLID_FILL, YELLOW);
00075   else
00076     Disp->SetFillStyle(SOLID_FILL, GREEN);
00077   Disp->FillEllipse(X+NBOXSIZE/2-CCIRCLE/2, Y+NBOXSIZE/2+2*STOPRAD-2, STOPRAD, STOPRAD);
00078 
00079   if(Able)
00080     Disp->SetFillStyle(SOLID_FILL, NBOXCOLOR);
00081   else
00082     Disp->SetFillStyle(SOLID_FILL, NOFFCOLOR);
00083 
00084   int radius = (int)(CCIRCLE/2);
00085   Disp->SetColor(BLACK);
00086   Disp->FillEllipse(X+NBOXSIZE/2, Y+NBOXSIZE/2+STOPRAD, radius, radius);
00087 
00088   if(BStatus)
00089     fill_box();
00090 
00091   Disp->Done();
00092   Drawn=Yes;
00093 }

void Nodes::empty_box int    [private]
 

Reimplemented from CheckBox.

Definition at line 95 of file nodes.c.

References CheckBox::BStatus, CCIRCLE, ScrnObj::Disp, Viewport::Done(), Viewport::FastDraw(), Viewport::FillEllipse(), NBOXSIZE, Off, Viewport::SetColor(), Viewport::SetFillStyle(), STOPRAD, ScrnObj::X, and ScrnObj::Y.

Referenced by animate_box(), disable_box(), and enable_box().

00096 {
00097   Disp->FastDraw();
00098 
00099   Disp->SetFillStyle(SOLID_FILL, color);
00100   int radius = (int)(CCIRCLE/2);
00101   Disp->SetColor(BLACK);
00102   Disp->FillEllipse(X+NBOXSIZE/2, Y+NBOXSIZE/2+STOPRAD, radius, radius);
00103 
00104   Disp->Done();
00105 
00106   BStatus = Off;
00107 }

void Nodes::enable_box   [inline, private]
 

Reimplemented from CheckBox.

Definition at line 101 of file nodes.h.

References CheckBox::Able, CheckBox::BStatus, empty_box(), fill_box(), NBOXCOLOR, and On.

Referenced by command_msg(), and EnableNode().

00102   {Able=On; BOOLEAN temp=BStatus; empty_box(NBOXCOLOR);
00103    BStatus=temp; if(BStatus) fill_box();}

void Nodes::EnableNode int    [inline]
 

Definition at line 81 of file nodes.h.

References CheckBox::BStatus, enable_box(), and NCOLORFILL.

00082   {if(!BStatus) NCOLORFILL=color; enable_box();}

void Nodes::fill_box   [private]
 

Reimplemented from CheckBox.

Definition at line 109 of file nodes.c.

References CheckBox::BStatus, CCIRCLE, ScrnObj::Disp, Viewport::Done(), Viewport::FastDraw(), Viewport::FillEllipse(), NBOXSIZE, NCOLORFILL, NFILLSIZE, On, Viewport::SetColor(), Viewport::SetFillStyle(), STOPRAD, ScrnObj::X, and ScrnObj::Y.

Referenced by animate_box(), disable_box(), Draw(), and enable_box().

00110 {
00111   Disp->FastDraw();
00112 
00113   Disp->SetFillStyle(SOLID_FILL, NCOLORFILL);
00114   Disp->SetColor(NCOLORFILL);
00115 
00116   int radius = (int)(CCIRCLE/2);
00117   Disp->SetColor(BLACK);
00118   Disp->FillEllipse(X+NBOXSIZE/2, Y+NBOXSIZE/2+STOPRAD, radius-NFILLSIZE, radius-NFILLSIZE);
00119 
00120   Disp->Done();
00121 
00122   BStatus = On;
00123 }

void Nodes::image_size int   ,
int   
[private]
 

Reimplemented from CheckBox.

void Nodes::image_size   [inline, private]
 

Reimplemented from CheckBox.

Definition at line 90 of file nodes.h.

References NBOXSIZE, ScrnObj::X, CheckBox::X2, ScrnObj::Y, and CheckBox::Y2.

Referenced by Nodes().

00091   {X2 = X+NBOXSIZE; Y2 = Y+NBOXSIZE;}

void Nodes::Init Display  ,
int   ,
int   
[virtual]
 

Reimplemented from CheckBox.

Definition at line 42 of file nodes.c.

References CheckBox::BkColor, CCIRCLE, ScrnObj::Disp, Viewport::GetBkColor(), NBOXSIZE, STOPRAD, ScrnObj::X, CheckBox::X2, ScrnObj::Y, and CheckBox::Y2.

00043 {
00044   NBOXSIZE=CCIRCLE+2*STOPRAD;
00045 
00046   X = x-NBOXSIZE/2; X2=X+NBOXSIZE;
00047   Y = y-NBOXSIZE/2; Y2=Y+NBOXSIZE;
00048 
00049   Disp = d;
00050   BkColor=Disp->GetBkColor();
00051 }

Message Nodes::key_msg Message   [private]
 

Reimplemented from CheckBox.

Definition at line 206 of file nodes.c.

Referenced by Dispatch().

00207 {
00208 /*  if (KeyBounds(msg.d1, msg.d2) && Able)
00209       return NullMsg; */
00210 
00211 return NullMsg;
00212 }

Message Nodes::mouse_msg Message   [private]
 

Reimplemented from CheckBox.

Definition at line 155 of file nodes.c.

References CheckBox::Able, CheckBox::Activated, animate_box(), animate_frame(), CheckBox::BStatus, CheckBox::ButtonBounds(), ButtonMsg, Message::code, Message::d1, Message::d2, False, CheckBox::IdNum, LMouseDown, LMouseStillDown, LMouseUp, Off, On, Status, and True.

Referenced by Dispatch().

00156 {
00157   if (ButtonBounds(msg.d1, msg.d2) && Able) {
00158     switch(msg.code) {
00159       case LMouseDown:
00160         Activated = True;
00161         animate_frame();
00162         return Acknowledged;
00163       case LMouseStillDown:
00164         if(!Activated) {
00165           Activated = True;
00166           animate_frame();
00167         }
00168         return NullMsg;
00169       case LMouseUp:
00170         Activated = False;
00171         BStatus = BStatus? Off : On;
00172         animate_frame();
00173         animate_box();
00174         return Message(ButtonMsg, Status, IdNum, BStatus);
00175       default:
00176         return NullMsg;
00177     }
00178   }
00179   if(msg.code==LMouseStillDown && Activated && Able) {
00180     Activated = False;
00181     animate_frame();
00182     animate_box();
00183   }
00184   return NullMsg;
00185 }

void Nodes::NewFillColor int    [inline]
 

Definition at line 75 of file nodes.h.

References NCOLORFILL.

00076   {NCOLORFILL=newcolor;}

void Nodes::prep_screen int    [private]
 

Reimplemented from CheckBox.

void Nodes::set_constants int   ,
int   ,
BOOLEAN   
[private]
 

Definition at line 20 of file nodes.c.

References CheckBox::Able, CheckBox::Activated, CheckBox::BStatus, ScrnObj::Drawn, False, CheckBox::IdNum, NCOLORFILL, No, Off, ScrnObj::X, and ScrnObj::Y.

Referenced by Nodes().

00021 {
00022   /*****************************************************************
00023 
00024     Flag states of Nodes...
00025 
00026       Activated - User input detected...
00027       BStatus - Whether the option is selected or not...
00028       Able    - Allow/disallow interaction with user...
00029 
00030    *****************************************************************/
00031 
00032   Activated   = False;
00033   BStatus   = Off;  // For now, may be a user-defined field later.
00034   Able      = state;
00035 
00036   NCOLORFILL=colorfill;
00037   IdNum = Id;
00038   Drawn = No;
00039   X=0; Y=0;
00040 }


Member Data Documentation

int Nodes::NBOXSIZE [private]
 

Definition at line 39 of file nodes.h.

Referenced by animate_frame(), Draw(), empty_box(), fill_box(), image_size(), and Init().

int Nodes::NCOLORFILL [private]
 

Definition at line 39 of file nodes.h.

Referenced by ChangeStatus(), EnableNode(), fill_box(), NewFillColor(), and set_constants().


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