OWLNext 6.32
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
owl::TRichEdit Class Reference

#include <richedit.h>

Inheritance diagram for owl::TRichEdit:
owl::TEditFile owl::TEditSearch owl::TEdit owl::TStatic owl::TControl owl::TWindow owl::TEventHandler owl::TStreamableBase owl::TRichEditView

List of all members.

Public Types

enum  TFmtStatus { No, Yes, Partly }

Public Member Functions

 TRichEdit (TWindow *parent, int id, LPCTSTR text, int x, int y, int w, int h, LPCTSTR fileName=0, TModule *module=0)
 TRichEdit (TWindow *parent, int id, const tstring &text, int x, int y, int w, int h, const tstring &fileName=tstring(), TModule *=0)
 TRichEdit (TWindow *parent, int resourceId, TModule *module=0)
ulong GetCharFormat (TCharFormat &, bool selection=false) const
ulong GetParaFormat (TParaFormat &) const
bool SetCharFormat (const TCharFormat &, uint flags=SCF_SELECTION)
bool SetParaFormat (const TParaFormat &)
TColor SetBkgndColor (const TColor &=TColor::None)
uint HasCharAttribute (ulong mask, uint32 effects)
bool ToggleCharAttribute (ulong mask, uint32 effects)
bool ChangeCharPointSize (int pointSizeDelta)
bool HasSelection () const
void GetSelRange (TCharRange &) const
int SetSelRange (const TCharRange &)
void HideSelection (bool hide, bool changeStyle)
ulong GetSelectionType () const
virtual void GetSelection (int &startPos, int &endPos) const
virtual TRange GetSelection () const
virtual bool SetSelection (int startPos, int endPos)
virtual bool SetSelection (const TRange &r)
bool EnableAutoURL (bool enable=true)
int GetIMEMode () const
void SetLangOptions (int options)
int GetLangOptions () const
void SetTextMode (int mode)
int GetTextMode () const
void SetUndoLimit (int maxnum)
void StopGroupTyping ()
int GetTextLength () const
int GetTextRange (TTextRange &) const
int GetTextRange (const TCharRange &, TCHAR *buffer) const
int GetSelectedText (TCHAR *buffer) const
tstring GetSelectedText () const
int FindText (uint flags, const TFindText &)
int FindText (uint flags, const TCharRange &, LPCTSTR text)
int FindText (uint flags, const TCharRange &r, const tstring &text)
virtual tstring GetTextRange (const TRange &) const
virtual void GetSubText (TCHAR *textBuf, int startPos, int endPos) const
virtual int Search (int startPos, LPCTSTR text, bool caseSensitive=false, bool wholeWord=false, bool up=false)
virtual int Search (int startPos, const tstring &text, bool caseSensitive=false, bool wholeWord=false, bool up=false)
virtual void LimitText (int max)
virtual int GetLineFromPos (int charPos) const
virtual uint32 CharFromPos (int16 x, int16 y)
virtual uint32 PosFromChar (uint charIndex)
int FindWordBreak (uint code, int start)
bool CanPaste (uint format) const
bool CanRedo () const
int GetUndoName () const
int GetRedoName () const
void Redo ()
void PasteSpecial (uint format)
virtual void Paste ()
ulong StreamIn (uint format, TEditStream &)
ulong StreamOut (uint format, TEditStream &)
bool DisplayBand (TRect &)
int FormatRange (const TFormatRange &range, bool render=true)
int FormatRange ()
bool SetTargetDevice (HDC, int lineWidth)
void RequestResize ()
bool GetOleInterface (IRichEditOle *&) const
bool SetOleInterface (IRichEditOleCallback *)
uint GetFormat () const
void SetFormat (uint fmt)
bool IsRTF () const
ulong GetEventMask () const
ulong SetEventMask (ulong msk)
virtual uint Transfer (void *buffer, TTransferDirection direction)
virtual bool Read (LPCTSTR fileName=0)
virtual bool Write (LPCTSTR fileName=0)
bool ReadFromStream (tistream &, uint format=SF_RTF)
bool WriteToStream (tostream &, uint format=SF_RTF)

