MGUI::CTRL_EDIT_TEXT Class Reference

Multi-line text 'edit' control. More...

#include <mgui/edit.h>

Inheritance diagram for MGUI::CTRL_EDIT_TEXT:
Inheritance graph
[legend]

List of all members.

Public Types

typedef
fastdelegate::FastDelegate
< void(INT32 lin, INT32 col)> 
DELEGATE_ONCURSORMOTION
enum  FLAGS {
  FLAG_Default = CTRL_EDIT_BASE::CREATEFLAG_None, FLAG_RightJustify = CTRL_EDIT_BASE::CREATEFLAG_RightAlign, FLAG_ReadOnly = CTRL_EDIT_BASE::CREATEFLAG_ReadOnly, FLAG_Opaque = CTRL_EDIT_BASE::CREATEFLAG_Opaque,
  FLAG_WidthInPixels = CTRL_EDIT_BASE::CREATEFLAG_WidthInPixels, FLAG_UseFixedWidthFont = CTRL_EDIT_BASE::CREATEFLAG_UseFixedWidthFont, FLAG_SizeInPixels = CTRL_EDIT_BASE::CREATEFLAG_SizeInPixels, FLAG_WYSIWYG = 0x0001,
  FLAG_NoWordWrap = 0x0002
}

Public Member Functions

 CTRL_EDIT_TEXT ()
virtual ~CTRL_EDIT_TEXT ()
bool CanUndo () const
void ClearValue (bool notify=true)
void Create (MGUI::LAYOUT_PANE_BASE &ParentPane, int width=0, int height=0, FLAGS flags=FLAG_Default, MGUI::LAYOUT_SIZEALIGN sizealign=MGUI::LAYOUT_SIZEALIGN_FixedHeight)
bool Find (const MISTRING &SearchString, bool bCaseSensitive=true, bool bNext=false)
bool GetCaretPos (int &caretrow, int &caretcolumn) const
int GetFirstVisibleLine () const
int GetLineCount () const
int GetLineFromChar (int nIndex=-1) const
int GetLineIndex (int nLine=-1)
int GetLineLength (int nLine=-1)
void GetStyle (TEXTSTYLE &style, int offset=-1) const
const MISTRINGGetValue ()
void HandleKey (MGUI::KEYCODE keycode, MGUI::KEYSTATE keystate)
void HideCursor ()
void LineScroll (int nLines, int nChars=0)
void SetCursorPos (int line, int col, bool bScroll=true)
void SetCursorPos (int nCharIndex, bool bScroll=true)
void SetDelegateOnCursorMotion (DELEGATE_ONCURSORMOTION delegate)
void SetDelegateOnHyperLink (DELEGATE_VOID_MISTRING delegate)
void SetStyle (const TEXTSTYLE &style, int start, int end)
void SetStyle (const TEXTSTYLE &style)
void SetTabStops (int cxEachStop)
void SetValue (const MIUNICODE *string, bool notify=true)
void ShowCursor ()
void Undo ()

Detailed Description

Multi-line text 'edit' control.


Member Typedef Documentation

typedef fastdelegate::FastDelegate<void(INT32 lin, INT32 col)> MGUI::CTRL_EDIT_TEXT::DELEGATE_ONCURSORMOTION

Member Enumeration Documentation

Enumerator:
FLAG_Default 
FLAG_RightJustify 

Right-justify value, default is to left-justify.

FLAG_ReadOnly 

User cannot change value.

FLAG_Opaque 

Show '*'s for password input.

FLAG_WidthInPixels 

Width specified in pixels.

FLAG_UseFixedWidthFont 

Use a fixed-width font if possible.

FLAG_SizeInPixels 

Size specified in pixels.

FLAG_WYSIWYG 

Do WYSIWYG editing. Parses {~,,.} codes for text style.

FLAG_NoWordWrap 

Give a horizontal scroll bar instead of word-wrapping.


Constructor & Destructor Documentation

MGUI::CTRL_EDIT_TEXT::CTRL_EDIT_TEXT (  ) 

Constructor.

virtual MGUI::CTRL_EDIT_TEXT::~CTRL_EDIT_TEXT (  )  [virtual]

Destructor.


Member Function Documentation

bool MGUI::CTRL_EDIT_TEXT::CanUndo (  )  const

Determine if the last edit operation can be undone by a call to the Undo member function.

void MGUI::CTRL_EDIT_TEXT::ClearValue ( bool  notify = true  ) 

Clear entire control to empty string.

Parameters:
notify Call OnChangeValue() if control has already been created
void MGUI::CTRL_EDIT_TEXT::Create ( MGUI::LAYOUT_PANE_BASE ParentPane,
int  width = 0,
int  height = 0,
FLAGS  flags = FLAG_Default,
MGUI::LAYOUT_SIZEALIGN  sizealign = MGUI::LAYOUT_SIZEALIGN_FixedHeight 
)

Create control.

Parameters:
ParentPane Parent pane
width Width in 'typical' characters, minimum if can expand based on sizealign
height Height lines, minimum if can expand based on sizealign
bool MGUI::CTRL_EDIT_TEXT::Find ( const MISTRING SearchString,
bool  bCaseSensitive = true,
bool  bNext = false 
)

Searches the text in the control for a given string.

If bNext is true, the search begins one character past the current cursor location. If the string is found, it will be selected and the function will return true. If not found, it will beep and return false.

bool MGUI::CTRL_EDIT_TEXT::GetCaretPos ( int &  caretrow,
int &  caretcolumn 
) const

