EditWidgetBase

base for all editor widgets

class EditWidgetBase : ScrollWidgetBase , EditableContentListener , MenuItemActionHandler {}

Constructors

this
this(string ID, ScrollBarMode hscrollbarMode, ScrollBarMode vscrollbarMode)
Undocumented in source.

Destructor

~this
~this()

free resources

Members

Functions

calcLineWidth
int calcLineWidth(dstring s)
Undocumented in source. Be warned that the author may not have intended to support it.
canShowPopupMenu
bool canShowPopupMenu(int x, int y)

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

cancelHoverTimer
void cancelHoverTimer()
Undocumented in source. Be warned that the author may not have intended to support it.
caretRect
Rect caretRect()

returns cursor rectangle

clearSelection
void clearSelection()

clears selection (don't change text, just unselect)

clientToTextPos
TextPosition clientToTextPos(Point pt)
Undocumented in source.
correctCaretPos
void correctCaretPos()

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

drawCaret
void drawCaret(DrawBuf buf)

draws caret

drawLeftPane
void drawLeftPane(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
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.
drawLeftPaneLineNumbers
void drawLeftPaneLineNumbers(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.
ensureCaretVisible
void ensureCaretVisible(bool center)
Undocumented in source.
explode
dstring[] explode(dstring str, dchar[] splitChars)

Divide (and conquer) text into words

findKeyAction
Action findKeyAction(uint keyCode, uint flags)

map key to action

findWrapLine
int findWrapLine(TextPosition textPos)

Based on a TextPosition, finds which wrapLine it is on for its current line

findWrapPoint
int findWrapPoint(dstring text)

Finds good visual wrapping point for string

getCursorType
uint getCursorType(int x, int y)

returns mouse cursor type for widget

getLeftPaneIconsPopupMenu
MenuItem getLeftPaneIconsPopupMenu(int line)
Undocumented in source. Be warned that the author may not have intended to support it.
getRangeText
dstring getRangeText(TextRange range)

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

getSelectedText
dstring getSelectedText()

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

getSpan
LineSpan getSpan(int lineNumber)

Returns LineSpan for line based on actual line number

handleAction
bool handleAction(Action a)
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)

handleClientRectLayout
void handleClientRectLayout(Rect rc)

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

handleEditorStateChange
void handleEditorStateChange()

updates editorStateChange with recent position

handleFocusChange
void handleFocusChange(bool focused, bool receivedFocusFromKeyboard)

override to handle focus changes

handleLeftPaneFoldingMouseClick
bool handleLeftPaneFoldingMouseClick(MouseEvent event, Rect rc, 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.
handleLeftPaneLineNumbersMouseClick
bool handleLeftPaneLineNumbersMouseClick(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.
handleLeftPaneMouseClick
bool handleLeftPaneMouseClick(MouseEvent event, Rect rc, int line)
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

isActionEnabled
bool isActionEnabled(Action action)

override to change popup menu items state

lineCount
int lineCount()

override for multiline editors

lineSpanIterate
void lineSpanIterate(void delegate(LineSpan curSpan) iterator)

Simple way of iterating through _span

measureVisibleText
Point measureVisibleText()
Undocumented in source.
measureWrappedText
int measureWrappedText(dstring text)

Calls measureText for word wrap

multipleLinesSelected
bool multipleLinesSelected()

returns true if one or more lines selected fully

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.
onControlClick
void onControlClick()

Handle Ctrl + Left mouse click on text

onHover
void onHover(Point pos)
Undocumented in source. Be warned that the author may not have intended to support it.
onHoverTimeout
void onHoverTimeout(Point pt, TextPosition pos)

override to handle mouse hover timeout in text

onKeyEvent
bool onKeyEvent(KeyEvent event)

handle keys

onLeftPaneMouseClick
bool onLeftPaneMouseClick(MouseEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
onMenuItemAction
bool onMenuItemAction(Action action)
onMouseEvent
bool onMouseEvent(MouseEvent event)

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

onPopupMenuItem
void onPopupMenuItem(MenuItem item)
Undocumented in source. Be warned that the author may not have intended to support it.
onThemeChanged
void onThemeChanged()

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

onTimer
bool onTimer(ulong id)

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

processSmartIndent
void processSmartIndent(EditOperation operation)
Undocumented in source. Be warned that the author may not have intended to support it.
removeRangeText
bool removeRangeText(TextRange range)
Undocumented in source. Be warned that the author may not have intended to support it.
removeSelectionTextIfSelected
bool removeSelectionTextIfSelected()
Undocumented in source. Be warned that the author may not have intended to support it.
replaceSelectionText
void replaceSelectionText(dstring newText)
Undocumented in source. Be warned that the author may not have intended to support it.
selectAll
void selectAll()

Select whole text

selectLineByMouse
void selectLineByMouse(int x, int y, bool onSameLineOnly)
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.
setCaretPos
void setCaretPos(int line, int column, bool makeVisible, bool center)

change caret position and ensure it is visible

setFocus
Widget setFocus(FocusReason reason)

sets focus to this widget or suitable focusable child, returns previously focused widget

setTextToHighlight
void setTextToHighlight(dstring pattern, uint textToHighlightOptions)

set text to highlight -- e.g. for search

showPopupMenu
void showPopupMenu(int x, int y)

shows popup at (x,y)

spaceBefore
TextRange spaceBefore(TextPosition pos)
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

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.
textPosToClient
Rect textPosToClient(TextPosition p)
Undocumented in source.
updateCaretPositionByMouse
void updateCaretPositionByMouse(int x, int y, bool selecting)
Undocumented in source. Be warned that the author may not have intended to support it.
updateFontProps
void updateFontProps()
Undocumented in source. Be warned that the author may not have intended to support it.
updateLeftPaneWidth
void updateLeftPaneWidth()

override to add custom items on left panel

updateMaxLineWidth
void updateMaxLineWidth()
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.
wordWrapMouseOffset
TextPosition wordWrapMouseOffset(int x, int y)

Used instead of using clientToTextPos for mouse input when in word wrap mode

wordWrapRefresh
void wordWrapRefresh()

Override for EditBox

wrapLine
dstring[] wrapLine(dstring str, int lineNumber)

Divides up a string for word wrapping, sets info in _span

wrapsUpTo
int wrapsUpTo(int line)

Returns number of visible wraps up to a line (not including the first wrapLines themselves)

Properties

canFocus
bool canFocus [@property getter]

returns true if widget is focusable and visible and enabled

caretPos
TextPosition caretPos [@property getter]

returns caret position

content
EditableContent content [@property setter]

set content object

content
EditableContent content [@property getter]

editor content object

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.
currentLineRange
TextRange currentLineRange [@property getter]

returns range for line with cursor

readOnly
bool readOnly [@property setter]

sets readonly flag

readOnly
bool readOnly [@property getter]

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

replaceMode
bool replaceMode [@property setter]

sets replace mode flag

replaceMode
bool replaceMode [@property getter]

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

selectionRange
TextRange selectionRange [@property setter]

sets current selection range

selectionRange
TextRange selectionRange [@property getter]

returns current selection range

showCaretBlinking
bool showCaretBlinking [@property getter]

when true, enables caret blinking, otherwise it's always visible

showCaretBlinking
bool showCaretBlinking [@property setter]

when true, enables caret blinking, otherwise it's always visible

showFolding
bool showFolding [@property setter]

when true, show folding controls at the left

showFolding
bool showFolding [@property getter]

when true, show folding controls at the left

showIcons
bool showIcons [@property setter]

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

showIcons
bool showIcons [@property getter]

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

showLineNumbers
bool showLineNumbers [@property getter]

when true, line numbers are shown

showLineNumbers
bool showLineNumbers [@property setter]

when true, line numbers are shown

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)

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

when true shows mark on tab positions in beginning of line

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

supportsSmartIndents
bool supportsSmartIndents [@property getter]

true if smart indents are supported

tabSize
int tabSize [@property getter]

returns tab size (in number of spaces)

tabSize
int tabSize [@property setter]

sets tab size (in number of spaces)

text
dstring text [@property getter]

get widget text

text
dstring text [@property setter]

set text

text
UIString text [@property setter]

set text

textToHighlight
dstring textToHighlight [@property getter]

text pattern to highlight - e.g. for search

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

wantTabs
bool wantTabs [@property setter]

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 getter]

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

wordWrap
bool wordWrap [@property setter]

true if word wrap mode is set

wordWrap
bool wordWrap [@property getter]

true if word wrap mode is set

Static functions

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

Variables

_camelCasePartsAsWords
bool _camelCasePartsAsWords;
Undocumented in source.
_caretBlingingInterval
int _caretBlingingInterval;
Undocumented in source.
_caretBlinkingPhase
bool _caretBlinkingPhase;
Undocumented in source.
_caretBlinks
bool _caretBlinks;
Undocumented in source.
_caretColor
uint _caretColor;
Undocumented in source.
_caretColorReplace
uint _caretColorReplace;
Undocumented in source.
_caretPos
TextPosition _caretPos;
Undocumented in source.
_caretTimerId
ulong _caretTimerId;
Undocumented in source.
_colorIconBookmark
uint _colorIconBookmark;
Undocumented in source.
_colorIconBreakpoint
uint _colorIconBreakpoint;
Undocumented in source.
_colorIconError
uint _colorIconError;
Undocumented in source.
_content
EditableContent _content;
Undocumented in source.
_contentChanged
bool _contentChanged;

when true, call measureVisibileText on next layout

_copyCurrentLineWhenNoSelection
bool _copyCurrentLineWhenNoSelection;
Undocumented in source.
_deselectAllWhenUnfocused
bool _deselectAllWhenUnfocused;
Undocumented in source.
_fixedFont
bool _fixedFont;
Undocumented in source.
_foldingPaneWidth
uint _foldingPaneWidth;
Undocumented in source.
_foldingWidth
int _foldingWidth;
Undocumented in source.
_hoverMousePosition
Point _hoverMousePosition;
Undocumented in source.
_hoverTextPosition
TextPosition _hoverTextPosition;
Undocumented in source.
_hoverTimeoutMillis
long _hoverTimeoutMillis;
Undocumented in source.
_hoverTimer
ulong _hoverTimer;
Undocumented in source.
_iconsPaneWidth
uint _iconsPaneWidth;
Undocumented in source.
_iconsWidth
int _iconsWidth;
Undocumented in source.
_lastBlinkStartTs
long _lastBlinkStartTs;
Undocumented in source.
_lastReportedModifiedState
bool _lastReportedModifiedState;
Undocumented in source.
_leftPaneBackgroundColor
uint _leftPaneBackgroundColor;
Undocumented in source.
_leftPaneBackgroundColor2
uint _leftPaneBackgroundColor2;
Undocumented in source.
_leftPaneBackgroundColor3
uint _leftPaneBackgroundColor3;
Undocumented in source.
_leftPaneLineNumberBackgroundColor
uint _leftPaneLineNumberBackgroundColor;
Undocumented in source.
_leftPaneLineNumberBackgroundColorCurrentLine
uint _leftPaneLineNumberBackgroundColorCurrentLine;
Undocumented in source.
_leftPaneLineNumberColor
uint _leftPaneLineNumberColor;
Undocumented in source.
_leftPaneLineNumberColorCurrentLine
uint _leftPaneLineNumberColorCurrentLine;
Undocumented in source.
_leftPaneLineNumberColorEdited
uint _leftPaneLineNumberColorEdited;
Undocumented in source.
_leftPaneLineNumberColorSaved
uint _leftPaneLineNumberColorSaved;
Undocumented in source.
_leftPaneWidth
int _leftPaneWidth;
Undocumented in source.
_lineHeight
int _lineHeight;
Undocumented in source.
_lineNumbersWidth
int _lineNumbersWidth;
Undocumented in source.
_matchingBracketHightlightColor
uint _matchingBracketHightlightColor;
Undocumented in source.
_maxFontSize
int _maxFontSize;
Undocumented in source.
_minFontSize
int _minFontSize;
Undocumented in source.
_modificationMarksPaneWidth
uint _modificationMarksPaneWidth;
Undocumented in source.
_modificationMarksWidth
int _modificationMarksWidth;
Undocumented in source.
_ownContent
bool _ownContent;

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

_replaceMode
bool _replaceMode;
Undocumented in source.
_scrollPos
Point _scrollPos;
Undocumented in source.
_searchHighlightColorCurrent
uint _searchHighlightColorCurrent;
Undocumented in source.
_searchHighlightColorOther
uint _searchHighlightColorOther;
Undocumented in source.
_selectAllWhenFocusedWithTab
bool _selectAllWhenFocusedWithTab;
Undocumented in source.
_selectionColorFocused
uint _selectionColorFocused;
Undocumented in source.
_selectionColorNormal
uint _selectionColorNormal;
Undocumented in source.
_selectionRange
TextRange _selectionRange;
Undocumented in source.
_showFolding
bool _showFolding;
Undocumented in source.
_showIcons
bool _showIcons;
Undocumented in source.
_showLineNumbers
bool _showLineNumbers;
Undocumented in source.
_showModificationMarks
bool _showModificationMarks;
Undocumented in source.
_showTabPositionMarks
bool _showTabPositionMarks;
Undocumented in source.
_spaceWidth
int _spaceWidth;
Undocumented in source.
_span
LineSpan[] _span;

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

_spanCache
LineSpan[] _spanCache;
Undocumented in source.
_textToHighlight
dstring _textToHighlight;
Undocumented in source.
_textToHighlightOptions
uint _textToHighlightOptions;
Undocumented in source.
_wantTabs
bool _wantTabs;
Undocumented in source.
_wordWrap
bool _wordWrap;
Undocumented in source.
caretHeightOffset
int caretHeightOffset;
Undocumented in source.
contentChange
Signal!EditableContentChangeListener contentChange;

Signal to emit when editor content is changed

editorStateChange
Signal!EditorStateListener editorStateChange;

Signal to emit when editor cursor position or Insert/Replace mode is changed.

modifiedStateChange
Signal!ModifiedStateListener modifiedStateChange;

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

previousXScrollPos
int previousXScrollPos;

To hold _scrollpos.x toggling between normal and word wrap mode

splitChars
dchar[] splitChars;

Characters at which content is split for word wrap mode

Inherited Members

From ScrollWidgetBase

_vscrollbarMode
ScrollBarMode _vscrollbarMode;
Undocumented in source.
_hscrollbarMode
ScrollBarMode _hscrollbarMode;
Undocumented in source.
_vscrollbar
ScrollBar _vscrollbar;

vertical scrollbar control

_hscrollbar
ScrollBar _hscrollbar;

horizontal scrollbar control

_clientRect
Rect _clientRect;

inner area, excluding additional controls like scrollbars

_fullScrollableArea
Rect _fullScrollableArea;
Undocumented in source.
_visibleScrollableArea
Rect _visibleScrollableArea;
Undocumented in source.
vscrollbarMode
ScrollBarMode vscrollbarMode [@property getter]

vertical scrollbar mode

vscrollbarMode
ScrollBarMode vscrollbarMode [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
hscrollbarMode
ScrollBarMode hscrollbarMode [@property getter]

horizontal scrollbar mode

hscrollbarMode
ScrollBarMode hscrollbarMode [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
clientRect
Rect clientRect [@property getter]

returns client area rectangle

onHScroll
bool onHScroll(ScrollEvent event)

process horizontal scrollbar event

onVScroll
bool onVScroll(ScrollEvent event)

process vertical scrollbar event

onMouseEvent
bool onMouseEvent(MouseEvent event)

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

onScrollEvent
bool onScrollEvent(AbstractSlider source, ScrollEvent event)

handle scroll event

_insideChangeScrollbarVisibility
bool _insideChangeScrollbarVisibility;
Undocumented in source.
checkIfNeededToChangeScrollbarVisibility
void checkIfNeededToChangeScrollbarVisibility()
Undocumented in source. Be warned that the author may not have intended to support it.
updateScrollBars
void updateScrollBars()

update scrollbar positions

hscrollbar
ScrollBar hscrollbar [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
vscrollbar
ScrollBar vscrollbar [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
hscrollbar
ScrollBar hscrollbar [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
vscrollbar
ScrollBar vscrollbar [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
updateHScrollBar
void updateHScrollBar()

update horizontal scrollbar widget position

updateVScrollBar
void updateVScrollBar()

update verticat scrollbar widget position

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.
onDraw
void onDraw(DrawBuf buf)

Draw widget at its position to buffer

fullContentSize
Point fullContentSize()

calculate full content size in pixels

fullContentSizeWithBorders
Point fullContentSizeWithBorders()

calculate full content size in pixels including widget borders / margins

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

Measure widget according to desired width and height constraints. (Step 1 of two phase layout).

handleClientRectLayout
void handleClientRectLayout(Rect rc)

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

checkIfScrollbarsNeeded
void checkIfScrollbarsNeeded(bool needHScroll, bool needVScroll)

override to determine if scrollbars are needed or not

layout
void layout(Rect rc)

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

makeRectVisible
void makeRectVisible(Rect rc, bool alignHorizontally, bool alignVertically)
Undocumented in source. Be warned that the author may not have intended to support it.

From EditableContentListener

onContentChange
void onContentChange(EditableContent content, EditOperation operation, TextRange rangeBefore, TextRange rangeAfter, Object source)
Undocumented in source.

From MenuItemActionHandler

onMenuItemAction
bool onMenuItemAction(Action action)
Undocumented in source.

Meta