Protected Member Functions

void CmEditCut ()
void CmEditCopy ()
void CmEditPaste ()
void CmEditDelete ()
void CmEditClear ()
void CmEditUndo ()
void CeHasSelect (TCommandEnabler &commandHandler)
void CeEditPaste (TCommandEnabler &commandHandler)
void CeEditClear (TCommandEnabler &commandHandler)
void CeEditUndo (TCommandEnabler &commandHandler)
void ENErrSpace ()
virtual TGetClassNameReturnType GetClassName ()
void SetupWindow ()
void EvChar (uint key, uint repeatCount, uint flags)
void EvKeyDown (uint key, uint repeatCount, uint flags)
uint EvGetDlgCode (MSG *)
void EvSetFocus (HWND hWndLostFocus)
void EvKillFocus (HWND hWndGetFocus)
void EvChildInvalid (HWND)

Protected Attributes

uint Format

Detailed Description

TRichEdit encapsulates a rich edit control, a window in which a user can enter, edit and format text.


Member Enumeration Documentation

Enumeration of flags returned when querrying a RichEdit about a particular character attribute for a chunk of selected text.

Enumerator:
No 

The whole selection has the attribute.

Yes 

The attribute is absent from the selection.

Partly 

Part of the selection has the attribute.


Constructor & Destructor Documentation

owl::TRichEdit::TRichEdit ( TWindow parent,
int  id,
LPCTSTR  text,
int  x,
int  y,
int  w,
int  h,
LPCTSTR  fileName = 0,
TModule module = 0 
)

Constructor for a TRichEdit object. By default, edit control has a border and its text is left-justified. Multiline edit control has horizontal vertical scroll bars.

owl::TRichEdit::TRichEdit ( TWindow parent,
int  id,
const tstring &  text,
int  x,
int  y,
int  w,
int  h,
const tstring &  fileName = tstring(),
TModule module = 0 
)
owl::TRichEdit::TRichEdit ( TWindow parent,
int  resourceId,
TModule module = 0 
)

Constructor for TRichEdit associated with a MS-Windows interface element created by MS-Windows from a resource definition.

By default, data transfer is enabled

References owl::TDllLoader< T >::IsAvailable(), and owl::TXCommCtrl::Raise().


Member Function Documentation

bool owl::TRichEdit::ChangeCharPointSize ( int  pointSizeDelta)

Increases or decreases (using a positive or negative value respectively) the point size of the current selection.

References SetCharFormat().

void owl::TRichEdit::CmEditClear ( ) [inline, protected]

Handler of the CM_EDITCLEAR command - invokes the 'Clear' method.

Reimplemented from owl::TEdit.

References owl::TEdit::Clear().

void owl::TRichEdit::CmEditCopy ( ) [inline, protected]

Handler of the CM_EDITCOPY command - invokes the'Copy' method.

Reimplemented from owl::TEdit.

References owl::TEdit::Copy().

void owl::TRichEdit::CmEditCut ( ) [inline, protected]

Handler of the CM_EDITCUT command - Invokes the 'Cut' method.

Reimplemented from owl::TEdit.

References owl::TEdit::Cut().

void owl::TRichEdit::CmEditDelete ( ) [inline, protected]

Handler of the CM_EDITDELETE command - invokes the 'DeleteSelection' method.

Reimplemented from owl::TEdit.

References owl::TEdit::DeleteSelection().

void owl::TRichEdit::CmEditPaste ( ) [inline, protected]

Handler of the CM_EDITPASTE command - invokes the 'Paste' method.

Reimplemented from owl::TEdit.

References Paste().

void owl::TRichEdit::CmEditUndo ( ) [inline, protected]

Handler of the CM_EDITUNDO command - invokes the 'Undo' method.

Reimplemented from owl::TEdit.

References owl::TEdit::Undo().

void owl::TRichEdit::ENErrSpace ( ) [protected]

EN_ERRSPACE.

Beeps when edit control runs out of space.

Sounds a beep in response to an error notification message that is sent when the edit control unsuccessfully attempts to allocate more memory.

Reimplemented from owl::TEdit.

void owl::TRichEdit::EvChar ( uint  key,
uint  repeatCount,
uint  flags 
) [protected]

WM_CHAR handler to bypass TEdit's handler (which caters to validators).

Reimplemented from owl::TEdit.

References owl::TWindow::DefaultProcessing().

void owl::TRichEdit::EvChildInvalid ( HWND  ) [protected]

Handler for input validation message sent by parent.

Handle input validation message sent by parent.

Reimplemented from owl::TEdit.

uint owl::TRichEdit::EvGetDlgCode ( MSG *  msg) [protected]

WM_GETDLGCODE handler to bypass TEdit's handler (which caters to validators).

Reimplemented from owl::TEdit.

void owl::TRichEdit::EvKeyDown ( uint  key,
uint  repeatCount,
uint  flags 
) [protected]

WM_GETDLGCODE handler to bypass TEdit's handler (which caters to validators).

Reimplemented from owl::TEdit.

References owl::TWindow::DefaultProcessing().

void owl::TRichEdit::EvKillFocus ( HWND  hWndGetFocus) [protected]

WM_KILLFOCUS handler to bypass TEdit's handler (which caters to validators).

Reimplemented from owl::TEdit.

void owl::TRichEdit::EvSetFocus ( HWND  hWndLostFocus) [protected]

WM_SETFOCUS handler to bypass TEdit's handler (which caters to validators).

Reimplemented from owl::TEdit.

References owl::TWindow::DefaultProcessing().

int owl::TRichEdit::FindText ( uint  flags,
const TCharRange cr,
LPCTSTR  text 
)

Finds text within the rich edit control. The 'flags' parameter can be a combination of the following values:

  • FT_MATCHCASE Performs a case sensitiv search.
  • FT_MATCHWORD Matches whole words.

References FindText().

int owl::TRichEdit::FindText ( uint  flags,
const TFindText ft 
)

Finds text within the rich edit control. The 'flags' parameter can be a combination of the following values:

  • FT_MATCHCASE Performs a case sensitiv search.
  • FT_MATCHWORD Matches whole words.

References owl::TWindow::SendMessage().

ulong owl::TRichEdit::GetCharFormat ( TCharFormat cf,
bool  selection = false 
) const

Retrieves the current character formatting in an edit control. If 'selection' parameter is 'true', the attribute of the current selection is retrieved. Otherwise, the default formatting attribute is retrieved.

TWindow::TGetClassNameReturnType owl::TRichEdit::GetClassName ( ) [protected, virtual]

Returns name of predefined Windows edit class.

Reimplemented from owl::TEdit.

int owl::TRichEdit::GetLineFromPos ( int  charPos) const [virtual]

Return the line number associated with character index "CharPos".

From a multiline edit control, returns the line number on which the character position specified by charPos occurs. If charPos is greater than the position of the last character, the number of the last line is returned. If charPos is-1, the number of the line that contains the first selected character is returned. If there is no selection, the line containing the caret is returned.

Reimplemented from owl::TEdit.

ulong owl::TRichEdit::GetParaFormat ( TParaFormat pf) const

Retrieves the paragraph formatting of the current selection of the rich edit control.

Note:
If more than one paragraph is selected, the structure receives the attributes of the first paragraph, and the dwMask member specifies which attributes are consistent throughout the entire selection.
int owl::TRichEdit::GetSelectedText ( TCHAR *  buffer) const

Retrieves the currently-selected text of the rich edit control.

tstring owl::TRichEdit::GetSelectedText ( ) const

String-aware overload.

References GetSelection().

void owl::TRichEdit::GetSelection ( int &  startPos,
int &  endPos 
) const [virtual]

