FabGL
ESP32 VGA Controller and Graphics Library
fabgl::uiListBox Class Reference

Shows a list of selectable string items. More...

#include <fabui.h>

Inheritance diagram for fabgl::uiListBox:
Collaboration diagram for fabgl::uiListBox:

Public Member Functions

 uiListBox (uiWindow *parent, const Point &pos, const Size &size, bool visible=true)
 Creates an instance of the object. More...
 
uiAnchorsanchors ()
 Allows to switch on or off anchors. More...
 
uiAppapp ()
 Determines the app that owns this object. More...
 
void bringAfter (uiWindow *insertionPoint)
 Brings this window after another one. More...
 
void bringOnTop ()
 Brings this window on top. More...
 
Point clientPos ()
 Determines position of the client area. More...
 
Rect clientRect (uiOrigin origin)
 Determines the client area bounding box. More...
 
Size clientSize ()
 Determines the client area size. More...
 
void deselectAll ()
 Deselects all selected items. More...
 
void exitModal (int modalResult)
 Exits from a modal window. More...
 
uiWindowfirstChild ()
 Gets first child. More...
 
int firstSelectedItem ()
 Gets the first selected item. More...
 
int focusIndex ()
 Determines the focus index (aka tab-index) More...
 
bool hasChildren ()
 Determines whether this window has children. More...
 
bool hasFocus ()
 Determines whether this window or control has focus. More...
 
int HScrollBarPos ()
 Determines position of the horizontal scrollbar thumb. More...
 
int HScrollBarRange ()
 Determines horizontal scrollbar range. More...
 
int HScrollBarVisible ()
 Determines horizontal scrollbar visible portion (aka thumb size) of the scrollable content. More...
 
bool isMouseOver ()
 Determines whether the mouse is over this window. More...
 
StringList & items ()
 A list of strings representing the listbox content. More...
 
uiWindowlastChild ()
 Gets last child. More...
 
int lastSelectedItem ()
 Gets the last selected item. More...
 
uiListBoxStylelistBoxStyle ()
 Sets or gets listbox style. More...
 
Point mouseDownPos ()
 Determines mouse position when left button was down. More...
 
uiWindownext ()
 Gets next sibling. More...
 
uiObjectTypeobjectType ()
 Determines the object type. More...
 
uiWindowparent ()
 Determines the parent window. More...
 
Point pos ()
 Determines the window position relative to parent window. More...
 
uiWindowprev ()
 Gets previous sibling. More...
 
Rect rect (uiOrigin origin)
 Determines the window bounding box. More...
 
void repaint (Rect const &rect)
 Repaints a rectangle of this window. More...
 
void repaint ()
 Repaints this window. More...
 
uiScrollableControlStylescrollableControlStyle ()
 Sets or gets control style. More...
 
void selectItem (int index, bool add=false, bool range=false)
 Selects a listbox item. More...
 
void setFocusIndex (int value)
 Sets the focus index (aka tab-index) More...
 
Size size ()
 Determines the window size. More...
 
uiWindowState state ()
 Determines the window state. More...
 
Rect transformRect (Rect const &rect, uiWindow *baseWindow)
 Transforms rectangle origins from current window to another one. More...
 
int VScrollBarPos ()
 Determines position of the vertical scrollbar thumb. More...
 
int VScrollBarRange ()
 Determines vertical scrollbar range. More...
 
int VScrollBarVisible ()
 Determines vertical scrollbar visible portion (aka thumb size) of the scrollable content. More...
 
uiWindowPropswindowProps ()
 Sets or gets window properties. More...
 
uiWindowStylewindowStyle ()
 Sets or gets window style. More...
 

Public Attributes

Delegate onChange
 Change event delegate. More...
 
Delegate onChangeHScrollBar
 Horizontal scrollbar change event delegate. More...
 
Delegate onChangeVScrollBar
 Vertical scrollbar change event delegate. More...
 
Delegate onClick
 Mouse click event delegate. More...
 
Delegate onDblClick
 Mouse double click event delegate. More...
 
Delegate< uiKeyEventInfoonKeyUp
 Key-up event delegate. More...
 
