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

Window Class Reference

#include <window.h>

Inheritance diagram for Window:

ScrnObj CPanelWindow InfoWindow KeyWindow MapWindow PlayerWindow PopUpWin TextWin List of all members.

Public Methods

 Window (int dx, int dy, int bc, int bkc)
 Window (int dx, int dy, int bc, int bkc, char *t, int tc)
virtual ~Window ()
int GetXDim (void)
int GetYDim (void)
DisplayClient (void)
void CalcBorder (void)
void CalcTitle (void)
virtual void PrepScreen (void)
void DrawBorder (void)
void DrawTitle (void)
virtual void Init (Display *d, int x, int y)
virtual void Draw ()
virtual void Erase ()
virtual Message Dispatch (Message &msg)

Protected Methods

 Window ()

Protected Attributes

int XDim
int YDim
int CliX1
int CliY1
int CliX2
int CliY2
int BorderColor
int BkColor
DisplayClientD
int TitleColor
int TX1
int TY1
int TX2
int TY2
char * Title
DisplayTitleD

Constructor & Destructor Documentation

Window::Window   [protected]
 

Definition at line 24 of file window.c.

References False.

00025 {       // Only to be used by derived types.
00026   XDim = YDim = 0;
00027   CliX1 = CliY1 = CliX2 = CliY2 = 0;
00028   TX1 = TY1 = TX2 = TY2 = 0;
00029   BorderColor = BkColor = 0;
00030   TitleColor = 0;
00031   Title = NULL;
00032   ClientD = TitleD = NULL;
00033   Drawn = False;
00034 }

Window::Window int    dx,
int    dy,
int    bc,
int    bkc
 

Definition at line 36 of file window.c.

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

00037 {
00038   XDim = dx;  YDim = dy;
00039   CliX1 = CliY1 = CliX2 = CliY2 = 0;
00040   TX1 = TY1 = TX2 = TY2 = 0;
00041   BorderColor = bc;
00042   BkColor = bkc;
00043   TitleColor = 0;
00044   Title = NULL;
00045   ClientD = TitleD = NULL;
00046   Drawn = False;
00047 }

Window::Window int    dx,
int    dy,
int    bc,
int    bkc,
char *    t,
int    tc
 

Definition at line 49 of file window.c.

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

00050 {
00051   XDim = dx;  YDim = dy;
00052   CliX1 = CliY1 = CliX2 = CliY2 = 0;
00053   TX1 = TY1 = TX2 = TY2 = 0;
00054   BorderColor = bc;
00055   BkColor = bkc;
00056   TitleColor = tc;
00057   Title = new char [strlen (t)+1];
00058   assert (Title != 0);
00059   strcpy (Title, t);
00060   ClientD = TitleD = NULL;
00061   Drawn = False;
00062 }

Window::~Window   [virtual]
 

Definition at line 69 of file window.c.

References ClientD, Erase(), Title, and TitleD.

00070 {
00071   Erase ();
00072   delete Title;
00073   delete ClientD;
00074   delete TitleD;
00075 }


Member Function Documentation

void Window::CalcBorder void   
 

Definition at line 82 of file window.c.

References BorderWidth, CliX1, CliX2, CliY1, CliY2, ScrnObj::X, XDim, ScrnObj::Y, and YDim.

Referenced by Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), and CPanelWindow::Init().

00083 {
00084   CliX1 += X + BorderWidth+1;
00085   CliY1 += Y + BorderWidth+1;
00086   CliX2 += X + XDim - BorderWidth - 1;
00087   CliY2 += Y + YDim - BorderWidth - 1;
00088 }

void Window::CalcTitle void   
 

Definition at line 90 of file window.c.

References CliX1, CliX2, CliY1, TitleWidth, TX1, TX2, TY1, and TY2.

Referenced by Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), and CPanelWindow::Init().

00091 {
00092   TX1 += CliX1;
00093   TY1 += CliY1;
00094   TX2 += CliX2;
00095   TY2 += TY1 + TitleWidth;
00096   CliY1 += TitleWidth + 2;
00097 }

Display& Window::Client void    [inline]
 

Definition at line 55 of file window.h.

Referenced by UserInterface::AboutButton(), PlayerWindow::Clear(), UserInterface::Intro(), MessageWin(), UserInterface::ShowSpyMoves(), UserInterface::TransPop(), and UserInterface::UFWOOM().

00055 { return (*ClientD); }

Message Window::Dispatch Message   msg [virtual]
 

Reimplemented from ScrnObj.

Reimplemented in CPanelWindow, InfoWindow, KeyWindow, and PlayerWindow.