Retrieves the starting and ending character position of the selection in the rich edit control.

Reimplemented from owl::TEdit.

References GetSelRange().

virtual TRange owl::TRichEdit::GetSelection ( ) const [inline, virtual]

Functional style overload.

Reimplemented from owl::TEdit.

References owl::TEdit::GetSelection().

ulong owl::TRichEdit::GetSelectionType ( ) const

Returns the selection type of the rich edit control. Returns SEL_EMPTY if the selection is empty, or one or more of the following values:

  • SEL_TEXT Text
  • SEL_OBJECT At least one OLE object
  • SEL_MULTICHAR More than one character of text
  • SEL_MULTIOBJECT More than one OLE object
void owl::TRichEdit::GetSelRange ( TCharRange cr) const

Retrieves the starting and ending character positions of the selection of the richedit control.

void owl::TRichEdit::GetSubText ( TCHAR *  str,
int  startPos,
int  endPos 
) const [virtual]

Retrieves a specified range of text from the rich edit control. NB! Deprecated. Use GetTextRange instead.

Reimplemented from owl::TEdit.

References GetTextRange().

tstring owl::TRichEdit::GetTextRange ( const TRange r) const [virtual]

Retrieves a specified range of text from the rich edit control. The range is half-open; i.e. range [0,2) for "abc" returns "ab". An empty string is returned if either

  • the control is empty (no text), or
  • the range is invalid (empty or inverted), or
  • both startPos and endPos is beyond the extents of the actual text.

If endPos is beyond the valid range then it is limited to the valid range. A special case is the range [0, -1). It will return the full text.

Todo:
Must be tested

Reimplemented from owl::TEdit.

int owl::TRichEdit::GetTextRange ( const TCharRange cr,
TCHAR *  buffer 
) const

Retrieves a specified range of text from the rich edit control. NB! Deprecated. Use GetTextRange(const TRange&) instead.

References GetTextRange().

int owl::TRichEdit::GetTextRange ( TTextRange tr) const

Retrieves a specified range of text from the rich edit control. NB! Deprecated. Use GetTextRange(const TRange&) instead.

uint owl::TRichEdit::HasCharAttribute ( ulong  mask,
uint32  effects 
)

Function returns whether or not the current selection has a particular attribute. The 'mask' identifies the attribute of interest. The 'effects' contains the state of the attributes. The function returns

  • TFmtStatus::Yes : if the attribute is enabled.
  • TFmtStatus::No: if the attribute is absent.
  • TFmtStatus::Partly: if the attribute is partly present.

References No, Partly, and Yes.

bool owl::TRichEdit::HasSelection ( ) const

Returns true if the rich edit control has an active selection. Returns false otherwise.

References GetSelRange().

void owl::TRichEdit::HideSelection ( bool  hide,
bool  changeStyle 
)

Shows or hides the selection in the rich edit control. The 'hide' parameter specifies whether to hide or show the selection. If it is 'false' the selection is shown. Otherwise, the selection is hidden. The 'changeStyle' parameter specifies whether to change the control's ES_NOHIDESEL window style. If this parameter is 'false', the selection is temporarily shown or hidden. Otherwise, the style is changed. If this parameter is 'true' and the control has the focus, the selection is hidden or shown as appropriate.

References owl::TWindow::SendMessage().

void owl::TRichEdit::LimitText ( int  max) [virtual]

Sets an upper limit to the amount of text in the richedit control.

Reimplemented from owl::TEdit.

References owl::TWindow::SendMessage().

void owl::TRichEdit::Paste ( ) [virtual]

Inserts text from the Clipboard into the edit control at the current text insertion point (cursor position).

Reimplemented from owl::TEdit.

References owl::TWindow::SendMessage().

bool owl::TRichEdit::Read ( LPCTSTR  fileName = 0) [virtual]

Reads the contents of a previously specified file into the Editor. Returns true if read operation is successful. The caller is responsible for any error UI

Reimplemented from owl::TEditFile.

References owl::TEdit::Clear(), owl::TEdit::ClearModify(), owl::TEditFile::GetFileName(), and ReadFromStream().

bool owl::TRichEdit::ReadFromStream ( tistream &  is,
uint  format = SF_RTF 
)

< String-aware overload

int owl::TRichEdit::Search ( int  startPos,
LPCTSTR  text,
bool  caseSensitive = false,
bool  wholeWord = false,
bool  up = false 
) [virtual]

searches for and selects the given text and returns the offset of the text or -1 if the text is not found

Performs either a case-sensitive or case-insensitive search for the supplied text. If the text is found, the matching text is selected, and Search returns the position of the beginning of the matched text. If the text is not found in the edit control's text, Search returns -1. If -1 is passed as startPos, then the search starts from either the end or the beginning of the currently selected text, depending on the search direction.

Reimplemented from owl::TEdit.

References FindText(), GetSelection(), and SetSelection().

TColor owl::TRichEdit::SetBkgndColor ( const TColor bkColor = TColor::None)

Sets the background color of the rich edit control.

Note:
If 'TColor::None' is specified, the color is set to the window background system color.

Reimplemented from owl::TWindow.

References owl::TColor::None, and owl::TWindow::SendMessage().

bool owl::TRichEdit::SetCharFormat ( const TCharFormat cf,
uint  flags = SCF_SELECTION 
)

Sets the character formatting of a rich edit control. The 'flags' parameter can be one of the following:

  • SCF_SELECTION Applies the formatting to the current selection, or sets the default formatting if the selection is empty.
  • SCF_WORD Applies the formatting to the selected word or words. If the selection is empty but the insertion point is inside a word, the formatting is applied to the word. This value must be used in conjunction with the SCF_SELECTION value.

References owl::TWindow::SendMessage().

bool owl::TRichEdit::SetParaFormat ( const TParaFormat pf)

Sets the paragraph formatting of the current selection of the rich edit control.

References owl::TWindow::SendMessage().

bool owl::TRichEdit::SetSelection ( int  startPos,
int  endPos 
) [virtual]

Selects a range of characters in the rich edit control.

Reimplemented from owl::TEdit.

References SetSelRange().

int owl::TRichEdit::SetSelRange ( const TCharRange cr)

Selects a range of characters in the rich edit control.

References owl::TWindow::SendMessage().

void owl::TRichEdit::SetupWindow ( ) [protected, virtual]

Updates the list of filters describing files which can be opened by the rich edit control.

Reimplemented from owl::TEditFile.

Reimplemented in owl::TRichEditView.

References owl::TEditFile::GetFileData(), owl::TWindow::LoadString(), and owl::TOpenSaveDialog::TData::SetFilter().

bool owl::TRichEdit::ToggleCharAttribute ( ulong  mask,
uint32  effects 
)

Toggles a set of character attributes. The 'mask' identifies the attributes of interest while 'effects' identifies the state of the attributes.

References SetCharFormat(), and owl::TCharFormat::ToggleEffectsBit().

uint owl::TRichEdit::Transfer ( void *  buffer,
TTransferDirection  direction 
) [virtual]

Transfers state information for TEdit controls.

Transfers information for TEdit controls and sends information to the Validator if one exists, and if it has the transfer option set. Transfer can perform type conversion when validators are in place, for example, when TRangeValidator transfers integers. The return value is the size (in bytes) of the transfer data. Delegates to the Validator if there is one & it has the transfer option set, allowing the Validator to convert the text to/from the appropriate type. Else passes to base, TStatic. The return value is the size (in bytes) of the transfer data

Reimplemented from owl::TEdit.

bool owl::TRichEdit::Write ( LPCTSTR  fileName = 0) [virtual]

< String-aware overload

Reimplemented from owl::TEditFile.

References owl::TEdit::ClearModify(), and owl::TEditFile::GetFileName().


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