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

KeyWindow Class Reference

#include <keywin.h>

Inheritance diagram for KeyWindow:

Window ScrnObj List of all members.

Public Methods

 KeyWindow ()
void Init (Display *d, int x, int y)
void Draw ()
Message Dispatch (Message &)

Private Attributes

CheckBoxc [MaxPlayers]

Constructor & Destructor Documentation

KeyWindow::KeyWindow  
 

Definition at line 21 of file keywin.c.

References Window::BkColor, Window::BorderColor, Window::ClientD, Window::CliX1, Window::CliX2, Window::CliY1, Window::CliY2, ScrnObj::Drawn, False, KeyXDim, KeyYDim, Window::Title, Window::TitleColor, Window::TitleD, Window::TX1, Window::TX2, Window::TY1, Window::TY2, Window::XDim, and Window::YDim.

00022 {
00023   XDim = KeyXDim;  YDim = KeyYDim;
00024   CliX1 = CliY1 = CliX2 = CliY2 = 0;
00025   TX1 = TY1 = TX2 = TY2 = 0;
00026   BorderColor = RED;
00027   BkColor = LIGHTGRAY;
00028   TitleColor = WHITE;
00029   Title = new char [4];
00030   assert (Title != 0);
00031   strcpy (Title, "Legend");
00032   ClientD = TitleD = NULL;
00033   Drawn = False;
00034 }


Member Function Documentation

Message KeyWindow::Dispatch Message   [inline, virtual]
 

Reimplemented from Window.

Definition at line 28 of file keywin.h.

00028 { return NullMsg; }

void KeyWindow::Draw   [virtual]
 

Reimplemented from Window.

Definition at line 76 of file keywin.c.

References c, Viewport::Clear(), Window::ClientD, ScrnObj::Disp, Viewport::Done(), Display::Draw(), Window::DrawBorder(), ScrnObj::Drawn, Window::DrawTitle(), Viewport::FastDraw(), MaxPlayers, Off, On, Window::PrepScreen(), and True.

00077 {
00078   if (!Drawn)
00079   {
00080     assert (Disp != NULL);
00081     Disp->FastDraw ();
00082     PrepScreen ();
00083     DrawBorder ();
00084     if (TitleD)
00085       DrawTitle ();
00086     ClientD->Clear ();
00087     ClientD->Draw ();
00088     Disp->Done ();
00089     Drawn = True;
00090 
00091     // Turn on all of the buttons and make sure they are static
00092     for (int i = 0; i < MaxPlayers; i++) {
00093       c[i] -> ChangeStatus (On);
00094       c[i] -> SetPseudo (Off); // since there are no messages this is redundant
00095     }
00096   }
00097 }

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

Reimplemented from Window.

Definition at line 36 of file keywin.c.

References Display::Add(), Window::BkColor, Window::BorderColor, c, Window::CalcBorder(), Window::CalcTitle(), Circle, Window::ClientD, Window::CliX1, Window::CliX2, Window::CliY1, Window::CliY2, ScrnObj::Disp, MaxPlayers, PColor, Viewport::SetBkColor(), Viewport::SetColor(), Viewport::SetTextJustify(), Viewport::SetTextStyle(), Window::TitleColor, Window::TitleD, TitleFont, TitleFontSize, Window::TX1, Window::TX2, Window::TY1, Window::TY2, ScrnObj::X, and ScrnObj::Y.

00037 {
00038   Disp = d;
00039   X = x;  Y = y;
00040 
00041   char buf[3];
00042 
00043   CalcBorder ();
00044   if (Title)
00045   {
00046     CalcTitle ();
00047     TitleD = new Display (Disp, TX1, TY1, TX2, TY2);
00048     assert (TitleD != 0);
00049     TitleD->SetBkColor (BorderColor);
00050     TitleD->SetTextJustify (CENTER_TEXT, TOP_TEXT);
00051     TitleD->SetTextStyle (TitleFont, HORIZ_DIR, TitleFontSize);
00052     TitleD->SetColor (TitleColor);
00053   }
00054   ClientD = new Display (Disp, CliX1, CliY1, CliX2, CliY2);
00055   assert (ClientD != 0);
00056   ClientD->SetBkColor (BkColor);
00057   // Add stuff to the window
00058 
00059   for (int i=0; i < MaxPlayers; i++) {
00060     if (i != 0)
00061       {sprintf (buf, "%d", i);}
00062     else
00063       {sprintf (buf, "X");}
00064     c[i] = new CheckBox(buf, BLACK, PColor[i], i, Circle);
00065     assert (c[i] != NULL);
00066   }
00067     ClientD->Add (c[0], 5, 0 ); // Since we know there are a max of 6 players
00068     ClientD->Add (c[1], 5, 20); // Don't bother incorporating this into the
00069     ClientD->Add (c[2], 5, 40); // above loop
00070     ClientD->Add (c[3], 35, 0);
00071     ClientD->Add (c[4], 35, 20);
00072     ClientD->Add (c[5], 35, 40);
00073 }


Member Data Documentation

CheckBox* KeyWindow::c[MaxPlayers] [private]
 

Definition at line 22 of file keywin.h.

Referenced by Draw(), and Init().


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