VTextCanvasPane

A class for drawing text on a canvas.

Synopsis

 * Header:
 * [vquickr.htm#vTextCanvasPane ]


 * Class name:
 * vTextCanvasPane


 * Hierarchy:
 * [vpane.htm vPane] ->[vcanvas.htm vCanvasPane] ->vTextCanvasPane

Description
This class provides a complete scrolling text window. You can send text line by line to the window, and it will scroll the text up the screen in response to linefeed characters. You can also position the cursor, and selectively clear areas of the text screen or display text at specific locations. This class handles repainting the screen on Redraw events. In essence, the vTextCanvasPane class provides the functionality of a typical simple-minded text terminal.

void ClearRow(const int row, const int col)
This clears to blanks row row of the screen from column col to the end of the line.

void ClearToEnd(const int row, const int col)
This clears to blanks from row row and column col to the end of the screen.

int GetCols
Returns number of columns in current text canvas.

int GetRows
Returns number of rows in current text canvas.

void GetRC(int& row, int& col)
Returns in row</tt> and col</tt> the current row and column of the text cursor.

void GotoRC(const int row ,const int row)
Moves the text cursor to row,col</tt>.

void DrawAttrText(const char* text, const ChrAttr attr)
Draws text</tt> starting at the current cursor location using text attribute attr</tt>. For more details, see vDC::DrawAttrText</tt>.

void DrawChar(const char chr, const ChrAttr attr)
Draws a single character chr</tt> at the current cursor location using text attribute attr</tt>. See DrawAttrText</tt> for more details.

void DrawText(const char* text)
Draws text</tt> starting at the current cursor location. The newline character '\n'</tt> will cause the cursor to move to the beginning of the next line, and the text to scroll if the cursor was on the last line.

void HideTextCursor(void)
This method will hide the text cursor.

void ShowTextCursor(void)
This method will redisplay the text cursor at the current row and column.

void ScrollText(const int count)
This will scroll the text in the text canvas up or down by count</tt> lines. There will be count</tt> blank lines created at the bottom or top of the screen.

void ResizeText(const int rows, const int cols)
This method handles resize events. You will want to override this to track the new number of rows and columns.

void TextMouseDown(int row, int col, int button)
This is called when the user clicks the mouse button down. It is called with the text row and column, and the button number.

void TextMouseUp(int row, int col, int button)
This is called when the user releases the mouse button. It is called with the text row and column, and the button number.

void TextMouseMove(int row, int col, int button)
This is called when the mouse moves. It is called with the text row and column, and the button number.

int ColToX(int col)
Returns the pixel value of the given column. Most useful to place vPopupMenus in proper position from text canvas.

int RowToY(int row)
Returns the pixel value of the given row. Most useful to place vPopupMenus in proper position from text canvas.

virtual void Clear
This clears the text canvas and resets the row and column to 0,0.

void FontChanged(int)
This is called when the font of the canvas changes. FontChanged</tt> calls ResizeText</tt>, so you probably won't have to deal with this event.

void Redraw(int x, int y, int width, int height)
Called when the screen needs to be redrawn. Normally, you won't have to override this class since the vTextCanvasPane</tt> superclass will handle redrawing what is in the window. Instead, you will usually just have to respond to the FontChanged</tt> and <tt>ResizeText</tt> events when the contents of the canvas will actually change.