EditBox

multiline editor

class EditBox : EditWidgetBase {}

Constructors

this
this()

empty parameter list constructor - for usage by factory

this
this(string ID, dstring initialContent, ScrollBarMode hscrollbarMode, ScrollBarMode vscrollbarMode)

create with ID parameter

Destructor

~this
~this()
Undocumented in source.

Members

Functions

clearTokenHightlightColors
void clearTokenHightlightColors()

clear highlight colors

clientToTextPos
TextPosition clientToTextPos(Point pt)
Undocumented in source. Be warned that the author may not have intended to support it.
closeFindPanel
void closeFindPanel()

close find panel

createFindPanel
void createFindPanel(bool selectionOnly, bool replaceMode)

create find panel

drawClient
void drawClient(DrawBuf buf)
Undocumented in source. Be warned that the author may not have intended to support it.
drawExtendedArea
void drawExtendedArea(DrawBuf buf)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLineBackground
void drawLineBackground(DrawBuf buf, int lineIndex, Rect lineRect, Rect visibleRect)

override to custom highlight of line background

drawTabPositionMarks
void drawTabPositionMarks(DrawBuf buf, FontRef font, int lineIndex, Rect lineRect)
Undocumented in source. Be warned that the author may not have intended to support it.
drawWhiteSpaceMarks
void drawWhiteSpaceMarks(DrawBuf buf, FontRef font, dstring txt, int tabSize, Rect lineRect, Rect visibleRect)
Undocumented in source. Be warned that the author may not have intended to support it.
ensureCaretVisible
void ensureCaretVisible(bool center)
Undocumented in source. Be warned that the author may not have intended to support it.
findMaxTabMarkColumn
int findMaxTabMarkColumn(int lineIndex)

find max tab mark column position for line

fullContentSize
Point fullContentSize()

calculate full content size in pixels

getLeftPaneIconsPopupMenu
MenuItem getLeftPaneIconsPopupMenu(int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleAction
bool handleAction(Action a)
Undocumented in source. Be warned that the author may not have intended to support it.
handleCustomLineHighlight
CustomCharProps[] handleCustomLineHighlight(int line, dstring txt, CustomCharProps[] buf)

Custom text color and style highlight (using text highlight) support.

highlightLineRange
void highlightLineRange(DrawBuf buf, Rect lineRect, uint color, TextRange r)
Undocumented in source. Be warned that the author may not have intended to support it.
layout
void layout(Rect rc)

Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).

lineCount
int lineCount()
Undocumented in source. Be warned that the author may not have intended to support it.
measure
void measure(int parentWidth, int parentHeight)

measure

measureVisibleText
Point measureVisibleText()
Undocumented in source. Be warned that the author may not have intended to support it.
onDraw
void onDraw(DrawBuf buf)

Draw widget at its position to buffer

onHScroll
bool onHScroll(ScrollEvent event)

process horizontal scrollbar event

