Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

sjgui::CTextCtrlTmpl< Tbase > Class Template Reference

Text supporting multiple lines, selection and editing. More...

#include <text.h>

Inheritance diagram for sjgui::CTextCtrlTmpl< Tbase >:

sjgui::CFont sjgui::classic::CTextTmpl< Tbase > sjgui::modern::CTextTmpl< Tbase > List of all members.

Public Member Functions

virtual void OnDraw ()
 Draw backplane.

virtual void OnReshape ()
 Resize m_Strings.

virtual void OnUpdatePos ()
 Update text position.

void ShowBackPlane (bool b=true)
 Show/Hide back plane.

void SetColor (GLfloat *Color)
 Set color of the text.

void SetColor (GLfloat R, GLfloat G, GLfloat B, GLfloat A=1.0f)
 Set color of the text.

float * GetColor ()
 Get color of the text.

void SetTopLine (int iLine=0)
 Set index of the top shown line.

int GetTopLine ()
 Index of the top shown line.

int GetCharOnDisp ()
 Number of maximum visible characters in one line.

void SetSelectLines (bool b=true)
 Enables/Disables selection.

bool IsSelectLines ()
 Selection flag state.

int GetNumLinesOnScreen ()
 Number of displayed lines.

bool NeedWrap ()
 True if text needs wrapping.

void LoadTextFromFile (char *pName)
 Loads text from a file.

void SetShift (int i=0)
 Set shift of text.

int GetShift ()
 Get shift.

int GetSelectedLine ()
 Index of the selected line.

void SetSelectedLine (int iL)
 Set selected line index.

CTextStrs & GetStrings ()
 m_Strings member reference.

Editing functions.
These functions correspond to the editing of the text.

See also:
CTextStrs
Note:
Editing only of the first line is allowed.


void SetCursorPos (unsigned int i)
 Set cursor position.

void MoveCursorToEnd ()
 Moves cursor to the end of the text.

void MoveCursorToBeginning ()
 Moves cursor to the beginning of the text.

void InsertAtCursor (unsigned char ch)
 Insert a character at cursor position.

void RemoveBeforeCursor ()
 Removes character before cursor position.

void RemoveAfterCursor ()
 Removes character after cursor position.

void MoveCursorLeft ()
 Moves cursor to the left.

void MoveCursorRight ()
 Moves cursor to the right.

void ShowCursor (bool y=true)
 Show cursor.

void HideCursor ()
 Hide cursor.

bool IsCursorShown ()
 Cursor visibility.

CTextStrs functions.
These functions correspond to the CTextStrs functions, with range checking added.

See also:
CTextStrs


void SetIdent (bool b=true)
 Set ident for wrapping.

void SetWrap (bool b=true)
 Set wrap flag.

bool IsWrap ()
 Wrapping flag state.

int GetNumOfLines ()
 Total number of lines.

int GetMaxLength ()
 The length of the longest line in the text.

void AddLine (const char *cp)
 Add a new line (push_back wrapper).

void AddLine (std::string &str)
 Add a new line (push_back wrapper).

const char * GetLine (unsigned int i=0)
 Returns string with index i.

const char * operator[] (unsigned int i)
void ClearText ()
 Erases all text.


Protected Attributes

CTextStrs m_Strings
 Lines are stored here.

float m_Color [4]
 Color of the text.

unsigned int m_uiCursorPos
 Cursor position.

bool m_yShowCursor
 Cursor visibility flag.

bool m_ySelectLines
 Enables selection.

int m_iSelectedLine
 Selected line index.


Detailed Description

template<class Tbase>
class sjgui::CTextCtrlTmpl< Tbase >

Text supporting multiple lines, selection and editing.

Parameters:
Tbase - base class (use CWndCtrl). Currently only first line can be edited (used in CEdit). TopLine controls vertical scrolling. Shift controls horizontal scrolling. Selecting lines and wrapping at the same time is not allowed.
Author:
Alexander Shyrokov
Version:
Revision
1.1.1.1


Member Function Documentation

template<class Tbase>
int sjgui::CTextCtrlTmpl< Tbase >::GetSelectedLine  )  [inline]
 

Index of the selected line.

Returns:
-1 if none is selected, otherwise 0 and higher.

template<class Tbase>
bool sjgui::CTextCtrlTmpl< Tbase >::NeedWrap  )  [inline]
 

True if text needs wrapping.

This happens, when there is at least one line which is longer, then the number of displayed characters in one line.

template<class Tbase>
void sjgui::CTextCtrlTmpl< Tbase >::SetShift int  i = 0  )  [inline]
 

Set shift of text.

Used for horizontal scrolling.

template<class Tbase>
void sjgui::CTextCtrlTmpl< Tbase >::ShowBackPlane bool  b = true  )  [inline]
 

Show/Hide back plane.

Disable if you want text floating above whatever is under it. Then it is your responsibility to make sure text color is different from the background color.


The documentation for this class was generated from the following file:
sjgui logo
Quick Links:

 News
 Description
 Screen Shots
 Projects
 Downloads
 Source Code
 Help/FAQ
 Want to help?
 Credits
 Disclaimer


Documentation:

 Documentation
 Reference
 Lessons


Useful links:

sjcomp logo
sjcomp

opengl logo

nehe logo

SourceForge.net Logo

Last modified:


Started by Alexander Shyrokov. Generated at Wed Apr 28 12:31:06 2004 for the sjgui by doxygen 1.3.1. SourceForge.net Logo