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

TextWin Class Reference

#include <textwin.h>

Inheritance diagram for TextWin:

PopUpWin Window ScrnObj List of all members.

Public Methods

 TextWin (int minxdim, int addy, int bc, int bkc, char **txt, int txtc)
 TextWin (int minxdim, int addy, int bc, int bkc, char *t, int tc, char **txt, int txtc)
virtual ~TextWin ()
virtual void Draw ()

Protected Methods

void CalcDim (void)

Private Attributes

int TextColor
char ** Text
int THeight
int MinXDim
int AddY

Constructor & Destructor Documentation

TextWin::TextWin int    minxdim,
int    addy,
int    bc,
int    bkc,
char **    txt,
int    txtc
 

Definition at line 16 of file textwin.c.

References AddY, Window::BkColor, Window::BorderColor, CalcDim(), MinXDim, Text, and TextColor.

00018 {
00019   MinXDim = minxdim;  AddY = addy;
00020   BorderColor = bc;
00021   BkColor = bkc;
00022   TextColor = txtc;
00023   Text = txt;
00024   CalcDim ();
00025 }

TextWin::TextWin int    minxdim,
int    addy,
int    bc,
int    bkc,
char *    t,
int    tc,
char **    txt,
int    txtc
 

Definition at line 28 of file textwin.c.

References AddY, Window::BkColor, Window::BorderColor, CalcDim(), MinXDim, Text, TextColor, Window::Title, and Window::TitleColor.

00030 {
00031   MinXDim = minxdim;  AddY = addy;
00032   BorderColor = bc;
00033   BkColor = bkc;
00034   TitleColor = tc;
00035   TextColor = txtc;
00036   Title = new char [strlen (t)];
00037   assert (Title != 0);
00038   strcpy (Title, t);
00039   Text = txt;
00040   CalcDim ();
00041 }

virtual TextWin::~TextWin   [inline, virtual]
 

Definition at line 32 of file textwin.h.

00032 { }


Member Function Documentation

void TextWin::CalcDim void    [protected]
 

Definition at line 44 of file textwin.c.

References AddY, BorderWidth, max(), MinXDim, Viewport::SetTextStyle(), Text, Viewport::TextHeight(), Viewport::TextWidth(), TextWinFont, TextWinFontSize, THeight, TitleWidth, Window::XDim, and Window::YDim.

Referenced by TextWin().

00045 {
00046   Viewport temp;
00047   temp.SetTextStyle (TextWinFont, HORIZ_DIR, TextWinFontSize);
00048   THeight = temp.TextHeight ("My") + 4;
00049   int nlines;
00050 
00051   XDim = MinXDim;
00052   for (nlines=0; strlen (Text [nlines]); nlines++)
00053   {
00054     XDim = max (XDim, temp.TextWidth (Text [nlines]) + 10);
00055     YDim += THeight;
00056   }
00057   if (Title)
00058     YDim += TitleWidth + 1;
00059   YDim += AddY + THeight + (BorderWidth*2) + 2;
00060   XDim += (BorderWidth*2) + 10;
00061 }

void TextWin::Draw   [virtual]
 

Reimplemented from Window.

Definition at line 64 of file textwin.c.

References Viewport::Clear(), Window::ClientD, ScrnObj::Disp, Viewport::Done(), Display::Draw(), Window::DrawBorder(), ScrnObj::Drawn, Window::DrawTitle(), Viewport::FastDraw(), Viewport::GetMaxX(), Viewport::MoveRel(), Viewport::MoveTo(), Viewport::OutText(), PopUpWin::PrepScreen(), Viewport::SetColor(), Viewport::SetTextJustify(), Viewport::SetTextStyle(), Text, TextColor, TextWinFont, TextWinFontSize, THeight, and True.

Referenced by MessageWin().

00065 {
00066   if (!Drawn)
00067   {
00068     assert (Disp != NULL);
00069     Disp->FastDraw ();
00070     PrepScreen ();
00071     DrawBorder ();
00072     if (TitleD)
00073       DrawTitle ();
00074     ClientD->Clear ();
00075     ClientD->SetColor (TextColor);
00076     ClientD->SetTextStyle (TextWinFont, HORIZ_DIR, TextWinFontSize);
00077     ClientD->SetTextJustify (CENTER_TEXT, TOP_TEXT);
00078     ClientD->MoveTo (ClientD->GetMaxX()/2, THeight/2);
00079     for (int i=0; strlen (Text [i]); i++)
00080     {
00081       ClientD->OutText (Text [i]);
00082       ClientD->MoveRel (0, THeight);
00083     }
00084     ClientD->Draw ();
00085     Disp->Done ();
00086     Drawn = True;
00087   }
00088 }


Member Data Documentation

int TextWin::AddY [private]
 

Definition at line 23 of file textwin.h.

Referenced by CalcDim(), and TextWin().

int TextWin::MinXDim [private]
 

Definition at line 23 of file textwin.h.

Referenced by CalcDim(), and TextWin().

char** TextWin::Text [private]
 

Definition at line 22 of file textwin.h.

Referenced by CalcDim(), Draw(), and TextWin().

int TextWin::TextColor [private]
 

Definition at line 21 of file textwin.h.

Referenced by Draw(), and TextWin().

int TextWin::THeight [private]
 

Definition at line 23 of file textwin.h.

Referenced by CalcDim(), and Draw().


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