Delegate onKillFocus
 Kill focus event delegate. More...
 

Protected Member Functions

void setScrollBar (uiOrientation orientation, int position, int visible, int range, bool repaintScrollbar)
 Sets scrollbar position, visible portion and range. More...
 

Detailed Description

Shows a list of selectable string items.

Constructor & Destructor Documentation

◆ uiListBox()

fabgl::uiListBox::uiListBox ( uiWindow parent,
const Point pos,
const Size size,
bool  visible = true 
)

Creates an instance of the object.

Parameters
parentThe parent window. A listbox must always have a parent window
posTop-left coordinates of the listbox relative to the parent
sizeThe listbox size
visibleIf true the listbox is immediately visible

Member Function Documentation

◆ anchors()

uiAnchors& fabgl::uiWindow::anchors ( )
inlineinherited

Allows to switch on or off anchors.

Returns
An L-value used to switch on or off anchors

◆ app()

uiApp* fabgl::uiEvtHandler::app ( )
inlineinherited

Determines the app that owns this object.

Returns
An uiApp object.

◆ bringAfter()

void fabgl::uiWindow::bringAfter ( uiWindow insertionPoint)
inherited

Brings this window after another one.

Parameters
insertionPointThis window will be placed after insertionPoint window. If insertionPoint is nullptr this window will be placed at the first position (location of less visibility.).

◆ bringOnTop()

void fabgl::uiWindow::bringOnTop ( )
inherited

Brings this window on top.

◆ clientPos()

Point fabgl::uiWindow::clientPos ( )
inherited

Determines position of the client area.

Returns
The top left point where the client area starts

◆ clientRect()

Rect fabgl::uiScrollableControl::clientRect ( uiOrigin  origin)
virtualinherited

Determines the client area bounding box.

Parameters
originDecides the origin of returned rectangle
Returns
The window client area bounding box

Reimplemented from fabgl::uiWindow.

◆ clientSize()

Size fabgl::uiWindow::clientSize ( )
inherited

Determines the client area size.

Returns
The client area size

◆ deselectAll()

void fabgl::uiCustomListBox::deselectAll ( )
inherited

Deselects all selected items.

◆ exitModal()

void fabgl::uiWindow::exitModal ( int  modalResult)
inherited

Exits from a modal window.

To open a modal window use uiApp.showModalWindow().

Parameters
modalResultAn integer value to return to uiApp.showModalWindow().

◆ firstChild()

uiWindow* fabgl::uiWindow::firstChild ( )
inlineinherited

Gets first child.

Returns
First uiWindow object

◆ firstSelectedItem()

int fabgl::uiCustomListBox::firstSelectedItem ( )
inherited

Gets the first selected item.

Returns
Index of selected item or -1 if no item is selected

◆ focusIndex()

int fabgl::uiWindow::focusIndex ( )
inlineinherited

Determines the focus index (aka tab-index)

To set focus index use uiWindow.setFocusIndex().

Returns
The focus index

◆ hasChildren()

bool fabgl::uiWindow::hasChildren ( )
inlineinherited

Determines whether this window has children.

Returns
True if window has one o more children

◆ hasFocus()

bool fabgl::uiWindow::hasFocus ( )
inherited

Determines whether this window or control has focus.

To set currently focused window use uiApp.setFocusedWindow().

Returns
True if this window has focus

◆ HScrollBarPos()

int fabgl::uiScrollableControl::HScrollBarPos ( )
inlineinherited

Determines position of the horizontal scrollbar thumb.

Minimum value is 0, maximum value is HScrollBarRange() - HScrollBarVisible(). Position is measured in "scroll units". A scroll unit is determined by scrollbar size.

Returns
Scrollbar position in scroll units

◆ HScrollBarRange()

int fabgl::uiScrollableControl::HScrollBarRange ( )
inlineinherited

Determines horizontal scrollbar range.

Range is the maximum position of the scrollbar. Maximum value of scrollbar position will HScrollBarRange() - HScrollBarVisible(). Range is measured in "scroll units". A scroll unit is determined by scrollbar size.