Get the caret position.

Returns:
true if position valid, false if not.
int MGUI::CTRL_EDIT_TEXT::GetFirstVisibleLine (  )  const

Determines the topmost visible line in an edit control.

Returns the zero-based index of the topmost visible line. For single-line edit controls, the return value is 0.

int MGUI::CTRL_EDIT_TEXT::GetLineCount (  )  const

Get the number of lines in the edit control.

int MGUI::CTRL_EDIT_TEXT::GetLineFromChar ( int  nIndex = -1  )  const

Retrieves the line number of the line that contains the specified character index.

Returns the zero-based line number of the line containing the character index specified by nIndex. If nIndex is -1, the number of the line that contains the first character of the selection is returned. If there is no selection, the current line number is returned.

int MGUI::CTRL_EDIT_TEXT::GetLineIndex ( int  nLine = -1  ) 

Retrieves the character index of a line within a multiple-line edit control.

Returns the character index of the line specified in nLine or -1 if the specified line number is greater then the number of lines in the edit control.

int MGUI::CTRL_EDIT_TEXT::GetLineLength ( int  nLine = -1  ) 

Retrieves the character index of a line within a multiple-line edit control.

Return value is the length (in bytes) of the line specified by nLine. nLine specifies the character index of a character in the line whose length is to be retrieved. If this parameter is -1, the length of the current line (the line that contains the caret) is returned, not including the length of any selected text within the line.

void MGUI::CTRL_EDIT_TEXT::GetStyle ( TEXTSTYLE style,
int  offset = -1 
) const

Get the text style at the specified offset No effect unless created with the FLAG_WYSIWYG flag.

Parameters:
offset Offset to get style at. -1 for style at cursor
const MISTRING& MGUI::CTRL_EDIT_TEXT::GetValue (  ) 

Get current string value.

void MGUI::CTRL_EDIT_TEXT::HandleKey ( MGUI::KEYCODE  keycode,
MGUI::KEYSTATE  keystate 
)

Handle keypress.

void MGUI::CTRL_EDIT_TEXT::HideCursor (  ) 

Hide the cursor (a.k.a. caret).

void MGUI::CTRL_EDIT_TEXT::LineScroll ( int  nLines,
int  nChars = 0 
)

Scrolls the text of a multiple-line edit control.

Parameters:
nLines Specifies the number of lines to scroll vertically
nChars Specifies the number of character positions to scroll horizontally
void MGUI::CTRL_EDIT_TEXT::SetCursorPos ( int  line,
int  col,
bool  bScroll = true 
)

Set the current cursor (a.k.a. caret) location.

Parameters:
bScroll True to scroll so cursor is visible in the window.
void MGUI::CTRL_EDIT_TEXT::SetCursorPos ( int  nCharIndex,
bool  bScroll = true 
)

Set the current cursor (a.k.a. caret) location.

Parameters:
bScroll True to scroll so cursor is visible in the window.
void MGUI::CTRL_EDIT_TEXT::SetDelegateOnCursorMotion ( DELEGATE_ONCURSORMOTION  delegate  )  [inline]

Set a delegate to be called when the cursor is moved.

The delegate will be called with the current line and column numbers (in that order and 0-based).

void MGUI::CTRL_EDIT_TEXT::SetDelegateOnHyperLink ( DELEGATE_VOID_MISTRING  delegate  )  [inline]

Set the delegate to call when the user clicks a hyper link in the text.

Note: This is for the X version only and is really meant for use on a ReadOnly control. A Hyper link can be embeded in text by using the following escape codes: <ESC>[6m the text to show <ESC>[5m the href <ESC>[25m The text between the <ESC>[5m and <ESC>[25m will not be shown to the user, but will be passed to the delegate if the user clicks on it. The only visual indication the user gets that it's a link is that the cursor changes to a hand when they hover over the spot.

void MGUI::CTRL_EDIT_TEXT::SetStyle ( const TEXTSTYLE style,
int  start,
int  end 
)

Get the text style of a range of text.

No effect unless created with the FLAG_WYSIWYG flag

Parameters:
start Starting offset to modify
end Ending offset to modify
void MGUI::CTRL_EDIT_TEXT::SetStyle ( const TEXTSTYLE style  ) 

Get the text style of the current selection, or at the current cursor position (if nothing is selected) No effect unless created with the FLAG_WYSIWYG flag.

void MGUI::CTRL_EDIT_TEXT::SetTabStops ( int  cxEachStop  ) 

Set equal tab stops Call this function to set the tab stops in a multiple-line edit control.

When text is copied to a multiple-line edit control, any tab character in the text will cause space to be generated up to the next tab stop. The default is one tab stop every 8 characters.

Parameters:
cxEachStop tab stops are to be set at every cxEachStop dialog units
void MGUI::CTRL_EDIT_TEXT::SetValue ( const MIUNICODE string,
bool  notify = true 
)

Set current string value with validation.

OnValidate() will be called and if valid, the string will be updated. No comparison is made with the current string value.

Parameters:
string New string to set
notify Call OnChangeValue() if string actually updated
void MGUI::CTRL_EDIT_TEXT::ShowCursor (  ) 

Show the cursor (a.k.a. caret).

void MGUI::CTRL_EDIT_TEXT::Undo (  ) 

Undo the last edit.


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

Generated on Sun Oct 7 21:35:31 2012 for TNTsdk 2012 by  doxygen 1.6.1