ListWidget

List widget - shows content as hori

class ListWidget : WidgetGroup , OnScrollHandler , OnAdapterChangeHandler {}

Constructors

this
this()

empty parameter list constructor - for usage by factory

this
this(string ID, Orientation orientation)

create with ID parameter

Destructor

~this
~this()
Undocumented in source.

Members

Functions

handleFocusChange
void handleFocusChange(bool focused, bool receivedFocusFromKeyboard)

override to handle focus changes

isChild
bool isChild(Widget item, bool deepSearch)

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).

itemByPosition
int itemByPosition(int pos)

returns item index by 0-based offset from top/left of list content

itemClicked
void itemClicked(int index)

override to handle mouse up on item

itemEnabled
bool itemEnabled(int index)

returns true if item with corresponding index is enabled

itemRect
Rect itemRect(int index)

returns rectangle for item (scrolled)

itemRectNoScroll
Rect itemRectNoScroll(int index)

returns rectangle for item (not scrolled, first item starts at 0,0)

itemWidget
Widget itemWidget(int index)

return list item widget by item index

layout
void layout(Rect rc)

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

makeItemVisible
void makeItemVisible(int itemIndex)

ensure item is visible

makeSelectionVisible
void makeSelectionVisible()

ensure selected item is visible (scroll if necessary)

measure
void measure(int parentWidth, int parentHeight)

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

measureMinChildrenSize
Point measureMinChildrenSize()
Undocumented in source. Be warned that the author may not have intended to support it.
minimumVisibleContentSize
Point minimumVisibleContentSize()

sets minimum size for the list, override to change

moveSelection
bool moveSelection(int direction, bool wrapAround)

move selection

onAdapterChange
void onAdapterChange(ListAdapter source)

item list is changed

onDraw
void onDraw(DrawBuf buf)

Draw widget at its position to buffer

onKeyEvent
bool onKeyEvent(KeyEvent event)

list navigation using keys

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

onThemeChanged
void onThemeChanged()

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

selectItem
bool selectItem(int index, int disabledItemsSkipDirection)
Undocumented in source. Be warned that the author may not have intended to support it.
selectItem
bool selectItem(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
selectionChanged
void selectionChanged(int index, int previouslySelectedItem)

override to handle change of selection

setHoverItem
void setHoverItem(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
updateItemPositions
void updateItemPositions()
Undocumented in source. Be warned that the author may not have intended to support it.
updateSelectedItemFocus
void updateSelectedItemFocus()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

adapter
ListAdapter adapter [@property getter]

get adapter

adapter
ListAdapter adapter [@property setter]

set adapter

itemCount
int itemCount [@property getter]

returns number of widgets in list

orientation
Orientation orientation [@property getter]

returns linear layout orientation (Vertical, Horizontal)

orientation
Orientation orientation [@property setter]

sets linear layout orientation

overrideStateForItem
uint overrideStateForItem [@property getter]

allow to override state for updating of items

ownAdapter
ListAdapter ownAdapter [@property setter]

set adapter, which will be owned by list (destroy will be called for adapter on widget destroy)

selectOnHover
bool selectOnHover [@property getter]

when true, mouse hover selects underlying item

selectOnHover
bool selectOnHover [@property setter]

when true, mouse hover selects underlying item

selectedItemIndex
int selectedItemIndex [@property getter]

Selected item index.

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

Variables

_adapter
ListAdapter _adapter;
Undocumented in source.
_clickOnButtonDown
bool _clickOnButtonDown;

if true, generate itemClicked on mouse down instead mouse up event

_clientRc
Rect _clientRc;

client area rectangle (counting padding, margins, and scrollbar)

_firstVisibleItem
int _firstVisibleItem;

first visible item index

_hoverItemIndex
int _hoverItemIndex;

item with Hover state, -1 if no such item

_itemRects
Rect[] _itemRects;
Undocumented in source.
_itemSizes
Point[] _itemSizes;
Undocumented in source.
_lastMeasureHeight
int _lastMeasureHeight;
Undocumented in source.
_lastMeasureWidth
int _lastMeasureWidth;
Undocumented in source.
_makeSelectionVisibleOnNextLayout
bool _makeSelectionVisibleOnNextLayout;
Undocumented in source.
_maxScrollPosition
int _maxScrollPosition;

maximum scroll position

_needScrollbar
bool _needScrollbar;
Undocumented in source.
_orientation
Orientation _orientation;
Undocumented in source.
_ownAdapter
bool _ownAdapter;

when true, need to destroy adapter on list destroy

_sbsz
Point _sbsz;
Undocumented in source.
_scrollPosition
int _scrollPosition;

scroll position - offset of scroll area

_scrollbar
ScrollBar _scrollbar;
Undocumented in source.
_selectOnHover
bool _selectOnHover;

when true, mouse hover selects underlying item

_selectedItemIndex
int _selectedItemIndex;

item with Selected state, -1 if no such item

_totalSize
int _totalSize;

total height of all items for Vertical orientation, or width for Horizontal

itemClick
Signal!OnItemClickHandler itemClick;

Handle item click / activation (e.g. Space or Enter key press and mouse double click)

itemSelected
Signal!OnItemSelectedHandler itemSelected;

Handle selection change.

Inherited Members

From WidgetGroup

_children
WidgetList _children;
Undocumented in source.
needDraw
bool needDraw [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
childCount
int childCount [@property getter]

returns number of children of this widget

child
inout(Widget) child(int index)

returns child by index

addChild
Widget addChild(Widget item)

adds child, returns added item

insertChild
Widget insertChild(Widget item, int index)

inserts child at given index, returns inserted item

removeChild
Widget removeChild(int index)

removes child, returns removed item

removeChild
Widget removeChild(string ID)

removes child by ID, returns removed item

removeChild
Widget removeChild(Widget child)

removes child, returns removed item

childIndex
int childIndex(Widget item)

returns index of widget in child list, -1 if passed widget is not a child of this widget

removeAllChildren
void removeAllChildren(bool destroyObj)
Undocumented in source. Be warned that the author may not have intended to support it.
replaceChild
void replaceChild(Widget newChild, Widget oldChild)

replace child with other child

From OnScrollHandler

onScrollEvent
bool onScrollEvent(AbstractSlider source, ScrollEvent event)

handle scroll event

From OnAdapterChangeHandler

onAdapterChange
void onAdapterChange(ListAdapter source)
Undocumented in source.

Meta