Class StringListWidget

Inherits from

Constructors

Name Description
this
this
this
this

Fields

Name Type Description
checkChange Signal!(dlangui.widgets.widget.OnCheckHandler) checked state change event listener (bool delegate(Widget, bool))
click Signal!(dlangui.widgets.widget.OnClickHandler) on click event listener (bool delegate(Widget))
focusChange Signal!(dlangui.widgets.widget.OnFocusHandler) focus state change event listener (bool delegate(Widget, bool))
FOCUS_RECT_PADDING immutable(int)
itemClick Signal!(dlangui.widgets.lists.OnItemClickHandler) Handle item click / activation (e.g. Space or Enter key press and mouse double click)
itemSelected Signal!(dlangui.widgets.lists.OnItemSelectedHandler) Handle selection change.
keyEvent Signal!(dlangui.widgets.widget.OnKeyHandler) key event listener (bool delegate(Widget, KeyEvent)) - return true if event is processed by handler
mouseEvent Signal!(dlangui.widgets.widget.OnMouseHandler) mouse event listener (bool delegate(Widget, MouseEvent)) - return true if event is processed by handler
_backgroundDrawable Ref!(dlangui.graphics.resources.Drawable)
_acceleratorMap ActionMap
_action Action
_adapter ListAdapter
_checkable bool
_checked bool
_children ObjectList!(dlangui.widgets.widget.Widget)
_clickable bool
_clickOnButtonDown bool if true, generate itemClicked on mouse down instead mouse up event
_clientRc Rect client area rectangle (counting padding, margins, and scrollbar)
_firstVisibleItem int first visible item index
_focusable bool
_focusGroup bool
_hoverItemIndex int item with Hover state, -1 if no such item
_id string widget id
_itemRects Rect[]
_itemSizes Point[]
_lastMeasureHeight int
_lastMeasureWidth int
_makeSelectionVisibleOnNextLayout bool
_maxScrollPosition int maximum scroll position
_measuredHeight int height measured by measure()
_measuredWidth int width measured by measure()
_needDraw bool true to force redraw
_needLayout bool true to force layout
_needScrollbar bool
_orientation Orientation
_ownAdapter bool when true, need to destroy adapter on list destroy
_ownStyle Style own copy of style - to override some of style properties, null of no properties overriden
_parent Widget parent widget
_pos Rect current widget position, set by layout()
_sbsz Point
_scrollbar ScrollBar
_scrollPosition int scroll position - offset of scroll area
_selectedItemIndex int item with Selected state, -1 if no such item
_selectOnHover bool when true, mouse hover selects underlying item
_state uint widget state (set of flags from State enum)
_styleId string style id to lookup style in theme
_tabOrder ushort
_tooltipText UIString
_totalSize int total height of all items for Vertical orientation, or width for Horizontal
_trackHover bool does widget need to track mouse Hover
_visibility Visibility widget visibility: either Visible, Invisible, Gone
_window Window window (to be used for top level widgets only!)

Properties

