ScummVM API documentation
Titanic::CTextControl Class Reference

Public Member Functions

 CTextControl (uint count=10)
 
void setup ()
 
void load (SimpleFile *file, int param)
 
void save (SimpleFile *file, int indent)
 
void setBounds (const Rect &bounds)
 
void setHasBorder (bool val)
 
void draw (CScreenManager *screenManager)
 
void resize (uint count)
 
CString getText () const
 
void setText (const CString &str)
 
void setText (StringId stringId)
 
void setColor (uint col)
 
void setColor (byte r, byte g, byte b)
 
void setLineColor (uint lineNum, byte r, byte g, byte b)
 
void setLineColor (uint lineNum, uint col)
 
void setMaxCharsPerLine (int maxChars)
 
void deleteLastChar ()
 
void setNPC (int npcFlag, int npcId)
 
int displayEndIndex () const
 
void scrollUp (CScreenManager *screenManager)
 
void scrollDown (CScreenManager *screenManager)
 
void scrollUpPage (CScreenManager *screenManager)
 
void scrollDownPage (CScreenManager *screenManager)
 
void scrollToTop (CScreenManager *screenManager)
 
void scrollToBottom (CScreenManager *screenManager)
 
void addLine (const CString &str)
 
void addLine (const CString &str, uint color)
 
void addLine (const CString &str, byte r, byte g, byte b)
 
bool handleKey (char c)
 
void showCursor (int mode)
 
void hideCursor ()
 
int getNPCNum (uint ident, uint startIndex)
 
void remapColors (uint count, uint *srcColors, uint *destColors)
 
void setFontNumber (int fontNumber)
 
int getTextWidth (CScreenManager *screenManager)
 
int getTextHeight (CScreenManager *screenManager)
 

Static Public Member Functions

static CString getColorText (byte r, byte g, byte b)
 

Member Function Documentation

◆ setup()

void Titanic::CTextControl::setup ( )

Set up the control

◆ load()

void Titanic::CTextControl::load ( SimpleFile file,
int  param 
)

Load the data for the control

◆ save()

void Titanic::CTextControl::save ( SimpleFile file,
int  indent 
)

Save the data for the control

◆ setBounds()

void Titanic::CTextControl::setBounds ( const Rect bounds)
inline

Set the bounds for the control

◆ setHasBorder()

void Titanic::CTextControl::setHasBorder ( bool  val)
inline

Sets the flag for whether to draw a frame border around the control

◆ draw()

void Titanic::CTextControl::draw ( CScreenManager screenManager)

Draw the control

◆ getText()

CString Titanic::CTextControl::getText ( ) const

Returns the text from all the lines as a single string

◆ setText() [1/2]

void Titanic::CTextControl::setText ( const CString str)

Set the text

◆ setText() [2/2]

void Titanic::CTextControl::setText ( StringId  stringId)

Set the text

◆ setColor() [1/2]

void Titanic::CTextControl::setColor ( uint  col)

Set text color

◆ setColor() [2/2]

void Titanic::CTextControl::setColor ( byte  r,
byte  g,
byte  b 
)

Set text color

◆ setLineColor() [1/2]

void Titanic::CTextControl::setLineColor ( uint  lineNum,
byte  r,
byte  g,
byte  b 
)

Set the color for a line

◆ getColorText()

static CString Titanic::CTextControl::getColorText ( byte  r,
byte  g,
byte  b 
)
static

Gets the text string representing a color encoding

◆ setLineColor() [2/2]

void Titanic::CTextControl::setLineColor ( uint  lineNum,
uint  col 
)

Set the color for a line

◆ setMaxCharsPerLine()

void Titanic::CTextControl::setMaxCharsPerLine ( int  maxChars)

Sets the maximum number of characters per line

◆ deleteLastChar()

void Titanic::CTextControl::deleteLastChar ( )

Delete the last character from the last line

◆ setNPC()

void Titanic::CTextControl::setNPC ( int  npcFlag,
int  npcId 
)

Sets the current NPC text is being added for

◆ displayEndIndex()

int Titanic::CTextControl::displayEndIndex ( ) const
inline

Returns the character index into _lines of the last character to be displayed on-screen

◆ scrollUp()

void Titanic::CTextControl::scrollUp ( CScreenManager screenManager)

Scroll the text up

◆ scrollDown()

void Titanic::CTextControl::scrollDown ( CScreenManager screenManager)

Scroll the text down

◆ scrollUpPage()

void Titanic::CTextControl::scrollUpPage ( CScreenManager screenManager)

Scroll the text up one page

◆ scrollDownPage()

void Titanic::CTextControl::scrollDownPage ( CScreenManager screenManager)

Scroll the text down one page

◆ scrollToTop()

void Titanic::CTextControl::scrollToTop ( CScreenManager screenManager)

Scroll to the top of the text

◆ scrollToBottom()

void Titanic::CTextControl::scrollToBottom ( CScreenManager screenManager)

Scroll to the bottom of the text

◆ addLine() [1/3]

void Titanic::CTextControl::addLine ( const CString str)

Add a line to the text

◆ addLine() [2/3]

void Titanic::CTextControl::addLine ( const CString str,
uint  color 
)

Add a line to the text

◆ addLine() [3/3]

void Titanic::CTextControl::addLine ( const CString str,
byte  r,
byte  g,
byte  b 
)

Add a line to the text

◆ handleKey()

bool Titanic::CTextControl::handleKey ( char  c)

Handles character processing to add or remove characters to the current text line

Returns
True if the Enter key was pressed

◆ showCursor()

void Titanic::CTextControl::showCursor ( int  mode)

Attaches the current system cursor to the text control, and give it suitable defaults

◆ hideCursor()

void Titanic::CTextControl::hideCursor ( )

Removes the cursor attached to the text

◆ getNPCNum()

int Titanic::CTextControl::getNPCNum ( uint  ident,
uint  startIndex 
)

Get an NPC Number embedded within on-screen text. Used by the PET log to encode which NPC spoke

Parameters
identNpc Type. Always passed as 1
startIndexStarting index to scan backwards through the log text to find an NPC ident sequence

◆ remapColors()

void Titanic::CTextControl::remapColors ( uint  count,
uint *  srcColors,
uint *  destColors 
)

Replaces any occurances of line colors that appear in the first list with the entry at the same index in the dest list

◆ setFontNumber()

void Titanic::CTextControl::setFontNumber ( int  fontNumber)

Set the font number to use

◆ getTextWidth()

int Titanic::CTextControl::getTextWidth ( CScreenManager screenManager)

Get the width of the text

◆ getTextHeight()

int Titanic::CTextControl::getTextHeight ( CScreenManager screenManager)

Get the required height to draw the text


The documentation for this class was generated from the following file: