Class SourceEdit
Inherits from
-
(base class)EditBox
Constructors
Name | Description |
---|---|
this
|
|
this
|
Fields
Name | Type | Description |
---|---|---|
FOCUS_RECT_PADDING
|
immutable(int) |
|
onCheckChangeListener
|
Signal!(dlangui.widgets.widget.OnCheckHandler) |
checked state change event listener (bool delegate(Widget , bool))
|
onClickListener
|
Signal!(dlangui.widgets.widget.OnClickHandler) |
on click event listener (bool delegate(Widget ))
|
onFocusChangeListener
|
Signal!(dlangui.widgets.widget.OnFocusHandler) |
focus state change event listener (bool delegate(Widget , bool))
|
onKeyListener
|
Signal!(dlangui.widgets.widget.OnKeyHandler) |
key event listener (bool delegate(Widget , KeyEvent)) - return true if event is processed by handler
|
onMouseListener
|
Signal!(dlangui.widgets.widget.OnMouseHandler) |
mouse event listener (bool delegate(Widget , MouseEvent)) - return true if event is processed by handler
|
_filename
|
string |
|
_acceleratorMap
|
ActionMap |
|
_action
|
Action |
|
_camelCasePartsAsWords
|
bool |
|
_caretPos
|
TextPosition |
|
_checkable
|
bool |
|
_checked
|
bool |
|
_children
|
ObjectList!(dlangui.widgets.widget.Widget) |
|
_clickable
|
bool |
|
_clientRect
|
Rect |
inner area, excluding additional controls like scrollbars |
_content
|
EditableContent |
|
_firstVisibleLine
|
int |
|
_fixedFont
|
bool |
|
_focusable
|
bool |
|
_focusGroup
|
bool |
|
_foldingPaneWidth
|
uint |
|
_foldingWidth
|
int |
|
_fullScrollableArea
|
Rect |
|
_hscrollbar
|
ScrollBar |
horizontal scrollbar control |
_hscrollbarMode
|
ScrollBarMode |
|
_iconsPaneWidth
|
uint |
|
_iconsWidth
|
int |
|
_id
|
string |
widget id
|
_leftPaneBackgroundColor
|
uint |
|
_leftPaneBackgroundColor2
|
uint |
|
_leftPaneBackgroundColor3
|
uint |
|
_leftPaneLineNumberBackgroundColor
|
uint |
|
_leftPaneLineNumberColor
|
uint |
|
_leftPaneWidth
|
int |
|
_lineHeight
|
int |
|
_lineNumbersWidth
|
int |
|
_maxFontSize
|
int |
|
_maxLineWidth
|
int |
|
_measuredHeight
|
int |
height measured by measure ()
|
_measuredWidth
|
int |
width measured by measure ()
|
_minFontSize
|
int |
|
_modificationMarksPaneWidth
|
uint |
|
_modificationMarksWidth
|
int |
|
_needDraw
|
bool |
true to force redraw |
_needLayout
|
bool |
true to force layout
|
_numVisibleLines
|
int |
|
_ownContent
|
bool |
when ownContent is false, content should not be destroyed in editor destructor |
_ownStyle
|
Style |
own copy of style - to override some of style properties, null of no properties overriden
|
_parent
|
Widget |
parent widget
|
_popupMenu
|
MenuItem |
|
_pos
|
Rect |
current widget position, set by layout ()
|
_replaceMode
|
bool |
|
_scrollPos
|
Point |
|
_selectionColorFocused
|
uint |
|
_selectionColorNormal
|
uint |
|
_selectionRange
|
TextRange |
|
_showFolding
|
bool |
|
_showIcons
|
bool |
|
_showLineNumbers
|
bool |
|
_showModificationMarks
|
bool |
|
_spaceWidth
|
int |
|
_state
|
uint |
widget state (set of flags from State enum)
|
_styleId
|
string |
style id to lookup style in theme
|
_tabOrder
|
ushort |
|
_tabSize
|
int |
|
_tokenHighlightColors
|
CustomCharProps[ubyte] |
|
_trackHover
|
bool |
does widget need to track mouse Hover |
_useSpacesForTabs
|
bool |
|
_visibility
|
Visibility |
widget visibility : either Visible, Invisible, Gone
|
_visibleLines
|
dstring[] |
|
_visibleLinesHighlights
|
CustomCharProps[][] |
|
_visibleLinesMeasurement
|
int[][] |
|
_visibleLinesWidths
|
int[] |
|
_visibleScrollableArea
|
Rect |
|
_vscrollbar
|
ScrollBar |
vertical scrollbar control |
_vscrollbarMode
|
ScrollBarMode |
|
_wantTabs
|
bool |
|
_window
|
Window |
window (to be used for top level widgets only!)
|
Properties
Name | Type | Description |
---|---|---|
filename
[get]
|
string |
|
acceleratorMap
[get]
|
ActionMap |
|
action
[get, set]
|
const(Action) |
action to emit on click
|
alignment
[set]
|
Widget |
sets alignment (combined vertical and horizontal)
|
alignment
[get]
|
ubyte |
returns alignment (combined vertical and horizontal)
|
alpha
[get]
|
uint |
widget drawing alpha value (0=opaque .. 255=transparent)
|
alpha
[set]
|
Widget |
set widget drawing alpha value (0=opaque .. 255=transparent)
|
animating
[get]
|
bool |
returns true is widget is being animated - need to call animate () and redraw
|
backgroundColor
[get]
|
uint |
returns background color |
backgroundColor
[set]
|
Widget |
set background color for widget - override one from style
|
backgroundDrawable
[get]
|
Ref!(dlangui.graphics.resources.Drawable) |
background drawable |
backgroundImageId
[get, set]
|
string |
background image id
|
canCheck
[get]
|
bool |
|
canClick
[get]
|
bool |
|
canFocus
[get]
|
bool |
returns true if widget is focusable and visible and enabled
|
checkable
[get]
|
bool |
when true, control supports Checked state
|
checkable
[set]
|
Widget |
|
checked
[get]
|
bool |
get checked state
|
checked
[set]
|
Widget |
set checked state
|
childCount
[get]
|
int |
returns number of children of this widget |
clickable
[set]
|
Widget |
|
clickable
[get]
|
bool |
when true, user can click this control, and get onClick listeners called |
content
[set]
|
EditWidgetBase |
set content object
|
content
[get]
|
EditableContent |
editor content object
|
enabled
[get]
|
bool |
return true if state has State.Enabled flag set
|
enabled
[set]
|
Widget |
change enabled state
|
focusable
[set]
|
Widget |
|
focusable
[get]
|
bool |
whether widget can be focused
|
focused
[get]
|
bool |
|
focusGroup
[get]
|
bool |
When focus group is set for some parent widget, focus from one of containing widgets can be moved using keyboard only to one of other widgets containing in it and cannot bypass bounds of focusGroup .
|
focusGroup
[set]
|
Widget |
set focus group flag for container widget |
focusRectColors
[get]
|
const(uint[]) |
returns colors to draw focus rectangle (one for solid, two for vertical gradient) or null if no focus rect should be drawn for style
|
font
[get]
|
Ref!(dlangui.graphics.fonts.Font) |
returns font set for widget using style or set manually
|
fontFace
[set]
|
Widget |
set font face for widget - override one from style
|
fontFace
[get]
|
string |
returns font face
|
fontFamily
[set]
|
Widget |
set font family for widget - override one from style
|
fontFamily
[get]
|
FontFamily |
returns font family
|
fontItalic
[set]
|
Widget |
set font style (italic /normal) for widget - override one from style
|
fontItalic
[get]
|
bool |
returns font style (italic/normal)
|
fontSize
[get]
|
ushort |
returns font size in pixels
|
fontSize
[set]
|
Widget |
set font size for widget - override one from style
|
fontWeight
[get]
|
ushort |
returns font weight
|
fontWeight
[set]
|
Widget |
set font weight for widget - override one from style
|
halign
[get]
|
Align |
returns vertical alignment
|
height
[get]
|
int |
returns current height of widget in pixels
|
id
[get]
|
string |
returns widget id , null if not set
|
id
[set]
|
Widget |
set widget id
|
layoutHeight
[get]
|
int |
returns layout height options (WRAP_CONTENT, FILL_PARENT, or some constant value)
|
layoutHeight
[set]
|
Widget |
sets layout height options (WRAP_CONTENT, FILL_PARENT, or some constant value )
|
layoutWeight
[get]
|
int |
returns layout weight (while resizing to fill parent , widget will be resized proportionally to this value)
|
layoutWeight
[set]
|
Widget |
sets layout weight (while resizing to fill parent , widget will be resized proportionally to this value )
|
layoutWidth
[get]
|
int |
returns layout width options (WRAP_CONTENT, FILL_PARENT, or some constant value)
|
layoutWidth
[set]
|
Widget |
sets layout width options (WRAP_CONTENT, FILL_PARENT, or some constant value )
|
left
[get]
|
int |
returns widget rectangle left position
|
margins
[get]
|
Rect |
get margins (between widget bounds and its background)
|
margins
[set]
|
Widget |
set margins for widget - override one from style
|
maxFontSize
[get]
|
int |
|
maxFontSize
[set]
|
EditBox |
|
maxHeight
[set]
|
Widget |
set max height constraint (SIZE_UNSPECIFIED for no constraint)
|
maxHeight
[get]
|
int |
returns max height constraint (SIZE_UNSPECIFIED if no constraint set)
|
maxWidth
[get]
|
int |
returns max width constraint (SIZE_UNSPECIFIED if no constraint set)
|
maxWidth
[set]
|
Widget |
set max width constraint (SIZE_UNSPECIFIED for no constraint)
|
measuredHeight
[get]
|
int |
returns measured height (calculated during measure () call)
|
measuredWidth
[get]
|
int |
returns measured width (calculated during measure () call)
|
minFontSize
[set]
|
EditBox |
|
minFontSize
[get]
|
int |
|
minHeight
[get]
|
int |
returns min height constraint
|
minHeight
[set]
|
Widget |
set max height constraint (0 for no constraint)
|
minWidth
[get]
|
int |
returns min width constraint
|
minWidth
[set]
|
Widget |
set max width constraint (0 for no constraint)
|
needDraw
[get]
|
bool |
returns true if redraw is required for widget and its children |
needLayout
[get]
|
bool |
returns true if layout is required for widget and its children
|
padding
[get]
|
Rect |
get padding (between background bounds and content of widget)
|
padding
[set]
|
Widget |
set padding for widget - override one from style
|
parent
[set]
|
Widget |
sets parent for widget
|
parent
[get]
|
Widget |
returns parent widget, null for top level widget
|
popupMenu
[set]
|
EditWidgetBase |
|
popupMenu
[get]
|
MenuItem |
|
pos
[get]
|
Rect |
returns widget rectangle |
readOnly
[get]
|
bool |
readonly flag (when true, user cannot change content of editor)
|
readOnly
[set]
|
EditWidgetBase |
sets readonly flag |
replaceMode
[set]
|
EditWidgetBase |
sets replace mode flag |
replaceMode
[get]
|
bool |
replace mode flag (when true, entered character replaces character under cursor) |
resetState
[set]
|
Widget |
remove state flags (set of flags from State enum)
|
setState
[set]
|
Widget |
add state flags (set of flags from State enum)
|
showLineNumbers
[get, set]
|
bool |
when true, line numbers are shown |
state
[set]
|
Widget |
set new widget state (set of flags from State enum)
|
state
[get]
|
uint |
widget state (set of flags from State enum)
|
styleId
[set]
|
Widget |
set widget style id
|
styleId
[get]
|
string |
returns widget style id , null if not set
|
tabOrder
[set]
|
Widget |
|
tabOrder
[get]
|
ushort |
tab order - hint for focus movement using Tab/Shift+Tab |
tabSize
[set]
|
EditWidgetBase |
sets tab size (in number of spaces) |
tabSize
[get]
|
int |
returns tab size (in number of spaces) |
text
[set]
|
Widget |
set text
|
text
[get]
|
dstring |
get widget text
|
textColor
[set]
|
Widget |
set text color (ARGB 32 bit value )
|
textColor
[get]
|
uint |
get text color (ARGB 32 bit value)
|
textFlags
[get]
|
uint |
get text flags (bit set of TextFlag enum values)
|
textFlags
[set]
|
Widget |
set text flags (bit set of TextFlag enum values)
|
top
[get]
|
int |
returns widget rectangle top position
|
trackHover
[get]
|
bool |
mouse movement processing flag (when true, widget will change Hover state while mouse is moving)
|
trackHover
[set]
|
Widget |
set new trackHover flag value (when true, widget will change Hover state while mouse is moving)
|
useSpacesForTabs
[get]
|
bool |
when true, spaces will be inserted instead of tabs |
useSpacesForTabs
[set]
|
EditWidgetBase |
set new Tab key behavior flag: when true, spaces will be inserted instead of tabs |
valign
[get]
|
Align |
returns horizontal alignment
|
visibility
[set]
|
Widget |
sets widget visibility (Visible, Invisible, Gone)
|
visibility
[get]
|
Visibility |
returns widget visibility (Visible, Invisible, Gone)
|
visible
[get]
|
bool |
returns true if this widget and all its parents are visible
|
wantsKeyTracking
[get]
|
bool |
override and return true to track key events even when not focused
|
wantTabs
[get]
|
bool |
when true, Tab / Shift+Tab presses are processed internally in widget (e.g. insert tab character) instead of focus change navigation. |
wantTabs
[set]
|
EditWidgetBase |
sets tab size (in number of spaces) |
width
[get]
|
int |
returns current width of widget in pixels
|
window
[get]
|
Window |
returns window (if widget or its parent is attached to window )
|
window
[set]
|
Window |
sets window (to be used for top level widget from Window implementation). TODO: hide it from API?
|
ownStyle
[get]
|
Style |
enforces widget's own style - allows override some of style properties
|
stateStyle
[get]
|
const(Style) |
returns style for current widget state
|
style
[get, set]
|
const(Style) |
accessor to style - by lookup in theme by styleId (if style id is not set, theme base style will be used).
|
Methods
Name | Description |
---|---|
load
|
load from file
|
addChild
|
adds child , returns added item
|
addOnCheckChangeListener
|
helper function to add onCheckChangeListener in method chain
|
addOnClickListener
|
helper function to add onCheckChangeListener in method chain
|
addOnFocusChangeListener
|
helper function to add onFocusChangeListener in method chain
|
animate
|
animates window ; interval is time left from previous draw, in hnsecs (1/10000000 of second)
|
applyAlign
|
Applies alignment for content of size sz - set rectangle rc to aligned value of content inside of initial value of rc .
|
applyMargins
|
Helper function: applies margins to rectangle
|
applyPadding
|
Helper function: applies padding to rectangle
|
canShowPopupMenu
|
returns true if widget can show popup (e.g. by mouse right click at point x ,y )
|
child
|
returns child by index
|
childById
|
find child by id , returns null if not found
|
childIndex
|
returns index of widget in child list, -1 if passed widget is not a child of this widget
|
clearTokenHightlightColors
|
clear highlight colors |
compareId
|
compare widget id with specified value, returs true if matches
|
drawFocusRect
|
draws focus rectangle, if enabled in styles
|
executeInUiThread
|
execute delegate later in UI thread if this widget will be still available (can be used to modify UI from background thread, or just to postpone execution of action )
|
findFocusableChild
|
searches children for first focusable item, returns null if not found
|
focusGroupWidget
|
find nearest parent of this widget with focusGroup flag, returns topmost parent if no focusGroup flag set to any of parents.
|
fullContentSize
|
calculate full content size in pixels
|
getCursorType
|
returns mouse cursor type for widget |
handleMoveFocusUsingKeys
|
|
invalidate
|
request redraw |
isActionEnabled
|
override to change popup menu items state
|
isChild
|
returns true if item is child of this widget (when deepSearch == true - returns true if item is this widget or one of children inside children tree).
|
isPointInside
|
returns true if point is inside of this widget |
layout
|
Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout ).
|
makeRectVisible
|
|
measure
|
measure
|
onContentChange
|
|
onDraw
|
Draw widget at its position to buffer |
onEvent
|
handle custom event
|
onHScroll
|
process horizontal scrollbar event
|
onKeyEvent
|
handle keys |
onMenuItemAction
|
|
onMouseEvent
|
process mouse event ; return true if event is processed by widget.
|
onPopupMenuItem
|
|
onScrollEvent
|
handle scroll event
|
onVScroll
|
process vertical scrollbar event
|
removeAllChildren
|
|
removeChild
|
removes child , returns removed item
|
removeChild
|
removes child by ID , returns removed item
|
requestLayout
|
request relayout of widget and its children |
setFocus
|
sets focus to this widget or suitable focusable child , returns previously focused widget
|
setTokenHightlightColor
|
set highlight options for particular token category |
showPopupMenu
|
shows popup at (x ,y )
|
calcLineWidth
|
|
caretRect
|
returns cursor rectangle |
clientToTextPos
|
|
correctCaretPos
|
when cursor position or selection is out of content bounds, fix it to nearest valid position
|
drawCaret
|
draws caret |
drawClient
|
|
drawExtendedArea
|
|
drawLeftPane
|
|
drawLeftPaneFolding
|
|
drawLeftPaneIcons
|
|
drawLeftPaneLineNumbers
|
|
drawLeftPaneModificationMarks
|
|
drawLineBackground
|
override to custom highlight of line background |
ensureCaretVisible
|
|
findKeyAction
|
map key to action
|
handleAction
|
override to handle specific actions |
handleCheckChange
|
override to handle check changes |
handleClick
|
|
handleClientRectLayout
|
override to support modification of client rect after change, e.g. apply offset |
handleCustomLineHighlight
|
Custom text color and style highlight (using text highlight) support.
|
handleFocusChange
|
override to handle focus changes |
indentLine
|
change line indent |
indentRange
|
indent / unindent range |
lineCount
|
override for multiline editors |
measuredContent
|
helper function for implement measure () when widget's content dimensions are known
|
measureVisibleText
|
|
removeRangeText
|
|
removeSelectionTextIfSelected
|
|
spaceBefore
|
|
spacesForTab
|
generate string of spaces, to reach next tab position |
textPosToClient
|
|
updateCaretPositionByMouse
|
|
updateFontProps
|
|
updateHScrollBar
|
update horizontal scrollbar widget position |
updateLeftPaneWidth
|
override to add custom items on left panel
|
updateMaxLineWidth
|
|
updateScrollBars
|
update scrollbar positions |
updateSelectionAfterCursorMovement
|
|
updateVScrollBar
|
update verticat scrollbar widget position |
wholeLinesSelected
|
returns true if one or more lines selected fully |
Authors
Vadim Lopatin, coolreader.org@gmail.com
Copyright
Vadim Lopatin, 2014
License
Boost License 1.0