Name Type Description
items [set] string[]
items [set] dstring[]
items [set] StringListValue[]
selectedItem [get] dstring get selected item as text
acceleratorMap [get] ActionMap
action [get, set] const(Action) action to emit on click
adapter [set] ListWidget set adapter
adapter [get] ListAdapter get adapter
alignment [set] Widget sets alignment (combined vertical and horizontal)
alignment [get] ubyte returns alignment (combined vertical and horizontal)
alpha [set] Widget set widget drawing alpha value (0=opaque .. 255=transparent)
alpha [get] uint 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
backgroundColor [set] Widget set background color for widget - from string like "#5599CC" or "white"
backgroundDrawable [get, set] 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 [set] Widget
checkable [get] bool when true, control supports Checked state
checked [set] Widget set checked state
checked [get] bool get 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
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 [get] FontFamily returns font family
fontFamily [set] Widget set font family for widget - override one from style
fontItalic [get] bool returns font style (italic/normal)
fontItalic [set] Widget set font style (italic/normal) for widget - override one from style
fontSize [get] int 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
hasTooltip [get] bool returns true if widget has tooltip to show
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
itemCount [get] int returns number of widgets in list
layoutHeight [set] Widget sets layout height options (WRAP_CONTENT, FILL_PARENT, or some constant value)
layoutHeight [get] int returns layout height options (WRAP_CONTENT, FILL_PARENT, or some constant value)
layoutWeight [set] Widget sets layout weight (while resizing to fill parent, widget will be resized proportionally to this value)
layoutWeight [get] int returns 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 [set] Widget set margins for widget - override one from style
margins [set] Widget set margins for widget with the same value for left, top, right, bottom - override one from style
margins [get] Rect get margins (between widget bounds and its background)
maxHeight [get] int returns max height constraint (SIZE_UNSPECIFIED if no constraint set)
maxHeight [set] Widget set max height constraint (SIZE_UNSPECIFIED for no constraint)
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)
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
orientation [get] Orientation returns linear layout orientation (Vertical, Horizontal)
orientation [set] ListWidget sets linear layout orientation
ownAdapter [set] ListWidget set adapter, which will be owned by list (destroy will be called for adapter on widget destroy)
padding [set] Widget set padding for widget - override one from style
padding [get] Rect get padding (between background bounds and content of widget)
padding [set] Widget set padding for widget to the same value for left, top, right, bottom - override one from style
parent [set] Widget sets parent for widget
parent [get] Widget returns parent widget, null for top level widget
pos [get] Rect returns widget rectangle
resetState [set] Widget remove state flags (set of flags from State enum)
selectedItemIndex [set] int
selectedItemIndex [get] int Selected item index.
selectOnHover [get, set] bool when true, mouse hover selects underlying item
setState [set] Widget add state flags (set of flags from State enum)
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 [get] string returns widget style id, null if not set
styleId [set] Widget set widget style id
tabOrder [set] Widget
tabOrder [get] ushort tab order - hint for focus movement using Tab/Shift+Tab
text [get] dstring returns widget content text (override to support this)
text [set] Widget sets widget content text (override to support this)
textColor [set] Widget set text color for widget - from string like "#5599CC" or "white"
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)
tooltipText [get, set] dstring tooltip text - when not empty, widget will show tooltips automatically; for advanced tooltips - override hasTooltip and createTooltip
top [get] int returns widget rectangle top position
trackHover [set] Widget set new trackHover flag value (when true, widget will change Hover state while mouse is moving)
trackHover [get] bool mouse movement processing flag (when true, widget will change Hover state while mouse is moving)
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
width [get] int returns current width of widget in pixels
window [set] Window sets window (to be used for top level widget from Window implementation). TODO: hide it from API?
window [get] Window returns window (if widget or its parent is attached to window)
overrideStateForItem [get] uint allow to override state for updating of items
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
addChild adds child, returns added item
addChildren 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
cancelLayout
cancelTimer cancel timer - pass value returned from setTimer() as timerId parameter
canShowPopupMenu returns true if widget can show popup menu (e.g. by mouse right click at point x,y)
child returns child by index
childById find child of specified type T by id, returns null if not found or cannot be converted to type T
childIndex returns index of widget in child list, -1 if passed widget is not a child of this widget
compareId compare widget id with specified value, returs true if matches
createTooltip will be called from window once tooltip request timer expired; if null is returned, popup will not be shown; you can change alignment and position of popup here
dispatchAction call to dispatch action
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
findKeyAction map key to action
focusGroupWidget find nearest parent of this widget with focusGroup flag, returns topmost parent if no focusGroup flag set to any of parents.
getCursorType returns mouse cursor type for widget
handleAction override to handle specific actions
handleActionStateChanged called when state of action assigned on widget is changed
handleActionStateRequest override to handle specific actions state (e.g. change enabled state for supported actions)
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
itemByPosition returns item index by 0-based offset from top/left of list content
itemEnabled returns true if item with corresponding index is enabled
itemRect returns rectangle for item (scrolled)
itemRectNoScroll returns rectangle for item (not scrolled, first item starts at 0,0)
itemWidget return list item widget by item index
layout Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).
makeItemVisible ensure item is visible
makeSelectionVisible ensure selected item is visible (scroll if necessary)
measure Measure widget according to desired width and height constraints. (Step 1 of two phase layout).
moveSelection move selection
onAdapterChange item list is changed
onDraw Draw widget at its position to buffer
onEvent handle custom event
onKeyEvent list navigation using keys
onMouseEvent process mouse event; return true if event is processed by widget.
onScrollEvent handle scroll event
onThemeChanged handle theme change: e.g. reload some themed resources
onTimer handle timer; return true to repeat timer event after next interval, false cancel timer
removeAllChildren
removeChild removes child, returns removed item
removeChild removes child, returns removed item
removeChild removes child by ID, returns removed item
requestActionsUpdate set action update request flag, will be cleared after redraw
requestLayout request relayout of widget and its children
selectItem
selectItem
setBoolProperty set string property value, for ML loaders
setDoubleProperty set double property value, for ML loaders
setDstringProperty set string property value, for ML loaders
setFocus sets focus to this widget or suitable focusable child, returns previously focused widget
setIntProperty set int property value, for ML loaders
setRectProperty set Rect property value, for ML loaders
setStringProperty set string property value, for ML loaders
setTimer set new timer to call onTimer() after specified interval (for recurred notifications, return true from onTimer)
setUistringProperty set string property value, for ML loaders
showPopupMenu shows popup menu at (x,y)
updateActionState ask for update state of some action (unles force=true, checks window flag actionsUpdateRequested), returns true if action state is changed
updateActionState call to update state for action (if action is assigned for widget)
updateStateFromAction apply enabled, visibile and checked state for this widget from action's state
handleCheckChange override to handle check changes
handleClick
handleFocusChange override to handle focus changes
itemClicked override to handle mouse up on item
measuredContent helper function for implement measure() when widget's content dimensions are known
scheduleTooltip schedule tooltip
selectionChanged override to handle change of selection
setHoverItem
updateItemPositions
updateSelectedItemFocus

Authors

Vadim Lopatin, coolreader.org@gmail.com

Copyright

Vadim Lopatin, 2014

License

Boost License 1.0