MenuWidgetBase

base class for menus

class MenuWidgetBase : ListWidget {}

Constructors

this
this(MenuWidgetBase parentMenu, MenuItem item, Orientation orientation)
Undocumented in source.

Members

Functions

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

closes this menu - handle ESC key

deactivate
void deactivate(bool force)
Undocumented in source. Be warned that the author may not have intended to support it.
findKeyAction
Action findKeyAction(uint keyCode, uint flags)

map key to action

handleActionStateRequest
bool handleActionStateRequest(Action a)

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

handleMenuItemClick
void handleMenuItemClick(MenuItem item)
Undocumented in source. Be warned that the author may not have intended to support it.
isRecentlyClosedItem
bool isRecentlyClosedItem(MenuItem item)
Undocumented in source. Be warned that the author may not have intended to support it.
itemClicked
void itemClicked(int index)

override to handle mouse up on item

measure
void measure(int parentWidth, int parentHeight)

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

onKeyEvent
bool onKeyEvent(KeyEvent event)

list navigation using keys

onMenuItem
void onMenuItem(MenuItem item)
Undocumented in source. Be warned that the author may not have intended to support it.
onPopupClosed
void onPopupClosed(PopupWidget p)
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

openSubmenu
void openSubmenu(int index, MenuItemWidget itemWidget, bool selectFirstItem)
Undocumented in source. Be warned that the author may not have intended to support it.
performUndoSelection
void performUndoSelection()
Undocumented in source. Be warned that the author may not have intended to support it.
scheduleOpenSubmenu
void scheduleOpenSubmenu(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

updateActionState
void updateActionState(bool force)

call to update state for action (if action is assigned for widget)

Manifest constants

MENU_OPEN_DELAY_MS
enum MENU_OPEN_DELAY_MS;
Undocumented in source.
REOPEN_MENU_THRESHOLD_MS
enum REOPEN_MENU_THRESHOLD_MS;
Undocumented in source.

Properties

isMainMenu
bool isMainMenu [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
menuItems
MenuItem menuItems [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
selectedMenuItemWidget
MenuItemWidget selectedMenuItemWidget [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
thisPopup
PopupWidget thisPopup [@property getter]

returns popup this menu is located in

Variables

_ignoreItemSelection
MenuItem _ignoreItemSelection;
Undocumented in source.
_item
MenuItem _item;
Undocumented in source.
_lastClosedPopupMenu
MenuItem _lastClosedPopupMenu;
Undocumented in source.
_lastClosedPopupTs
long _lastClosedPopupTs;
Undocumented in source.
_menuTogglePreviousFocus
Widget _menuTogglePreviousFocus;
Undocumented in source.
_menuToggleState
int _menuToggleState;
Undocumented in source.
_openedMenu
PopupMenu _openedMenu;
Undocumented in source.
_openedPopup
PopupWidget _openedPopup;
Undocumented in source.
_openedPopupIndex
int _openedPopupIndex;
Undocumented in source.
_parentMenu
MenuWidgetBase _parentMenu;
Undocumented in source.
_selectionChangingInProgress
bool _selectionChangingInProgress;
Undocumented in source.
_submenuOpenItemIndex
int _submenuOpenItemIndex;
Undocumented in source.
_submenuOpenTimer
ulong _submenuOpenTimer;
Undocumented in source.
menuItemAction
Signal!MenuItemActionHandler menuItemAction;

menu item action listener

menuItemClick
Signal!MenuItemClickHandler menuItemClick;

menu item click listener

Inherited Members

From ListWidget

itemSelected
Signal!OnItemSelectedHandler itemSelected;

Handle selection change.

itemClick
Signal!OnItemClickHandler itemClick;

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

_orientation
Orientation _orientation;
Undocumented in source.
orientation
Orientation orientation [@property getter]

returns linear layout orientation (Vertical, Horizontal)

orientation
Orientation orientation [@property setter]

sets linear layout orientation

_itemRects
Rect[] _itemRects;
Undocumented in source.
_itemSizes
Point[] _itemSizes;
Undocumented in source.
_needScrollbar
bool _needScrollbar;
Undocumented in source.
_sbsz
Point _sbsz;
Undocumented in source.
_scrollbar
ScrollBar _scrollbar;
Undocumented in source.
_lastMeasureWidth
int _lastMeasureWidth;
Undocumented in source.
_lastMeasureHeight
int _lastMeasureHeight;
Undocumented in source.
_firstVisibleItem
int _firstVisibleItem;

first visible item index

_scrollPosition
int _scrollPosition;

scroll position - offset of scroll area

_maxScrollPosition
int _maxScrollPosition;

maximum scroll position

_clientRc
Rect _clientRc;

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

_totalSize
int _totalSize;

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

_hoverItemIndex
int _hoverItemIndex;

item with Hover state, -1 if no such item

_selectedItemIndex
int _selectedItemIndex;

item with Selected state, -1 if no such item

_selectOnHover
bool _selectOnHover;

when true, mouse hover selects underlying item

selectOnHover
bool selectOnHover [@property getter]

when true, mouse hover selects underlying item

selectOnHover
bool selectOnHover [@property setter]

when true, mouse hover selects underlying item

_clickOnButtonDown
bool _clickOnButtonDown;

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

itemRectNoScroll
Rect itemRectNoScroll(int index)

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

itemRect
Rect itemRect(int index)

returns rectangle for item (scrolled)

itemByPosition
int itemByPosition(int pos)

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

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

when true, need to destroy adapter on list destroy

adapter
ListAdapter adapter [@property getter]

get adapter

adapter
ListAdapter adapter [@property setter]

set adapter

ownAdapter
ListAdapter ownAdapter [@property setter]

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

itemCount
int itemCount [@property getter]

returns number of widgets in list

itemWidget
Widget itemWidget(int index)

return list item widget by item index

itemEnabled
bool itemEnabled(int index)

returns true if item with corresponding index is enabled

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

item list is changed

selectionChanged
void selectionChanged(int index, int previouslySelectedItem)

override to handle change of selection

itemClicked
void itemClicked(int index)

override to handle mouse up on item

overrideStateForItem
uint overrideStateForItem [@property getter]

allow to override state for updating of items

updateSelectedItemFocus
void updateSelectedItemFocus()
Undocumented in source. Be warned that the author may not have intended to support it.
handleFocusChange
void handleFocusChange(bool focused, bool receivedFocusFromKeyboard)

override to handle focus changes

makeSelectionVisible
void makeSelectionVisible()

ensure selected item is visible (scroll if necessary)

_makeSelectionVisibleOnNextLayout
bool _makeSelectionVisibleOnNextLayout;
Undocumented in source.
makeItemVisible
void makeItemVisible(int itemIndex)

ensure item is visible

moveSelection
bool moveSelection(int direction, bool wrapAround)

move selection

selectItem
bool selectItem(int index, int disabledItemsSkipDirection)
Undocumented in source. Be warned that the author may not have intended to support it.
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.
selectItem
bool selectItem(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
~this
~this()
Undocumented in source.
onScrollEvent
bool onScrollEvent(AbstractSlider source, ScrollEvent event)

handle scroll event

onThemeChanged
void onThemeChanged()

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

minimumVisibleContentSize
Point minimumVisibleContentSize()

sets minimum size for the list, override to change

measureMinChildrenSize
Point measureMinChildrenSize()
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).

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

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.

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

Meta