|
| JTextEditor (const Type type, JStyledText *text, const bool ownsText, JFontManager *fontManager, const bool breakCROnly, const JColorID caretColor, const JColorID selectionColor, const JColorID outlineColor, const JColorID wsColor, const JCoordinate width) |
|
| JTextEditor (const JTextEditor &source, JStyledText *text) |
|
| ~JTextEditor () override |
|
Type | GetType () const |
|
bool | IsReadOnly () const |
|
bool | WillBreakCROnly () const |
|
void | SetBreakCROnly (const bool breakCROnly) |
|
JStyledText * | GetText () |
|
const JStyledText & | GetText () const |
|
JStringMatch | SearchForward (const JRegex ®ex, const bool entireWord, const bool wrapSearch, bool *wrapped) |
|
JStringMatch | SearchBackward (const JRegex ®ex, const bool entireWord, const bool wrapSearch, bool *wrapped) |
|
JStringMatch | SelectionMatches (const JRegex ®ex, const bool entireWord) |
|
bool | ReplaceAll (const JRegex ®ex, const bool entireWord, const JString &replaceStr, JInterpolate *interpolator, const bool preserveCase, const bool restrictToSelection=false) |
|
bool | SearchForward (std::function< bool(const JFont &)> match, const bool wrapSearch, bool *wrapped) |
|
bool | SearchBackward (std::function< bool(const JFont &)> match, const bool wrapSearch, bool *wrapped) |
|
virtual bool | TEHasSearchText () const =0 |
|
JIndex | GetInsertionCharIndex () const |
|
JStringIterator * | GetConstIteratorAtInsertionIndex () const |
|
void | DisposeConstIterator (JStringIterator *iter) const |
|
bool | GetCaretLocation (JIndex *charIndex) const |
|
void | SetCaretLocation (const JIndex charIndex) |
|
void | SetCaretLocation (const JPoint &pt) |
|
bool | HasSelection () const |
|
bool | GetSelection (JCharacterRange *range) const |
|
bool | GetSelection (JString *text) const |
|
bool | GetSelection (JString *text, JRunArray< JFont > *style) const |
|
void | SetSelection (const JCharacterRange &range, const bool needCaretBcast=true) |
|
bool | TEScrollToSelection (const bool centerInDisplay) |
|
void | GoToBeginningOfLine () |
|
void | GoToEndOfLine () |
|
JFont | GetCurrentFont () const |
|
void | SetCurrentFontName (const JString &name) |
|
void | SetCurrentFontSize (const JSize size) |
|
void | SetCurrentFontBold (const bool bold) |
|
void | SetCurrentFontItalic (const bool italic) |
|
void | SetCurrentFontUnderline (const JSize count) |
|
void | SetCurrentFontStrike (const bool strike) |
|
void | SetCurrentFontColor (const JColorID color) |
|
void | SetCurrentFontStyle (const JFontStyle &style) |
|
void | SetCurrentFont (const JFont &font) |
|
bool | CleanRightMargin (const bool coerce) |
|
JCoordinate | GetDefaultTabWidth () const |
|
void | SetDefaultTabWidth (const JCoordinate width) |
|
void | TabSelectionLeft (const JSize tabCount=1, const bool force=false) |
|
void | TabSelectionRight (const JSize tabCount=1) |
|
void | CleanAllWhitespace (const bool align) |
|
void | CleanSelectedWhitespace (const bool align) |
|
void | AnalyzeWhitespace (JSize *tabWidth) |
|
bool | WillShowWhitespace () const |
|
void | ShouldShowWhitespace (const bool show) |
|
bool | WillAlwaysShowSelection () const |
|
void | ShouldAlwaysShowSelection (const bool show) |
|
bool | WillMoveToFrontOfText () const |
|
void | ShouldMoveToFrontOfText (const bool moveToFront) |
|
JSize | GetLineCount () const |
|
JIndex | GetLineCharStart (const JIndex lineIndex) const |
|
JIndex | GetLineCharEnd (const JIndex lineIndex) const |
|
JIndex | GetLineForChar (const JIndex charIndex) const |
|
void | GoToLine (const JIndex lineIndex) |
|
void | SelectLine (const JIndex lineIndex) |
|
JCoordinate | GetLineTop (const JIndex lineIndex) const |
|
JCoordinate | GetLineBottom (const JIndex lineIndex) const |
|
JSize | GetLineHeight (const JIndex lineIndex) const |
|
JIndex | CRLineIndexToVisualLineIndex (const JIndex crLineIndex) const |
|
JIndex | VisualLineIndexToCRLineIndex (const JIndex visualLineIndex) const |
|
JCoordinate | GetCharLeft (const JIndex charIndex) const |
|
JCoordinate | GetCharRight (const JIndex charIndex) const |
|
JIndex | GetColumnForChar (const JIndex charIndex) const |
|
void | GoToColumn (const JIndex lineIndex, const JIndex columnIndex) |
|
void | DeleteSelection () |
|
void | SelectAll () |
|
void | Cut () |
|
void | Copy () const |
|
void | Paste () |
|
void | Paste (const JString &text, const JRunArray< JFont > *style=nullptr) |
|
bool | GetClipboard (JString *text, JRunArray< JFont > *style=nullptr) const |
|
void | Paginate (const JCoordinate pageHeight, JArray< JCoordinate > *breakpts) const |
|
void | Print (JPagePrinter &p) |
|
JTEKeyHandler * | GetKeyHandler () const |
|
void | SetKeyHandler (JTEKeyHandler *handler) |
|
bool | AllowsDragAndDrop () const |
|
void | ShouldAllowDragAndDrop (const bool allow) |
|
JCoordinate | TEGetMinPreferredGUIWidth () const |
|
JCoordinate | TEGetLeftMarginWidth () const |
|
void | TESetLeftMarginWidth (const JCoordinate width) |
|
JColorID | GetCaretColor () const |
|
void | SetCaretColor (const JColorID color) |
|
JColorID | GetSelectionColor () const |
|
void | SetSelectionColor (const JColorID color) |
|
JColorID | GetSelectionOutlineColor () const |
|
void | SetSelectionOutlineColor (const JColorID color) |
|
JColorID | GetWhitespaceColor () const |
|
void | SetWhitespaceColor (const JColorID color) |
|
CaretMode | GetCaretMode () const |
|
void | SetCaretMode (const CaretMode mode) |
|
JFontManager * | TEGetFontManager () const |
|
| JBroadcaster () |
|
virtual | ~JBroadcaster () |
|
JBroadcaster & | operator= (const JBroadcaster &source) |
|
bool | HasSenders () const |
|
JSize | GetSenderCount () const |
|
bool | HasRecipients () const |
|
JSize | GetRecipientCount () const |
|
virtual JString | ToString () const |
|
template<class T > |
void | ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f) |
|
|
bool | TEIsActive () const |
|
void | TEActivate () |
|
void | TEDeactivate () |
|
bool | TESelectionIsActive () const |
|
void | TEActivateSelection () |
|
void | TEDeactivateSelection () |
|
bool | TECaretIsVisible () const |
|
void | TEShowCaret () |
|
void | TEHideCaret () |
|
void | SetType (const Type type) |
|
void | RecalcAll (const bool broadcastCaretMessages=true) |
|
JArray< bool > | GetCmdStatus (JString *crmActionText, JString *crm2ActionText, bool *isReadOnly) const |
|
void | TEDraw (JPainter &p, const JRect &rect) |
|
virtual void | TEDrawInMargin (JPainter &p, const JPoint &topLeft, const LineGeometry &geom, const JIndex lineIndex) |
|
bool | TEWillDragAndDrop (const JPoint &pt, const bool extendSelection, const bool dropCopy) const |
|
void | TEHandleMouseDown (const JPoint &pt, const JSize clickCount, const bool extendSelection, const bool partialWord) |
|
void | TEHandleMouseDrag (const JPoint &pt) |
|
void | TEHandleMouseUp () |
|
bool | TEHitSamePart (const JPoint &pt1, const JPoint &pt2) const |
|
virtual bool | TEBeginDND ()=0 |
|
void | TEDNDFinished () |
|
void | TEHandleDNDEnter () |
|
void | TEHandleDNDHere (const JPoint &pt, const bool dropOnSelf) |
|
void | TEHandleDNDLeave () |
|
void | TEHandleDNDDrop (const JPoint &pt, const bool dropOnSelf, const bool dropCopy) |
|
virtual void | TEPasteDropData ()=0 |
|
bool | TEIsDragging () const |
|
bool | TEHandleKeyPress (const JUtf8Character &key, const bool selectText, const CaretMotion motion, const bool deleteToTabStop) |
|
JCoordinate | TEGetBoundsWidth () const |
|
void | TESetBoundsWidth (const JCoordinate width) |
|
virtual void | TERefresh ()=0 |
|
virtual void | TERefreshRect (const JRect &rect)=0 |
|
void | TERefreshLines (const JIndex first, const JIndex last) |
|
virtual void | TEUpdateDisplay () |
|
virtual void | TERedraw ()=0 |
|
virtual void | TESetGUIBounds (const JCoordinate w, const JCoordinate h, const JCoordinate changeY)=0 |
|
virtual bool | TEWidthIsBeyondDisplayCapacity (const JSize width) const =0 |
|
virtual bool | TEScrollToRect (const JRect &rect, const bool centerInDisplay)=0 |
|
virtual bool | TEScrollForDrag (const JPoint &pt)=0 |
|
virtual bool | TEScrollForDND (const JPoint &pt)=0 |
|
virtual void | TESetVertScrollStep (const JCoordinate vStep)=0 |
|
virtual void | TEUpdateClipboard (const JString &text, const JRunArray< JFont > &style) const =0 |
|
virtual bool | TEGetClipboard (JString *text, JRunArray< JFont > *style) const =0 |
|
virtual void | TECaretShouldBlink (const bool blink)=0 |
|
virtual JCoordinate | GetTabWidth (const JIndex charIndex, const JCoordinate x) const |
|
virtual JCoordinate | GetPrintHeaderHeight (JPagePrinter &p) const |
|
virtual JCoordinate | GetPrintFooterHeight (JPagePrinter &p) const |
|
virtual void | DrawPrintHeader (JPagePrinter &p, const JCoordinate headerHeight) |
|
virtual void | DrawPrintFooter (JPagePrinter &p, const JCoordinate footerHeight) |
|
bool | GetCaretLocation (CaretLocation *caretLoc) const |
|
void | SetCaretLocation (const JStyledText::TextIndex &caretLoc) |
|
void | SetCaretLocation (const CaretLocation &caretLoc) |
|
CaretLocation | CalcCaretLocation (const JPoint &pt) const |
|
CaretLocation | CalcCaretLocation (const JStyledText::TextIndex &index) const |
|
bool | PointInSelection (const JPoint &pt) const |
|
void | MoveCaretVert (const JInteger deltaLines) |
|
JIndex | GetColumnForChar (const CaretLocation &caretLoc) const |
|
JStyledText::TextIndex | GetInsertionIndex () const |
|
JStyledText::TextIndex | GetLineStart (const JIndex lineIndex) const |
|
JStyledText::TextIndex | GetLineEnd (const JIndex lineIndex) const |
|
JStyledText::TextCount | GetLineLength (const JIndex lineIndex) const |
|
bool | GetSelection (JStyledText::TextRange *range) const |
|
void | SetSelection (const JStyledText::TextRange &range, const bool needCaretBcast=true, const bool ignoreCopyWhenSelect=false) |
|
void | TEGetDoubleClickSelection (const JStyledText::TextIndex &charIndex, const bool partialWord, const bool dragging, JStyledText::TextRange *range) const |
|
void | SetAllFontNameAndSize (const JString &name, const JSize size, const JCoordinate tabWidth, const bool breakCROnly, const bool clearUndo) |
|
void | ReplaceSelection (const JStringMatch &match, const JString &replaceStr, JInterpolate *interpolator, const bool preserveCase) |
|
void | Receive (JBroadcaster *sender, const Message &message) override |
|
void | ReceiveGoingAway (JBroadcaster *sender) override |
|
| JBroadcaster (const JBroadcaster &source) |
|
void | ListenTo (const JBroadcaster *sender) |
|
void | StopListening (const JBroadcaster *sender) |
|
void | ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember) |
|
void | StopListening (const JBroadcaster *sender, const std::type_info &messageType) |
|
template<class T > |
void | Send (JBroadcaster *recipient, const T &message) |
|
template<class T > |
void | Broadcast (const T &message) |
|
void | SendWithFeedback (JBroadcaster *recipient, Message *message) |
|
void | BroadcastWithFeedback (Message *message) |
|
virtual void | ReceiveWithFeedback (JBroadcaster *sender, Message *message) |
|
Class to edit styled text. This class only manages the view (layout
and caret location / selection) and controller (pointer and key
actions). The underlying JStyledText maintains the model (data
and styles).
The only functions that are shadowed from JStyledText are those
that perform operations based on the view, e.g, modify the currently
selected text / styles. Modifications can always safely be done
directly on the JStyledText, assuming you have the required data.
When the text ends with a newline, we have to draw the caret on the
next line. This is a special case because (charIndex == bufLength+1)
would normally catch this. We handle this special case internally
rather than appending an extra item to itsLineStarts because this keeps
the issue internal rather than forcing clients to deal with it.
Derived classes must implement the following functions:
TERefresh
Put an update event in the queue to redraw the text.
TERefreshRect
Put an update event in the queue to redraw part of the text.
TEUpdateDisplay
Redraw whatever was requested by TERefresh() and TERefreshRect().
(This is not pure virtual because some systems automatically
update the window after each event.)
TERedraw
Redraw the text immediately.
TESetGUIBounds
Set the bounds of the GUI object to match our size. The original
height and vertical position of the change can be used to update
scrolltabs. If change position is negative, don't update the
scrolltabs.
TEWidthIsBeyondDisplayCapacity
Returns true if the given bounds width is too wide for the
current graphics system to handle. If so, breakCROnly is
turned off.
TEScrollToRect
Scroll the text to make the given rectangle visible, possibly
centering it in the middle of the display. Return true
if scrolling was necessary.
TEScrollForDrag
Scroll the text to make the given point visible. Return true
if scrolling was necessary.
TEScrollForDND
Same as TEScrollForDrag(), but separate, since some frameworks
do the scrolling automatically.
TESetVertScrollStep
Set the vertical step size and page context used when scrolling
the text.
TECaretShouldBlink
If blink is true, reset the timer and make the caret blink by
calling TEShow/HideCaret(). Otherwise, call TEHideCaret().
The derived class constructor must call TECaretShouldBlink(true)
because it is pure virtual for us.
TEUpdateClipboard
Update the system clipboard with the given text/style.
TEGetClipboard
Returns true if there is something pasteable on the system
clipboard.
TEBeginDND
Returns true if it is able to start a Drag-And-Drop session
with the OS. From then on, the derived class should call the
TEHandleDND*() functions. It must also call TEDNDFinished()
when the drag ends. If TEBeginDND() returns false, then we
will manage an internal DND session. In this case, the derived
class should continue to call the usual TEHandleMouse*()
functions.
TEPasteDropData
Get the data that was dropped and use Paste(text,style)
to insert it. (Before this is called, the insertion point
is set so that Paste() will work correctly.)
TEHasSearchText
Return true if the user has entered any text for which to search.
To draw page headers and footers while printing, override the
following routines:
GetPrintHeaderHeight
Return the height required for the page header.
DrawPrintHeader
Draw the page header. JTable will lock the header afterwards.
GetPrintFooterHeight
Return the height required for the page footer.
DrawPrintFooter
Draw the page footer. JTable will lock the footer afterwards.
The default implementation of tabs rounds the location up to the nearest
multiple of itsDefTabWidth. To implement non-uniform tabs or tabs on a
line-by-line basis, override the following function:
GetTabWidth
Given the index of the tab character (charIndex) and the horizontal
position on the line (in pixels) where the tab character starts (x),
return the width of the tab character.
void JTextEditor::AnalyzeWhitespace |
( |
JSize * |
tabWidth | ) |
|
Check all indent whitespace.
If default is tabs, check for indent containing spaces. Allow up to N-1 spaces at the end of the line, where N = tab width.
If default is spaces, check for any indent containing tabs.
If mixed indentation, show whitespace. Set mode based on majority of indentation.
Updates tabWidth value if it decides that spaces should be used for indentation.