onLeftPaneMouseClick
bool onLeftPaneMouseClick(MouseEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
onVScroll
bool onVScroll(ScrollEvent event)

process vertical scrollbar event

setTokenHightlightColor
void setTokenHightlightColor(ubyte tokenCategory, uint color, bool underline, bool strikeThrough)

set highlight options for particular token category

textPosToClient
Rect textPosToClient(TextPosition p)
Undocumented in source. Be warned that the author may not have intended to support it.
updateHScrollBar
void updateHScrollBar()

update horizontal scrollbar widget position

updateMaxLineWidth
void updateMaxLineWidth()
Undocumented in source. Be warned that the author may not have intended to support it.
updateVScrollBar
void updateVScrollBar()

update verticat scrollbar widget position

Properties

maxFontSize
int maxFontSize [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
maxFontSize
int maxFontSize [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
minFontSize
int minFontSize [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
minFontSize
int minFontSize [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
showWhiteSpaceMarks
bool showWhiteSpaceMarks [@property getter]

when true, show marks for tabs and spaces at beginning and end of line, and tabs inside line

showWhiteSpaceMarks
bool showWhiteSpaceMarks [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_enableScrollAfterText
bool _enableScrollAfterText;
Undocumented in source.
_findPanel
FindPanel _findPanel;
Undocumented in source.
_firstVisibleLine
int _firstVisibleLine;
Undocumented in source.
_matchingBraces
TextRange _matchingBraces;
Undocumented in source.
_maxLineWidth
int _maxLineWidth;
Undocumented in source.
_numVisibleLines
int _numVisibleLines;
Undocumented in source.
_showWhiteSpaceMarks
bool _showWhiteSpaceMarks;
Undocumented in source.
_tokenHighlightColors
CustomCharProps[ubyte] _tokenHighlightColors;
Undocumented in source.
_visibleLines
dstring[] _visibleLines;
Undocumented in source.
_visibleLinesHighlights
CustomCharProps[][] _visibleLinesHighlights;
Undocumented in source.
_visibleLinesHighlightsBuf
CustomCharProps[][] _visibleLinesHighlightsBuf;
Undocumented in source.
_visibleLinesMeasurement
int[][] _visibleLinesMeasurement;
Undocumented in source.
_visibleLinesWidths
int[] _visibleLinesWidths;
Undocumented in source.

Inherited Members

From EditWidgetBase

_content
EditableContent _content;
Undocumented in source.
_lineHeight
int _lineHeight;
Undocumented in source.
_scrollPos
Point _scrollPos;
Undocumented in source.
_fixedFont
bool _fixedFont;
Undocumented in source.
_spaceWidth
int _spaceWidth;
Undocumented in source.
_leftPaneWidth
int _leftPaneWidth;
Undocumented in source.
_minFontSize
int _minFontSize;
Undocumented in source.
_maxFontSize
int _maxFontSize;
Undocumented in source.
_wantTabs
bool _wantTabs;
Undocumented in source.
_showLineNumbers
bool _showLineNumbers;
Undocumented in source.
_showModificationMarks
bool _showModificationMarks;
Undocumented in source.
_showIcons
bool _showIcons;
Undocumented in source.
_showFolding
bool _showFolding;
Undocumented in source.
_lineNumbersWidth
int _lineNumbersWidth;
Undocumented in source.
_modificationMarksWidth
int _modificationMarksWidth;
Undocumented in source.
_iconsWidth
int _iconsWidth;
Undocumented in source.
_foldingWidth
int _foldingWidth;
Undocumented in source.
_selectAllWhenFocusedWithTab
bool _selectAllWhenFocusedWithTab;
Undocumented in source.
_deselectAllWhenUnfocused
bool _deselectAllWhenUnfocused;
Undocumented in source.
_replaceMode
bool _replaceMode;
Undocumented in source.
_selectionColorFocused
uint _selectionColorFocused;
Undocumented in source.
_selectionColorNormal
uint _selectionColorNormal;
Undocumented in source.
_leftPaneBackgroundColor
uint _leftPaneBackgroundColor;
Undocumented in source.
_leftPaneBackgroundColor2
uint _leftPaneBackgroundColor2;
Undocumented in source.
_leftPaneBackgroundColor3
uint _leftPaneBackgroundColor3;
Undocumented in source.
_leftPaneLineNumberColor
uint _leftPaneLineNumberColor;
Undocumented in source.
_leftPaneLineNumberColorEdited
uint _leftPaneLineNumberColorEdited;
Undocumented in source.
_leftPaneLineNumberColorSaved
uint _leftPaneLineNumberColorSaved;
Undocumented in source.
_leftPaneLineNumberColorCurrentLine
uint _leftPaneLineNumberColorCurrentLine;
Undocumented in source.
_leftPaneLineNumberBackgroundColorCurrentLine
uint _leftPaneLineNumberBackgroundColorCurrentLine;
Undocumented in source.
_leftPaneLineNumberBackgroundColor
uint _leftPaneLineNumberBackgroundColor;
Undocumented in source.
_colorIconBreakpoint
uint _colorIconBreakpoint;
Undocumented in source.
_colorIconBookmark
uint _colorIconBookmark;
Undocumented in source.
_colorIconError
uint _colorIconError;
Undocumented in source.
_caretColor
uint _caretColor;
Undocumented in source.
_caretColorReplace
uint _caretColorReplace;
Undocumented in source.
_matchingBracketHightlightColor
uint _matchingBracketHightlightColor;
Undocumented in source.
_iconsPaneWidth
uint _iconsPaneWidth;
Undocumented in source.
_foldingPaneWidth
uint _foldingPaneWidth;
Undocumented in source.
_modificationMarksPaneWidth
uint _modificationMarksPaneWidth;
Undocumented in source.
_contentChanged
bool _contentChanged;

when true, call measureVisibileText on next layout

_copyCurrentLineWhenNoSelection
bool _copyCurrentLineWhenNoSelection;
Undocumented in source.
copyCurrentLineWhenNoSelection
bool copyCurrentLineWhenNoSelection [@property getter]

when true allows copy / cut whole current line if there is no selection

copyCurrentLineWhenNoSelection
bool copyCurrentLineWhenNoSelection [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
_showTabPositionMarks
bool _showTabPositionMarks;
Undocumented in source.
showTabPositionMarks
bool showTabPositionMarks [@property getter]

when true shows mark on tab positions in beginning of line

showTabPositionMarks
bool showTabPositionMarks [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
modifiedStateChange
Signal!ModifiedStateListener modifiedStateChange;

Modified state change listener (e.g. content has been saved, or first time modified after save)

contentChange
Signal!EditableContentChangeListener contentChange;

Signal to emit when editor content is changed

handleClientRectLayout
void handleClientRectLayout(Rect rc)

override to support modification of client rect after change, e.g. apply offset

lineCount
int lineCount()

override for multiline editors

_wordWrap
bool _wordWrap;
Undocumented in source.
wordWrap
bool wordWrap [@property getter]

true if word wrap mode is set

wordWrap
bool wordWrap [@property setter]

true if word wrap mode is set

wrapLine
void wrapLine(dstring line, int maxWidth)
Undocumented in source. Be warned that the author may not have intended to support it.
_span
LineSpan[] _span;

information about line span into several lines - in word wrap mode

updateLeftPaneWidth
void updateLeftPaneWidth()

override to add custom items on left panel

drawLeftPaneFolding
void drawLeftPaneFolding(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPaneIcon
void drawLeftPaneIcon(DrawBuf buf, Rect rc, LineIcon icon)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPaneIcons
void drawLeftPaneIcons(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPaneModificationMarks
void drawLeftPaneModificationMarks(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPaneLineNumbers
void drawLeftPaneLineNumbers(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
onLeftPaneMouseClick
bool onLeftPaneMouseClick(MouseEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneFoldingMouseClick
bool handleLeftPaneFoldingMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneModificationMarksMouseClick
bool handleLeftPaneModificationMarksMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneLineNumbersMouseClick
bool handleLeftPaneLineNumbersMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
getLeftPaneIconsPopupMenu
MenuItem getLeftPaneIconsPopupMenu(int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneIconsMouseClick
bool handleLeftPaneIconsMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneMouseClick
bool handleLeftPaneMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPane
void drawLeftPane(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
_popupMenu
MenuItem _popupMenu;
Undocumented in source.
popupMenu
MenuItem popupMenu [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
popupMenu
MenuItem popupMenu [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
onMenuItemAction
bool onMenuItemAction(Action action)
canShowPopupMenu
bool canShowPopupMenu(int x, int y)

returns true if widget can show popup (e.g. by mouse right click at point x,y)

canFocus
bool canFocus [@property getter]

returns true if widget is focusable and visible and enabled

isActionEnabled
bool isActionEnabled(Action action)

override to change popup menu items state

showPopupMenu
void showPopupMenu(int x, int y)

shows popup at (x,y)

onPopupMenuItem
void onPopupMenuItem(MenuItem item)
Undocumented in source. Be warned that the author may not have intended to support it.
getCursorType
uint getCursorType(int x, int y)

returns mouse cursor type for widget

wantTabs
bool wantTabs [@property getter]

when true, Tab / Shift+Tab presses are processed internally in widget (e.g. insert tab character) instead of focus change navigation.

wantTabs
bool wantTabs [@property setter]

sets tab size (in number of spaces)

showIcons
bool showIcons [@property getter]

when true, show icons like bookmarks or breakpoints at the left

showIcons
bool showIcons [@property setter]

when true, show icons like bookmarks or breakpoints at the left

showFolding
bool showFolding [@property getter]

when true, show folding controls at the left

showFolding
bool showFolding [@property setter]

when true, show folding controls at the left

showModificationMarks
bool showModificationMarks [@property getter]

when true, show modification marks for lines (whether line is unchanged/modified/modified_saved)

showModificationMarks
bool showModificationMarks [@property setter]

when true, show modification marks for lines (whether line is unchanged/modified/modified_saved)

showLineNumbers
bool showLineNumbers [@property getter]

when true, line numbers are shown

showLineNumbers
bool showLineNumbers [@property setter]

when true, line numbers are shown

readOnly
bool readOnly [@property getter]

readonly flag (when true, user cannot change content of editor)

readOnly
bool readOnly [@property setter]

sets readonly flag

replaceMode
bool replaceMode [@property getter]

replace mode flag (when true, entered character replaces character under cursor)

replaceMode
bool replaceMode [@property setter]

sets replace mode flag

useSpacesForTabs
bool useSpacesForTabs [@property getter]

when true, spaces will be inserted instead of tabs

useSpacesForTabs
bool useSpacesForTabs [@property setter]

set new Tab key behavior flag: when true, spaces will be inserted instead of tabs

tabSize
int tabSize [@property getter]

returns tab size (in number of spaces)

tabSize
int tabSize [@property setter]

sets tab size (in number of spaces)

supportsSmartIndents
bool supportsSmartIndents [@property getter]

true if smart indents are supported

smartIndents
bool smartIndents [@property getter]

true if smart indents are enabled

smartIndents
bool smartIndents [@property setter]

set smart indents enabled flag

smartIndentsAfterPaste
bool smartIndentsAfterPaste [@property getter]

true if smart indents are enabled

smartIndentsAfterPaste
bool smartIndentsAfterPaste [@property setter]

set smart indents enabled flag

content
EditableContent content [@property getter]

editor content object

_ownContent
bool _ownContent;

when _ownContent is false, _content should not be destroyed in editor destructor

content
EditableContent content [@property setter]

set content object

~this
~this()

free resources

updateMaxLineWidth
void updateMaxLineWidth()
Undocumented in source. Be warned that the author may not have intended to support it.
processSmartIndent
void processSmartIndent(EditOperation operation)
Undocumented in source. Be warned that the author may not have intended to support it.
onContentChange
void onContentChange(EditableContent content, EditOperation operation, TextRange rangeBefore, TextRange rangeAfter, Object source)
Undocumented in source. Be warned that the author may not have intended to support it.
_lastReportedModifiedState
bool _lastReportedModifiedState;
Undocumented in source.
text
dstring text [@property getter]

get widget text

text
dstring text [@property setter]

set text

text
UIString text [@property setter]

set text

_caretPos
TextPosition _caretPos;
Undocumented in source.
_selectionRange
TextRange _selectionRange;
Undocumented in source.
textPosToClient
Rect textPosToClient(TextPosition p)
Undocumented in source.
clientToTextPos
TextPosition clientToTextPos(Point pt)
Undocumented in source.
ensureCaretVisible
void ensureCaretVisible(bool center)
Undocumented in source.
measureVisibleText
Point measureVisibleText()
Undocumented in source.
_caretBlingingInterval
int _caretBlingingInterval;
Undocumented in source.
_caretTimerId
ulong _caretTimerId;
Undocumented in source.
_caretBlinkingPhase
bool _caretBlinkingPhase;
Undocumented in source.
_lastBlinkStartTs
long _lastBlinkStartTs;
Undocumented in source.
startCaretBlinking
void startCaretBlinking()
Undocumented in source. Be warned that the author may not have intended to support it.
stopCaretBlinking
void stopCaretBlinking()
Undocumented in source. Be warned that the author may not have intended to support it.
onTimer
bool onTimer(ulong id)

handle timer; return true to repeat timer event after next interval, false cancel timer

handleFocusChange
void handleFocusChange(bool focused, bool receivedFocusFromKeyboard)

override to handle focus changes

caretRect
Rect caretRect()

returns cursor rectangle

onThemeChanged
void onThemeChanged()

handle theme change: e.g. reload some themed resources

drawCaret
void drawCaret(DrawBuf buf)

draws caret

updateFontProps
void updateFontProps()
Undocumented in source. Be warned that the author may not have intended to support it.
correctCaretPos
void correctCaretPos()

when cursor position or selection is out of content bounds, fix it to nearest valid position

calcLineWidth
int calcLineWidth(dstring s)
Undocumented in source. Be warned that the author may not have intended to support it.
updateSelectionAfterCursorMovement
void updateSelectionAfterCursorMovement(TextPosition oldCaretPos, bool selecting)
Undocumented in source. Be warned that the author may not have intended to support it.
selectWordByMouse
void selectWordByMouse(int x, int y)
Undocumented in source. Be warned that the author may not have intended to support it.
selectLineByMouse
void selectLineByMouse(int x, int y, bool onSameLineOnly)
Undocumented in source. Be warned that the author may not have intended to support it.
updateCaretPositionByMouse
void updateCaretPositionByMouse(int x, int y, bool selecting)
Undocumented in source. Be warned that the author may not have intended to support it.
spacesForTab
dstring spacesForTab(int currentPos)

generate string of spaces, to reach next tab position

multipleLinesSelected
bool multipleLinesSelected()

returns true if one or more lines selected fully

_camelCasePartsAsWords
bool _camelCasePartsAsWords;
Undocumented in source.
removeSelectionTextIfSelected
bool removeSelectionTextIfSelected()
Undocumented in source. Be warned that the author may not have intended to support it.
getSelectedText
dstring getSelectedText()

returns current selection text (joined with LF when span over multiple lines)

getRangeText
dstring getRangeText(TextRange range)

returns text for specified range (joined with LF when span over multiple lines)

currentLineRange
TextRange currentLineRange [@property getter]

returns range for line with cursor

removeRangeText
bool removeRangeText(TextRange range)
Undocumented in source. Be warned that the author may not have intended to support it.
handleActionStateRequest
bool handleActionStateRequest(Action a)

override to handle specific actions state (e.g. change enabled state for supported actions)

handleAction
bool handleAction(Action a)
Undocumented in source. Be warned that the author may not have intended to support it.
spaceBefore
TextRange spaceBefore(TextPosition pos)
Undocumented in source. Be warned that the author may not have intended to support it.
indentLine
dstring indentLine(dstring src, bool back, TextPosition* cursorPos)

change line indent

indentRange
void indentRange(bool back)

indent / unindent range

findKeyAction
Action findKeyAction(uint keyCode, uint flags)

map key to action

isAZaz
bool isAZaz(dchar ch)
Undocumented in source. Be warned that the author may not have intended to support it.
onKeyEvent
bool onKeyEvent(KeyEvent event)

handle keys

onControlClick
void onControlClick()

Handle Ctrl + Left mouse click on text

_hoverTextPosition
TextPosition _hoverTextPosition;
Undocumented in source.
_hoverMousePosition
Point _hoverMousePosition;
Undocumented in source.
_hoverTimer
ulong _hoverTimer;
Undocumented in source.
_hoverTimeoutMillis
long _hoverTimeoutMillis;
Undocumented in source.
onHoverTimeout
void onHoverTimeout(Point pt, TextPosition pos)

override to handle mouse hover timeout in text

onHover
void onHover(Point pos)
Undocumented in source. Be warned that the author may not have intended to support it.
cancelHoverTimer
void cancelHoverTimer()
Undocumented in source. Be warned that the author may not have intended to support it.
onMouseEvent
bool onMouseEvent(MouseEvent event)

process mouse event; return true if event is processed by widget.

caretPos
TextPosition caretPos [@property getter]

returns caret position

setCaretPos
void setCaretPos(int line, int column, bool makeVisible, bool center)

change caret position and ensure it is visible

Meta