Returns
Scrollbar range in scroll units.

◆ HScrollBarVisible()

int fabgl::uiScrollableControl::HScrollBarVisible ( )
inlineinherited

Determines horizontal scrollbar visible portion (aka thumb size) of the scrollable content.

Visible portion is measured in "scroll units". A scroll unit is determined by scrollbar size.

Returns
Scrollbar visible portion in scroll units

◆ isMouseOver()

bool fabgl::uiWindow::isMouseOver ( )
inlineinherited

Determines whether the mouse is over this window.

This methods returns True also when the mouse is captured.

Returns
True if the mouse is over the window

◆ items()

StringList& fabgl::uiListBox::items ( )
inline

A list of strings representing the listbox content.

Other than actual strings, StringList indicates which items are selected. Repainting is required when the string list changes.

Returns
L-value representing listbox items

◆ lastChild()

uiWindow* fabgl::uiWindow::lastChild ( )
inlineinherited

Gets last child.

Returns
Last uiWindow object

◆ lastSelectedItem()

int fabgl::uiCustomListBox::lastSelectedItem ( )
inherited

Gets the last selected item.

Returns
Index of selected item or -1 if no item is selected

◆ listBoxStyle()

uiListBoxStyle& fabgl::uiCustomListBox::listBoxStyle ( )
inlineinherited

Sets or gets listbox style.

Returns
L-value representing listbox style

◆ mouseDownPos()

Point fabgl::uiWindow::mouseDownPos ( )
inlineinherited

Determines mouse position when left button was down.

Returns
Mouse position

◆ next()

uiWindow* fabgl::uiWindow::next ( )
inlineinherited

Gets next sibling.

Next sibling is more visible than calling object.

Returns
Next uiWindow object

◆ objectType()

uiObjectType& fabgl::uiObject::objectType ( )
inlineinherited

Determines the object type.

Returns
Object type.

◆ parent()

uiWindow* fabgl::uiWindow::parent ( )
inlineinherited

Determines the parent window.

Returns
Parent window

◆ pos()

Point fabgl::uiWindow::pos ( )
inlineinherited

Determines the window position relative to parent window.

To change window position use uiApp.moveWindow().

Returns
The top left point where this window is located

◆ prev()

uiWindow* fabgl::uiWindow::prev ( )
inlineinherited

Gets previous sibling.

Previous sibling is less visible than calling object.

Returns
Previous uiWindow object

◆ rect()

Rect fabgl::uiWindow::rect ( uiOrigin  origin)
inherited

Determines the window bounding box.

To set window position use uiApp.moveWindow(), to set window size use uiApp.resizeWindow() or uiApp.reshapeWindow().

Parameters
originDecides the origin of returned rectangle
Returns
The window bounding box

◆ repaint() [1/2]

void fabgl::uiWindow::repaint ( Rect const &  rect)
inherited

Repaints a rectangle of this window.

Parameters
rectRectangle to repaint

◆ repaint() [2/2]

void fabgl::uiWindow::repaint ( )
inherited

Repaints this window.

◆ scrollableControlStyle()

uiScrollableControlStyle& fabgl::uiScrollableControl::scrollableControlStyle ( )
inlineinherited

Sets or gets control style.

Returns
L-value representing control style (colors, scrollbars width, etc...)

◆ selectItem()

void fabgl::uiCustomListBox::selectItem ( int  index,
bool  add = false,
bool  range = false 
)
inherited

Selects a listbox item.

Parameters
indexIndex of item to select
addIf true this item is added to the selected items, otherwise all other items are deselected
rangeIf true selects a range of items

◆ setFocusIndex()

void fabgl::uiWindow::setFocusIndex ( int  value)
inlineinherited

Sets the focus index (aka tab-index)

Parameters
valueThe focus index. -1 = control isn't included into the focusable controls. 0 = first focusable control.

◆ setScrollBar()

void fabgl::uiCustomListBox::setScrollBar ( uiOrientation  orientation,
int  position,
int  visible,
int  range,
bool  repaintScrollbar 
)
protectedvirtualinherited

Sets scrollbar position, visible portion and range.

