MGUI::CTRL_EDIT_BASE Class Reference

Base class for 'edit' controls. More...

#include <mgui/editbase.h>

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

List of all members.

Public Types

enum  CREATEFLAGS {
  CREATEFLAG_None = 0x00000000, CREATEFLAG_ReadOnly = 0x00010000, CREATEFLAG_RightAlign = 0x00020000, CREATEFLAG_Opaque = 0x00040000,
  CREATEFLAG_UseFixedWidthFont = 0x00080000, CREATEFLAG_WordWrap = 0x00100000, CREATEFLAG_WidthInPixels = 0x00200000, CREATEFLAG_HeightInPixels = 0x00400000,
  CREATEFLAG_SizeInPixels = (CREATEFLAG_WidthInPixels|CREATEFLAG_HeightInPixels), CREATEFLAG_MASK = 0xFFFF0000
}

Public Member Functions

 CTRL_EDIT_BASE ()
 ~CTRL_EDIT_BASE ()
void ClearSelection ()
void CopySelection ()
void CutSelection ()
INT32 GetCursorPos () const
const bool GetModify () const
void GetSelection (int &nStartChar, int &nEndChar) const
bool HasValue () const
void Insert (const MISTRING &text)
void Paste ()
void ReplaceSelection (const MISTRING &NewText)
void SetANSIColor (INT32 indx, const COLOR &color)
void SetDelegateOnActivate (DELEGATE_VOID_NOPARMS delegate)
void SetDelegateOnChangeValue (DELEGATE_VOID_NOPARMS delegate)
void SetDelegateOnGainFocus (DELEGATE_VOID_NOPARMS delegate)
void SetDelegateOnLoseFocus (DELEGATE_VOID_NOPARMS delegate)
void SetDelegateOnSelection (DELEGATE_VOID_NOPARMS delegate)
void SetDelegateOnUserEdit (DELEGATE_VOID_NOPARMS delegate)
void SetDisplayNoValue (const MISTRING &string)
void SetMaxLength (int length)
void SetModify (bool modified=true)
void SetReadOnly (bool ReadOnly=true)
void SetSelection (int StartChar=0, int EndChar=-1, bool NoScroll=true)
void SetValidChars (const MIUNICODE *string, bool invert=false)

Protected Member Functions

bool CheckValidChars (MISTRING &string) const
void CreateCtrl (LAYOUT_PANE_BASE &ParentPane, int width, int height, CREATEFLAGS flags, LAYOUT_SIZEALIGN sizealign)
bool GetEditStr (MISTRING &str) const
void NotifyChanged ()
void UpdateCtrl (const MISTRING &string)
void UpdateValue (bool notify)

Protected Attributes

bool m_HasValue
bool m_UserEdited

Private Member Functions

virtual void OnActivate ()
virtual void OnChangeValue ()
virtual void v_OnUserEdit ()
virtual void v_UpdateValue (MISTRING &newvalue)

Detailed Description

Base class for 'edit' controls.


Member Enumeration Documentation

Flags for CreateCtrl.

Enumerator:
CREATEFLAG_None 
CREATEFLAG_ReadOnly 

Disallow editing.

CREATEFLAG_RightAlign 

Right-align text.

CREATEFLAG_Opaque 

Mask values (for password-style) input.

CREATEFLAG_UseFixedWidthFont 

Use fixed-width font if possible.

CREATEFLAG_WordWrap 

Word-wrap text instead of showing scrollbar (multi-line only).

CREATEFLAG_WidthInPixels 

Width specified in pixels.

CREATEFLAG_HeightInPixels 

Height specified in pixels (multi-line only).

CREATEFLAG_SizeInPixels 
CREATEFLAG_MASK 

Constructor & Destructor Documentation

MGUI::CTRL_EDIT_BASE::CTRL_EDIT_BASE (  ) 

Constructor.

MGUI::CTRL_EDIT_BASE::~CTRL_EDIT_BASE (  ) 

Destructor.


Member Function Documentation

bool MGUI::CTRL_EDIT_BASE::CheckValidChars ( MISTRING string  )  const [protected]

Check that all characters in string are in valid set.

Returns:
'true' if valid, 'false' if not
Parameters:
string String to be checked
void MGUI::CTRL_EDIT_BASE::ClearSelection (  ) 

Clear (delete) the current selection without copying to the clipboard.

void MGUI::CTRL_EDIT_BASE::CopySelection (  ) 

Copy the current selection to the clipboard.

void MGUI::CTRL_EDIT_BASE::CreateCtrl ( LAYOUT_PANE_BASE ParentPane,
int  width,
int  height,
CREATEFLAGS  flags,
LAYOUT_SIZEALIGN  sizealign 
) [protected]
Parameters:
width Width in 'typical' characters
height Height in text lines, 0 for single-line edit
void MGUI::CTRL_EDIT_BASE::CutSelection (  ) 

Cut the current selection to the clipboard.

INT32 MGUI::CTRL_EDIT_BASE::GetCursorPos (  )  const

Get the current cursor position.

bool MGUI::CTRL_EDIT_BASE::GetEditStr ( MISTRING str  )  const [protected]
const bool MGUI::CTRL_EDIT_BASE::GetModify (  )  const [inline]

