NXWidgets  1.19
Public Member Functions | List of all members
NXWidgets::IListBox Class Referenceabstract

#include <ilistbox.hxx>

Inheritance diagram for NXWidgets::IListBox:
Inheritance graph

Public Member Functions

virtual ~IListBox (void)
 
virtual void addOption (const CNxString &text, const uint32_t value)=0
 
virtual void addOption (CListBoxDataItem *option)=0
 
virtual void removeOption (const int index)=0
 
virtual void removeAllOptions (void)=0
 
virtual void addOption (const CNxString &text, const uint32_t value, const nxwidget_pixel_t normalTextColor, const nxwidget_pixel_t normalBackColor, const nxwidget_pixel_t selectedTextColor, const nxwidget_pixel_t selectedBackColor)=0
 
virtual void selectOption (const int index)=0
 
virtual void deselectOption (const int index)=0
 
virtual void selectAllOptions (void)=0
 
virtual void deselectAllOptions (void)=0
 
virtual const int getSelectedIndex (void) const =0
 
virtual void setSelectedIndex (const int index)=0
 
virtual const CListBoxDataItemgetSelectedOption (void) const =0
 
virtual void setAllowMultipleSelections (const bool allowMultipleSelections)=0
 
virtual const bool allowsMultipleSelections (void) const =0
 
virtual const CListBoxDataItemgetOption (const int index)=0
 
virtual void sort (void)=0
 
virtual const int getOptionCount (void) const =0
 
virtual const nxgl_coord_t getOptionHeight (void) const =0
 
virtual void setSortInsertedItems (const bool sortInsertedItems)=0
 

Detailed Description

Defines the interface for ListBox classes.

Definition at line 102 of file ilistbox.hxx.

Constructor & Destructor Documentation

◆ ~IListBox()

virtual NXWidgets::IListBox::~IListBox ( void  )
inlinevirtual

A virtual destructor is required in order to override the IListBox destructor. We do this because if we delete IListBox, we want the destructor of the class that inherits from IListBox to run, not this one.

Definition at line 112 of file ilistbox.hxx.

Member Function Documentation

◆ addOption() [1/3]

virtual void NXWidgets::IListBox::addOption ( const CNxString text,
const uint32_t  value 
)
pure virtual

Add a new option to the widget using default colors.

Parameters
textText to show in the option.
valueThe value of the option.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ addOption() [2/3]

virtual void NXWidgets::IListBox::addOption ( CListBoxDataItem option)
pure virtual

Add an option to the widget.

Parameters
optionThe option to add.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ addOption() [3/3]

virtual void NXWidgets::IListBox::addOption ( const CNxString text,
const uint32_t  value,
const nxwidget_pixel_t  normalTextColor,
const nxwidget_pixel_t  normalBackColor,
const nxwidget_pixel_t  selectedTextColor,
const nxwidget_pixel_t  selectedBackColor 
)
pure virtual

Add a new option to the widget.

Parameters
textText to show in the option.
valueThe value of the option.
normalTextColorColor to draw the text with when not selected.
normalBackColorColor to draw the background with when not selected.
selectedTextColorColor to draw the text with when selected.
selectedBackColorColor to draw the background with when selected.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ allowsMultipleSelections()

virtual const bool NXWidgets::IListBox::allowsMultipleSelections ( void  ) const
pure virtual

Sets whether multiple selections are possible or not.

Returns
True if multiple selections are allowed.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ deselectAllOptions()

virtual void NXWidgets::IListBox::deselectAllOptions ( void  )
pure virtual

Deselect all options. Redraws the widget and raises a value changed event.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ deselectOption()

virtual void NXWidgets::IListBox::deselectOption ( const int  index)
pure virtual

Select an option by its index. Redraws the widget and raises a value changed event.

Parameters
indexThe index of the option to select.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ getOption()

virtual const CListBoxDataItem* NXWidgets::IListBox::getOption ( const int  index)
pure virtual

Get the specified option.

Returns
The specified option.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ getOptionCount()

virtual const int NXWidgets::IListBox::getOptionCount ( void  ) const
pure virtual

Get the total number of options.

Returns
The number of options.

Implemented in NXWidgets::CScrollingListBox, and NXWidgets::CListBox.

◆ getOptionHeight()

virtual const nxgl_coord_t NXWidgets::IListBox::getOptionHeight ( void  ) const
pure virtual

Get the height of a single option.

Returns
The height of an option.

Implemented in NXWidgets::CScrollingListBox, and NXWidgets::CListBox.

◆ getSelectedIndex()

virtual const int NXWidgets::IListBox::getSelectedIndex ( void  ) const
pure virtual

Get the selected index. Returns -1 if nothing is selected. If more than one option is selected, the index of the first selected option is returned.

Returns
The selected index.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ getSelectedOption()

virtual const CListBoxDataItem* NXWidgets::IListBox::getSelectedOption ( void  ) const
pure virtual

Get the selected option. Returns NULL if nothing is selected.

Returns
The selected option.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ removeAllOptions()

virtual void NXWidgets::IListBox::removeAllOptions ( void  )
pure virtual

Remove all options from the widget.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ removeOption()

virtual void NXWidgets::IListBox::removeOption ( const int  index)
pure virtual

Remove an option from the widget by its index.

Parameters
indexThe index of the option to remove.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ selectAllOptions()

virtual void NXWidgets::IListBox::selectAllOptions ( void  )
pure virtual

Select all options. Does nothing if the listbox does not allow multiple selections. Redraws the widget and raises a value changed event.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ selectOption()

virtual void NXWidgets::IListBox::selectOption ( const int  index)
pure virtual

Select an option by its index. Redraws the widget and raises a value changed event.

Parameters
indexThe index of the option to select.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ setAllowMultipleSelections()

virtual void NXWidgets::IListBox::setAllowMultipleSelections ( const bool  allowMultipleSelections)
pure virtual

Sets whether multiple selections are possible or not.

Parameters
allowMultipleSelectionsTrue to allow multiple selections.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ setSelectedIndex()

virtual void NXWidgets::IListBox::setSelectedIndex ( const int  index)
pure virtual

Sets the selected index. Specify -1 to select nothing. Resets any other selected options to deselected. Redraws the widget and raises a value changed event.

Parameters
indexThe selected index.

Implemented in NXWidgets::CListBox, and NXWidgets::CScrollingListBox.

◆ setSortInsertedItems()

virtual void NXWidgets::IListBox::setSortInsertedItems ( const bool  sortInsertedItems)
pure virtual

Sets whether or not items added to the list are automatically sorted on insert or not.

Parameters
sortInsertedItemsTrue to enable sort on insertion.

Implemented in NXWidgets::CScrollingListBox, and NXWidgets::CListBox.

◆ sort()

virtual void NXWidgets::IListBox::sort ( void  )
pure virtual

Sort the options alphabetically by the text of the options.

Implemented in NXWidgets::CScrollingListBox, and NXWidgets::CListBox.


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