Definition at line 190 of file window.c.

References ClientD, and Display::Dispatch().

Referenced by UserInterface::TransPop().

00191 {
00192   if (ClientD)
00193     return ClientD->Dispatch (msg); // Dispatch messages to client area
00194   else
00195     return NullMsg;
00196 }

void Window::Draw   [virtual]
 

Implements ScrnObj.

Reimplemented in InfoWindow, KeyWindow, MapWindow, PlayerWindow, and TextWin.

Definition at line 151 of file window.c.

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

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

00152 {
00153   if (!Drawn)
00154   {
00155     assert (Disp != NULL);
00156     Disp->FastDraw ();
00157     PrepScreen ();
00158     DrawBorder ();
00159     if (TitleD)
00160       DrawTitle ();
00161     ClientD->Clear ();
00162     ClientD->Draw ();
00163     Disp->Done ();
00164     Drawn = True;
00165   }
00166 }

void Window::DrawBorder void   
 

Definition at line 130 of file window.c.

References BorderColor, BorderWidth, ScrnObj::Disp, Viewport::Rectangle(), Viewport::SetColor(), Viewport::SetLineStyle(), ScrnObj::X, XDim, ScrnObj::Y, and YDim.

Referenced by Draw(), TextWin::Draw(), PlayerWindow::Draw(), MapWindow::Draw(), KeyWindow::Draw(), and InfoWindow::Draw().

00131 {
00132   Disp->SetLineStyle (SOLID_LINE, 1, 1);
00133   Disp->SetColor (BorderColor);
00134   for (int i=0; i<BorderWidth; i++)
00135     Disp->Rectangle (X+i, Y+i, X+XDim-i, Y+YDim-i);
00136   Disp->SetColor (BLACK);
00137   Disp->Rectangle (X+BorderWidth, Y+BorderWidth,
00138        X+XDim-BorderWidth, Y+YDim-BorderWidth);
00139 }

void Window::DrawTitle void   
 

Definition at line 142 of file window.c.

References Viewport::Clear(), ScrnObj::Disp, Viewport::GetMaxX(), Viewport::Line(), Viewport::OutTextXY(), Viewport::SetColor(), Title, TitleD, TX1, TX2, and TY2.

Referenced by Draw(), TextWin::Draw(), PlayerWindow::Draw(), MapWindow::Draw(), KeyWindow::Draw(), and InfoWindow::Draw().

00143 {
00144   Disp->SetColor (BLACK);
00145   Disp->Line (TX1, TY2+1, TX2, TY2+1);
00146   TitleD->Clear ();
00147   TitleD->OutTextXY (TitleD->GetMaxX()/2, 0, Title);
00148 }

void Window::Erase   [virtual]
 

Reimplemented from ScrnObj.

Reimplemented in PopUpWin.

Definition at line 173 of file window.c.

References Viewport::Bar(), ClientD, ScrnObj::Disp, ScrnObj::Drawn, Display::Erase(), False, Viewport::GetBkColor(), Viewport::SetFillStyle(), ScrnObj::X, XDim, ScrnObj::Y, and YDim.

Referenced by ~Window().

00174 {
00175   if (Drawn)
00176   {
00177     assert (Disp != NULL);
00178     ClientD->Erase ();
00179     Disp->SetFillStyle (SOLID_FILL, Disp->GetBkColor());
00180     Disp->Bar (X, Y, X+XDim, Y+YDim);
00181     Drawn = False;
00182   }
00183 }

int Window::GetXDim void    [inline, virtual]
 

Reimplemented from ScrnObj.

Definition at line 52 of file window.h.

References XDim.

Referenced by CPanelWindow::Init(), and MessageWin().

00052 { return XDim; }

int Window::GetYDim void    [inline, virtual]
 

Reimplemented from ScrnObj.

Definition at line 53 of file window.h.

References YDim.

Referenced by CPanelWindow::Init(), and MessageWin().

00053 { return YDim; }

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

Reimplemented from ScrnObj.

Reimplemented in CPanelWindow, InfoWindow, KeyWindow, and MapWindow.

Definition at line 104 of file window.c.

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

Referenced by MessageWin(), UserInterface::ShowSpyMoves(), and UserInterface::TransPop().

00105 {
00106   Disp = d;
00107   X = x;  Y = y;
00108 
00109   CalcBorder ();
00110   if (Title)
00111   {
00112     CalcTitle ();
00113     TitleD = new Display (Disp, TX1, TY1, TX2, TY2);
00114     assert (TitleD != 0);
00115     TitleD->SetBkColor (BorderColor);
00116     TitleD->SetTextJustify (CENTER_TEXT, TOP_TEXT);
00117     TitleD->SetTextStyle (TitleFont, HORIZ_DIR, TitleFontSize);
00118     TitleD->SetColor (TitleColor);
00119   }
00120   ClientD = new Display (Disp, CliX1, CliY1, CliX2, CliY2);
00121   assert (ClientD != 0);
00122   ClientD->SetBkColor (BkColor);
00123 }

virtual void Window::PrepScreen void    [inline, virtual]
 

Reimplemented in PopUpWin.

Definition at line 60 of file window.h.

Referenced by Draw(), PlayerWindow::Draw(), MapWindow::Draw(), KeyWindow::Draw(), and InfoWindow::Draw().

00060 { }


Member Data Documentation

int Window::BkColor [protected]
 

Definition at line 38 of file window.h.

Referenced by CPanelWindow::CPanelWindow(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), TextWin::TextWin(), and Window().

int Window::BorderColor [protected]
 

Definition at line 38 of file window.h.

Referenced by CPanelWindow::CPanelWindow(), DrawBorder(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), TextWin::TextWin(), and Window().

Display* Window::ClientD [protected]
 

Definition at line 39 of file window.h.

Referenced by MapWindow::AllocNodes(), MapWindow::ConnectNode(), CPanelWindow::CPanelWindow(), Dispatch(), CPanelWindow::Dispatch(), Draw(), TextWin::Draw(), PlayerWindow::Draw(), MapWindow::Draw(), KeyWindow::Draw(), InfoWindow::Draw(), PlayerWindow::DrawInfo(), Erase(), PopUpWin::Erase(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), MapWindow::Scale(), Window(), and ~Window().

int Window::CliX1 [protected]
 

Definition at line 37 of file window.h.

Referenced by CalcBorder(), CalcTitle(), CPanelWindow::CPanelWindow(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), and Window().

int Window::CliX2 [protected]
 

Definition at line 37 of file window.h.

Referenced by CalcBorder(), CalcTitle(), CPanelWindow::CPanelWindow(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), and Window().

int Window::CliY1 [protected]
 

Definition at line 37 of file window.h.

Referenced by CalcBorder(), CalcTitle(), CPanelWindow::CPanelWindow(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), and Window().

int Window::CliY2 [protected]
 

Definition at line 37 of file window.h.

Referenced by CalcBorder(), CPanelWindow::CPanelWindow(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), and Window().

char* Window::Title [protected]
 

Definition at line 43 of file window.h.

Referenced by CPanelWindow::CPanelWindow(), DrawTitle(), InfoWindow::InfoWindow(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), TextWin::TextWin(), Window(), and ~Window().

int Window::TitleColor [protected]
 

Definition at line 41 of file window.h.

Referenced by CPanelWindow::CPanelWindow(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), TextWin::TextWin(), and Window().

Display* Window::TitleD [protected]
 

Definition at line 44 of file window.h.

Referenced by CPanelWindow::CPanelWindow(), DrawTitle(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), Window(), and ~Window().

int Window::TX1 [protected]
 

Definition at line 42 of file window.h.

Referenced by CalcTitle(), CPanelWindow::CPanelWindow(), DrawTitle(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), and Window().

int Window::TX2 [protected]
 

Definition at line 42 of file window.h.

Referenced by CalcTitle(), CPanelWindow::CPanelWindow(), DrawTitle(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), and Window().

int Window::TY1 [protected]
 

Definition at line 42 of file window.h.

Referenced by CalcTitle(), CPanelWindow::CPanelWindow(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), and Window().

int Window::TY2 [protected]
 

Definition at line 42 of file window.h.

Referenced by CalcTitle(), CPanelWindow::CPanelWindow(), DrawTitle(), InfoWindow::InfoWindow(), Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), and Window().

int Window::XDim [protected]
 

Definition at line 36 of file window.h.

Referenced by CalcBorder(), TextWin::CalcDim(), CPanelWindow::CPanelWindow(), DrawBorder(), Erase(), GetXDim(), InfoWindow::InfoWindow(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), PopUpWin::PrepScreen(), and Window().

int Window::YDim [protected]
 

Definition at line 36 of file window.h.

Referenced by CalcBorder(), TextWin::CalcDim(), CPanelWindow::CPanelWindow(), DrawBorder(), Erase(), GetYDim(), InfoWindow::InfoWindow(), KeyWindow::KeyWindow(), MapWindow::MapWindow(), PlayerWindow::PlayerWindow(), PopUpWin::PrepScreen(), and Window().


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