Parameters
orientationSpecifies which scrollbar to update
positionSets position of the scrollbar thumb. Minimum value is 0, maximum value is range - visible. Position is measured in "scroll units". A scroll unit is determined by scrollbar size.
visibleSets scrollbar visible portion (aka thumb size) of the scrollable content. Visible portion is measured in "scroll units". A scroll unit is determined by scrollbar size.
rangeSets vertical scrollbar range. Range is the maximum position of the scrollbar. Maximum value of scrollbar position will range - visible.
repaintScrollbarIf True the scrollbar is repainted immediately.

Reimplemented from fabgl::uiScrollableControl.

◆ size()

Size fabgl::uiWindow::size ( )
inlineinherited

Determines the window size.

To set window size use uiApp.resizeWindow().

Returns
The window size

◆ state()

uiWindowState fabgl::uiWindow::state ( )
inlineinherited

Determines the window state.

To set window state (hidden, visible, maximized, minimized) use uiApp.showWindow(), uiApp.maximizeWindow(), uiApp.minimizeWindow().

Returns
Current window state

◆ transformRect()

Rect fabgl::uiWindow::transformRect ( Rect const &  rect,
uiWindow baseWindow 
)
inherited

Transforms rectangle origins from current window to another one.

Parameters
rectRectangle to transform
baseWindowWindow where the output rectangle will be relative to
Returns
The translated rectangle

◆ VScrollBarPos()

int fabgl::uiScrollableControl::VScrollBarPos ( )
inlineinherited

Determines position of the vertical scrollbar thumb.

Minimum value is 0, maximum value is VScrollBarRange() - VScrollBarVisible(). Position is measured in "scroll units". A scroll unit is determined by scrollbar size.

Returns
Scrollbar position in scroll units

◆ VScrollBarRange()

int fabgl::uiScrollableControl::VScrollBarRange ( )
inlineinherited

Determines vertical scrollbar range.

Range is the maximum position of the scrollbar. Maximum value of scrollbar position will VScrollBarRange() - VScrollBarVisible(). Range is measured in "scroll units". A scroll unit is determined by scrollbar size.

Returns
Scrollbar range in scroll units.

◆ VScrollBarVisible()

int fabgl::uiScrollableControl::VScrollBarVisible ( )
inlineinherited

Determines vertical scrollbar visible portion (aka thumb size) of the scrollable content.

Visible portion is measured in "scroll units". A scroll unit is determined by scrollbar size.

Returns
Scrollbar visible portion in scroll units

◆ windowProps()

uiWindowProps& fabgl::uiWindow::windowProps ( )
inlineinherited

Sets or gets window properties.

Returns
L-value representing some window properties

◆ windowStyle()

uiWindowStyle& fabgl::uiWindow::windowStyle ( )
inlineinherited

Sets or gets window style.

Returns
L-value representing window style (colors, border size, etc...)

Member Data Documentation

◆ onChange

Delegate fabgl::uiCustomListBox::onChange
inherited

Change event delegate.

This delegate is called whenever an item is selected or deselected.

◆ onChangeHScrollBar

Delegate fabgl::uiScrollableControl::onChangeHScrollBar
inherited

Horizontal scrollbar change event delegate.

◆ onChangeVScrollBar

Delegate fabgl::uiScrollableControl::onChangeVScrollBar
inherited

Vertical scrollbar change event delegate.

◆ onClick

Delegate fabgl::uiWindow::onClick
inherited

Mouse click event delegate.

This delegate is called when the mouse button is pressed and released on the same position.

◆ onDblClick

Delegate fabgl::uiWindow::onDblClick
inherited

Mouse double click event delegate.

This delegate is called when the mouse button is double pressed and released on the same position. To change double click time use uiAppProps.doubleClickTime of uiApp.appProps().

◆ onKeyUp

Delegate<uiKeyEventInfo> fabgl::uiCustomListBox::onKeyUp
inherited

Key-up event delegate.

◆ onKillFocus

Delegate fabgl::uiCustomListBox::onKillFocus
inherited

Kill focus event delegate.


The documentation for this class was generated from the following files: