9#if !defined(OWL_RICHEDIT_H)
13#if defined(BI_HAS_PRAGMA_ONCE)
29#define CFM_ALL (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT |\
30 CFM_PROTECTED | CFM_SIZE | CFM_COLOR | CFM_FACE | \
31 CFM_OFFSET | CFM_CHARSET)
38#define PFM_ALL (PFM_ALIGNMENT|PFM_NUMBERING|PFM_OFFSET|PFM_OFFSETINDENT|\
39 PFM_RIGHTINDENT|PFM_STARTINDENT|PFM_TABSTOPS)
60 ulong mask = CFM_ALL);
79 TColor GetTextColor()
const;
82 void SetFontInfo(LOGFONT& lf)
const;
83 void GetFontInfo(
const LOGFONT& lf);
87 void SetWeight(
uint16 weigh);
88 void SetSpacing(
int16 spacing);
89 void SetBkColor(
const TColor& clr);
90 void SetLCID(LCID lcid);
91 void SetStyle(
int16 style);
92 void SetKerning(
uint16 kern);
93 void SetUnderlineType(
uint8 utype);
94 void SetAnimation(
uint8 anim);
95 void SetRevAuthor(
uint8 revav);
107 TCharRange(
int minValue = 0,
int maxValue = -1);
160 const TRect& renderArea,
const TRect& entireArea,
164 const TRect& renderArea,
const TRect& entireArea,
165 long firstChar,
long lastChar);
226 static int GetVersion(
bool force_old =
false);
246#if defined(_OWLDLL) || defined(BI_APP_DLL)
266 int x,
int y,
int w,
int h,
267 LPCTSTR fileName =
nullptr,
274 int x,
int y,
int w,
int h,
302 bool ToggleCharAttribute(
ulong mask,
uint32 effects);
303 bool ChangeCharPointSize(
int pointSizeDelta);
315 bool HasSelection()
const;
318 void HideSelection(
bool hide,
bool changeStyle);
319 ulong GetSelectionType()
const;
323 void GetSelection(
int& startPos,
int& endPos)
const override;
325 auto SetSelection(
int startPos,
int endPos) ->
bool override;
330 bool EnableAutoURL(
bool enable=
true);
331 int GetIMEMode()
const;
332 void SetLangOptions(
int options);
333 int GetLangOptions()
const;
334 void SetTextMode(
int mode);
335 int GetTextMode()
const;
336 void SetUndoLimit(
int maxnum);
337 void StopGroupTyping();
341 int GetTextLength()
const;
343 int GetTextRange(
const TCharRange &, LPTSTR buffer)
const;
344 int GetSelectedText(LPTSTR buffer)
const;
345 tstring GetSelectedText()
const;
352 auto GetTextRange(
const TRange&)
const ->
tstring override;
353 void GetSubText(LPTSTR textBuf,
int startPos,
int endPos)
const override;
354 auto Search(
int startPos, LPCTSTR text,
bool caseSensitive =
false,
bool wholeWord =
false,
bool up =
false) ->
int override;
355 int Search(
int startPos,
const tstring& text,
bool caseSensitive =
false,
bool wholeWord =
false,
bool up =
false)
356 {
return TEdit::Search(startPos, text, caseSensitive, wholeWord, up);}
357 void LimitText(
int maxValue)
override;
358 auto GetLineFromPos(
int charPos)
const ->
int override;
360 auto PosFromChar(
uint charIndex) ->
uint32 override;
364 int FindWordBreak(
uint code,
int start);
376 bool CanPaste(
uint format)
const;
377 bool CanRedo()
const;
378 int GetUndoName()
const;
379 int GetRedoName()
const;
381 void PasteSpecial(
uint format);
385 void Paste()
override;
394 bool DisplayBand(
TRect &);
395 int FormatRange(
const TFormatRange & range,
bool render =
true);
397 bool SetTargetDevice(HDC,
int lineWidth);
401 void RequestResize();
405 bool GetOleInterface(IRichEditOle * &)
const;
406 bool SetOleInterface(IRichEditOleCallback *);
410 uint GetFormat()
const;
411 void SetFormat(
uint fmt);
416 ulong GetEventMask()
const;
429 auto Read(LPCTSTR fileName =
nullptr) ->
bool override;
432 auto Write(LPCTSTR fileName =
nullptr) ->
bool override;
486 void FormatLines(
bool addEOL);
487 LPTSTR LockBuffer(
uint newSize = 0);
488 void UnlockBuffer(LPCTSTR,
bool =
false);
489 void SetTabStops(
int numTabs,
const int *);
490 HLOCAL GetMemHandle()
const;
491 void SetMemHandle(HLOCAL localMem);
492 uint GetPasswordChar()
const;
493 void SetPasswordChar(
uint ch);
494 void SetRectNP(
const TRect& frmtRect);
496 void SetLeftMargin(
uint16 margin);
497 void SetRightMargin(
uint16 margin);
498 void SetMarginUseFontInfo();
499 uint32 GetMargins()
const;
504 bool IsValid(
bool reportErr =
false);
506 void ValidatorError();
580 cbSize =
sizeof(::CHARFORMAT);
617 pfnCallback =
nullptr;
628 pfnCallback = callback;
660 memset(
reinterpret_cast<FORMATRANGE*
>(
this), 0,
sizeof(FORMATRANGE));
TCharRange encapsulates the CHARRANGE structure, which specifies a range of characters in a rich edit...
TCharRange(int minValue=0, int maxValue=-1)
Constructs a TCharRange structure initialized with the specified 'minValue' and 'maxValue' parameters...
TCharRange(const TEdit::TRange &r)
Class wrapper for management of color values.
static const TColor None
not-a-color
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
TDllLoader<> provides an easy way to load one instance of a DLL on demand.
virtual bool Write(LPCTSTR fileName=nullptr)
Saves the contents of the Editor to a file whose name is specified by FileName.
virtual bool Read(LPCTSTR fileName=nullptr)
Reads the contents of a previously specified file into the Editor.
TEditFile(TWindow *parent=nullptr, int id=0, LPCTSTR text=nullptr, int x=0, int y=0, int w=0, int h=0, LPCTSTR fileName=nullptr, TModule *module=nullptr)
Constructs a TEditFile window given the parent window, resource ID (Id), text, file name,...
TEditStream encapsulates the EDITSTREAM structure, which contains information about a data stream use...
TEditStream()
Constructs a default 'TEditStream' object.
TFindText encapsulates the FINDTEXT structure, which contains information about text to search for in...
TFindText(const TCharRange &range, const tstring &text)
Constructs a 'TFindText' describing the text to search for and the range of the search using the 'tex...
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TRect is a mathematical class derived from tagRect.
TRichEdit encapsulates a rich edit control, a window in which a user can enter, edit and format text.
bool SetCharFormat(const TCharFormat &, uint flags=SCF_SELECTION)
Sets the character formatting of a rich edit control.
void CeEditClear(TCommandEnabler &commandHandler)
void CeHasSelect(TCommandEnabler &commandHandler)
void EvKillFocus(HWND hWndGetFocus)
WM_KILLFOCUS handler to bypass TEdit's handler (which caters to validators).
void CeEditPaste(TCommandEnabler &commandHandler)
void CeEditUndo(TCommandEnabler &commandHandler)
void CmEditDelete()
Handler of the CM_EDITDELETE command - invokes the 'DeleteSelection' method.
TFmtStatus
Enumeration of flags returned when querrying a RichEdit about a particular character attribute for a ...
@ Partly
Part of the selection has the attribute.
@ Yes
The attribute is absent from the selection.
@ No
The whole selection has the attribute.
void CmEditClear()
Handler of the CM_EDITCLEAR command - invokes the 'Clear' method.
bool SetParaFormat(const TParaFormat &)
Sets the paragraph formatting of the current selection of the rich edit control.
ulong GetParaFormat(TParaFormat &) const
Retrieves the paragraph formatting of the current selection of the rich edit control.
void CmEditUndo()
Handler of the CM_EDITUNDO command - invokes the 'Undo' method.
void CmEditPaste()
Handler of the CM_EDITPASTE command - invokes the 'Paste' method.
int Search(int startPos, const tstring &text, bool caseSensitive=false, bool wholeWord=false, bool up=false)
TColor SetBkgndColor(const TColor &=TColor::None)
Sets the background color of the rich edit control.
void EvSetFocus(HWND hWndLostFocus)
WM_SETFOCUS handler to bypass TEdit's handler (which caters to validators).
auto GetWindowClassName() -> TWindowClassName override
Returns name of predefined Windows edit class.
void CmEditCopy()
Handler of the CM_EDITCOPY command - invokes the'Copy' method.
void EvKeyDown(uint key, uint repeatCount, uint flags)
WM_GETDLGCODE handler to bypass TEdit's handler (which caters to validators).
TRichEdit(TWindow *parent, int id, LPCTSTR text, int x, int y, int w, int h, LPCTSTR fileName=nullptr, TModule *module=nullptr)
Constructor for a TRichEdit object.
void SetupWindow() override
Updates the list of filters describing files which can be opened by the rich edit control.
void EvChar(uint key, uint repeatCount, uint flags)
WM_CHAR handler to bypass TEdit's handler (which caters to validators).
int FindText(uint flags, const TCharRange &r, const tstring &text)
uint EvGetDlgCode(const MSG *)
WM_GETDLGCODE handler to bypass TEdit's handler (which caters to validators).
ulong GetCharFormat(TCharFormat &, bool selection=false) const
Retrieves the current character formatting in an edit control.
void CmEditCut()
Handler of the CM_EDITCUT command - Invokes the 'Cut' method.
static int GetVersion(bool force_old=false)
TTextRange encapsulates the TEXTRANGE structure, which contains information about a range of text in ...
TTextRange()
Constructs a default 'TTextRange' structure with the data members describing the range and text initi...
A streamable class, TValidator defines an abstract data validation object.
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition of classes for CommonControl encapsulation.
Definition of class TEditFile, a text edit which can find/replace and read/write from/to a file.
#define DECLARE_STREAMABLE_OWL(cls, ver)
#define DECLARE_STREAMABLE_INLINES(cls)
bool DeleteSelection()
Deletes the currently selected text, and returns false if no text is selected.
void Cut()
Deletes the currently selected text and copies it into the Clipboard.
virtual void GetSelection(int &startPos, int &endPos) const
Return the starting and ending positions of the selected text.
TDllLoader< TRichEditModule > TRichEditDll
TRichEditDll is a simple object which takes advantages of OWL's TDllLoader to ensure that only one co...
void Copy()
Copies the currently selected text into the Clipboard.
void Undo()
Undoes the last edit.
void Clear() override
Override TStatic virtual member functions.
virtual int Search(int startPos, LPCTSTR text, bool caseSensitive=false, bool wholeWord=false, bool up=false)
searches for and selects the given text and returns the offset of the text or -1 if the text is not f...
virtual bool SetSelection(int startPos, int endPos)
Select the characters in the range "startPos .. endPos".
TModule(const tstring &name, bool shouldLoad=true, bool mustLoad=true, bool addToList=true)
Constructs a TModule object that is used as an alias for a DLL.
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Object Windows Library (OWLNext Core).
Definition of class TRichEdit.
Represents a half-open range of positions in the edit control, e.g.