Returns true if contents of the edit-control have been modified by user, false if not.

Use SetModify() to reset.

void MGUI::CTRL_EDIT_BASE::GetSelection ( int &  nStartChar,
int &  nEndChar 
) const

Get the current selection of the edit control.

If nStartChar == nEndChar, nothing is selected.

Parameters:
nStartChar Receives the first character in the current selection
nEndChar Receives the first non-selected character past the end of the current selection
bool MGUI::CTRL_EDIT_BASE::HasValue (  )  const

Determine if the edit control has a value.

void MGUI::CTRL_EDIT_BASE::Insert ( const MISTRING text  ) 

Insert text at the current cursor location.

void MGUI::CTRL_EDIT_BASE::NotifyChanged (  )  [inline, protected]
virtual void MGUI::CTRL_EDIT_BASE::OnActivate (  )  [private, virtual]

Called when user presses <Enter> in edit control.

Default implementation calls delegate for OnActivate.

virtual void MGUI::CTRL_EDIT_BASE::OnChangeValue (  )  [private, virtual]

Called when value is changed after validation.

If the user modifies the text in the edit control this will not be called until the control loses "focus". Default implementation calls delegate for OnChangeValue.

void MGUI::CTRL_EDIT_BASE::Paste (  ) 

Paste the clipboard contents at the current location.

void MGUI::CTRL_EDIT_BASE::ReplaceSelection ( const MISTRING NewText  ) 

Replaces the current selection in an edit control with new text.

This replaces only a portion of the text. To replace all the text, use SetValue(). If there is no current selection, the new text is inserted at the current cursor location.

void MGUI::CTRL_EDIT_BASE::SetANSIColor ( INT32  indx,
const COLOR color 
)

Set the color for ANSI text.

This changes the colors used for the ANSI escape sequences <ESC>[30m - <ESC>[37m (foreground colors) <ESC>[40m - <ESC>[47m (background colors) The index parameter must be in the range of 0 - 7 The default colors are...

0 - black 1 - red 2 - green 3 - yellow 4 - blue 5 - magenta 6 - cyan 7 - white

void MGUI::CTRL_EDIT_BASE::SetDelegateOnActivate ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when user presses <Enter> in edit control.

void MGUI::CTRL_EDIT_BASE::SetDelegateOnChangeValue ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when value is changed after validation.

If the user modifies the text in the edit control will not be called until the control loses "focus".

void MGUI::CTRL_EDIT_BASE::SetDelegateOnGainFocus ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when ctrl gains focus.

void MGUI::CTRL_EDIT_BASE::SetDelegateOnLoseFocus ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when ctrl loses focus.

void MGUI::CTRL_EDIT_BASE::SetDelegateOnSelection ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when user selects or unselects text.

Call GetSelection to see what is selected.

void MGUI::CTRL_EDIT_BASE::SetDelegateOnUserEdit ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when user modifies the text in the edit control.

The actual value does not get updated until the control loses focus or GetValue() is called.

void MGUI::CTRL_EDIT_BASE::SetDisplayNoValue ( const MISTRING string  ) 

Set string to display when no value is available.

Usually used to prompt user to enter a value, default is blank.

void MGUI::CTRL_EDIT_BASE::SetMaxLength ( int  length  ) 

Set the maximim text length in characters.

void MGUI::CTRL_EDIT_BASE::SetModify ( bool  modified = true  )  [inline]

Set or clear the "modified" state of the edit control.

void MGUI::CTRL_EDIT_BASE::SetReadOnly ( bool  ReadOnly = true  ) 

Set whether value is read-only or not.

Parameters:
ReadOnly True if read only, false if not
void MGUI::CTRL_EDIT_BASE::SetSelection ( int  StartChar = 0,
int  EndChar = -1,
bool  NoScroll = true 
)

Select range of characters in string.

If StartChar is -1, any current selection is unselected.

Parameters:
StartChar Starting character position in string, 0 for beginning
EndChar Ending character position, -1 for end of string
NoScroll Indicates whether to scroll caret into view
void MGUI::CTRL_EDIT_BASE::SetValidChars ( const MIUNICODE string,
bool  invert = false 
)

Set set of 'valid' or 'invalid' characters.

This does not alter the current contents, if any.

Parameters:
string Characters valid or invalid to enter
invert Allow all but specified characters
void MGUI::CTRL_EDIT_BASE::UpdateCtrl ( const MISTRING string  )  [protected]

Called internally to update text control from specified string.

void MGUI::CTRL_EDIT_BASE::UpdateValue ( bool  notify  )  [protected]

Called internally to update control-specific data from edit control.

virtual void MGUI::CTRL_EDIT_BASE::v_OnUserEdit (  )  [private, virtual]

Called when user modifies the text in the edit control.

The actual value does not get updated until the control loses focus or GetValue() is called.

virtual void MGUI::CTRL_EDIT_BASE::v_UpdateValue ( MISTRING newvalue  )  [private, virtual]

Called internally to update control-specific data from edit control.

Derived class must call corresponding base class method AFTER performing its own processing.


Member Data Documentation


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

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