NXWidgets  1.19
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NXWidgets::CScrollingListBox Class Reference

#include <cscrollinglistbox.hxx>

Inheritance diagram for NXWidgets::CScrollingListBox:
Inheritance graph

Public Member Functions

 CScrollingListBox (CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, CWidgetStyle *style=(CWidgetStyle *) NULL)
 
virtual void addOption (const CNxString &text, const uint32_t value)
 
virtual void addOption (CListBoxDataItem *option)
 
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)
 
virtual void removeOption (const int index)
 
virtual void removeAllOptions (void)
 
virtual void selectOption (const int index)
 
virtual void deselectOption (const int index)
 
virtual void selectAllOptions (void)
 
virtual void deselectAllOptions (void)
 
virtual const int getSelectedIndex (void) const
 
virtual void setSelectedIndex (const int index)
 
virtual const CListBoxDataItemgetSelectedOption (void) const
 
virtual void setAllowMultipleSelections (const bool allowMultipleSelections)
 
virtual const bool allowsMultipleSelections (void) const
 
virtual void resizeCanvas (void)
 
virtual const CListBoxDataItemgetOption (const int index)
 
virtual const CListBoxDataItemgetOption (const int index) const
 
virtual void sort (void)
 
virtual const int getOptionCount (void) const
 
virtual const nxgl_coord_t getOptionHeight (void) const
 
virtual void handleValueChangeEvent (const CWidgetEventArgs &e)
 
virtual void handleActionEvent (const CWidgetEventArgs &e)
 
virtual void handleScrollEvent (const CWidgetEventArgs &e)
 
virtual void handleClickEvent (const CWidgetEventArgs &e)
 
virtual void handleDoubleClickEvent (const CWidgetEventArgs &e)
 
virtual void handleReleaseEvent (const CWidgetEventArgs &e)
 
virtual void handleReleaseOutsideEvent (const CWidgetEventArgs &e)
 
virtual void setFont (CNxFont *font)
 
virtual void setSortInsertedItems (const bool sortInsertedItems)
 
virtual void getPreferredDimensions (CRect &rect) const
 
- Public Member Functions inherited from NXWidgets::IListBox
virtual ~IListBox (void)
 
- Public Member Functions inherited from NXWidgets::CNxWidget
 CNxWidget (CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, uint32_t flags, FAR const CWidgetStyle *style=(FAR const CWidgetStyle *) NULL)
 
virtual ~CNxWidget (void)
 
nxgl_coord_t getX (void) const
 
nxgl_coord_t getY (void) const
 
nxgl_coord_t getRelativeX (void) const
 
nxgl_coord_t getRelativeY (void) const
 
bool hasFocus (void) const
 
bool isDeleted (void) const
 
bool isDrawingEnabled (void) const
 
bool isHidden (void) const
 
bool isEnabled (void) const
 
bool isPermeable (void) const
 
bool isDoubleClickable (void) const
 
bool isBorderless (void) const
 
bool isClicked (void) const
 
bool isBeingDragged (void) const
 
nxgl_coord_t getWidth (void) const
 
nxgl_coord_t getHeight (void) const
 
void getSize (struct nxgl_size_s &size) const
 
void getPos (struct nxgl_point_s &pos) const
 
CRect getBoundingBox (void)
 
void getBorderSize (WidgetBorderSize &borderSize)
 
CNxWidgetgetParent (void) const
 
CNxWidgetgetFocusedWidget (void)
 
void getClientRect (CRect &rect) const
 
void getRect (CRect &rect) const
 
CNxFontgetFont (void) const
 
nxgl_mxpixel_t getBackgroundColor (void) const
 
nxgl_mxpixel_t getSelectedBackgroundColor (void) const
 
nxgl_mxpixel_t getShineEdgeColor (void) const
 
nxgl_mxpixel_t getShadowEdgeColor (void) const
 
nxgl_mxpixel_t getHighlightColor (void) const
 
nxgl_mxpixel_t getDisabledTextColor (void) const
 
nxgl_mxpixel_t getEnabledTextColor (void) const
 
nxgl_mxpixel_t getSelectedTextColor (void) const
 
const CWidgetStylegetWidgetStyle () const
 
void setBorderless (bool isBorderless)
 
void setDraggable (bool isDraggable)
 
void setPermeable (bool permeable)
 
void setDoubleClickable (bool doubleClickable)
 
void addWidgetEventHandler (CWidgetEventHandler *eventHandler)
 
void removeWidgetEventHandler (CWidgetEventHandler *eventHandler)
 
int nWidgetEventHandlers (void) const
 
void setRaisesEvents (bool raises)
 
bool raisesEvents (void) const
 
void disableDrawing (void)
 
void enableDrawing (void)
 
void setBackgroundColor (nxgl_mxpixel_t color)
 
void setSelectedBackgroundColor (nxgl_mxpixel_t color)
 
void setShineEdgeColor (nxgl_mxpixel_t color)
 
void setShadowEdgeColor (nxgl_mxpixel_t color)
 
void setHighlightColor (nxgl_mxpixel_t color)
 
void setDisabledTextColor (nxgl_mxpixel_t color)
 
void setEnabledTextColor (nxgl_mxpixel_t color)
 
void setSelectedTextColor (nxgl_mxpixel_t color)
 
void redraw (void)
 
bool enable (void)
 
bool disable (void)
 
void close (void)
 
bool show (void)
 
bool hide (void)
 
virtual bool click (nxgl_coord_t x, nxgl_coord_t y)
 
virtual bool isDoubleClick (nxgl_coord_t x, nxgl_coord_t y)
 
bool doubleClick (nxgl_coord_t x, nxgl_coord_t y)
 
bool release (nxgl_coord_t x, nxgl_coord_t y)
 
bool drag (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t vX, nxgl_coord_t vY)
 
bool keyPress (nxwidget_char_t key)
 
bool cursorControl (ECursorControl control)
 
bool focus (void)
 
bool blur (void)
 
bool moveTo (nxgl_coord_t x, nxgl_coord_t y)
 
bool resize (nxgl_coord_t width, nxgl_coord_t height)
 
bool changeDimensions (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height)
 
void moveChildToDeleteQueue (CNxWidget *widget)
 
void setFocusedWidget (CNxWidget *widget)
 
virtual bool checkCollision (nxgl_coord_t x, nxgl_coord_t y) const
 
virtual bool checkCollision (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height) const
 
bool checkCollision (CNxWidget *widget) const
 
void addWidget (CNxWidget *widget)
 
void insertWidget (CNxWidget *widget)
 
void setParent (CNxWidget *parent)
 
void destroy (void)
 
bool remove (void)
 
bool removeChild (CNxWidget *widget)
 
const CNxWidgetgetChild (int index) const
 
int getChildCount (void) const
 
void setBorderSize (const WidgetBorderSize &borderSize)
 
- Public Member Functions inherited from NXWidgets::CWidgetEventHandler
 CWidgetEventHandler ()
 
virtual ~CWidgetEventHandler ()
 
virtual void handleDragEvent (const CWidgetEventArgs &e)
 
virtual void handleDropEvent (const CWidgetEventArgs &e)
 
virtual void handleKeyPressEvent (const CWidgetEventArgs &e)
 
virtual void handleCursorControlEvent (const CWidgetEventArgs &e)
 
virtual void handleFocusEvent (const CWidgetEventArgs &e)
 
virtual void handleBlurEvent (const CWidgetEventArgs &e)
 
virtual void handleCloseEvent (const CWidgetEventArgs &e)
 
virtual void handleHideEvent (const CWidgetEventArgs &e)
 
virtual void handleShowEvent (const CWidgetEventArgs &e)
 
virtual void handleEnableEvent (const CWidgetEventArgs &e)
 
virtual void handleDisableEvent (const CWidgetEventArgs &e)
 
virtual void handleResizeEvent (const CWidgetEventArgs &e)
 
virtual void handleMoveEvent (const CWidgetEventArgs &e)
 

Protected Member Functions

virtual void drawContents (CGraphicsPort *port)
 
virtual void onResize (nxgl_coord_t width, nxgl_coord_t height)
 
virtual ~CScrollingListBox (void)
 
 CScrollingListBox (const CScrollingListBox &scrollingListBox)
 
- Protected Member Functions inherited from NXWidgets::CNxWidget
void useWidgetStyle (const CWidgetStyle *style)
 
virtual void drawBorder (CGraphicsPort *port)
 
void drawChildren (void)
 
void closeChild (CNxWidget *widget)
 
void startDragging (nxgl_coord_t x, nxgl_coord_t y)
 
void stopDragging (nxgl_coord_t x, nxgl_coord_t y)
 
 CNxWidget (const CNxWidget &widget)
 
virtual void onClick (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onDoubleClick (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onPreRelease (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onRelease (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onReleaseOutside (nxgl_coord_t x, nxgl_coord_t y)
 
virtual void onDrag (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t vX, nxgl_coord_t vY)
 
virtual void onDragStart (void)
 
virtual void onDragStop (void)
 
virtual void onFocus (void)
 
virtual void onBlur (void)
 
virtual void onEnable (void)
 
virtual void onDisable (void)
 

Protected Attributes

CListBoxm_listbox
 
CScrollbarVerticalm_scrollbar
 
uint8_t m_scrollbarWidth
 
- Protected Attributes inherited from NXWidgets::CNxWidget
CWidgetControlm_widgetControl
 
CRect m_rect
 
nxgl_coord_t m_grabPointX
 
nxgl_coord_t m_grabPointY
 
nxgl_coord_t m_newX
 
nxgl_coord_t m_newY
 
CWidgetStyle m_style
 
Flags m_flags
 
CWidgetEventHandlerListm_widgetEventHandlers
 
struct timespec m_lastClickTime
 
nxgl_coord_t m_lastClickX
 
nxgl_coord_t m_lastClickY
 
int m_doubleClickBounds
 
CNxWidgetm_parent
 
CNxWidgetm_focusedChild
 
TNxArray< CNxWidget * > m_children
 
WidgetBorderSize m_borderSize
 

Additional Inherited Members

- Public Types inherited from NXWidgets::CNxWidget
enum  WidgetFlagType {
  WIDGET_BORDERLESS = 0x0001, WIDGET_DRAGGABLE = 0x0002, WIDGET_PERMEABLE = 0x0004, WIDGET_DOUBLE_CLICKABLE = 0x0008,
  WIDGET_NO_RAISE_EVENTS = 0x0010
}
 

Detailed Description

Widget containing a CListBox and a vertical scrollbar. Exposed methods are more or less identical to the methods exposed by the CListBox to ensure that the two are interchangeable.

Definition at line 113 of file cscrollinglistbox.hxx.

Constructor & Destructor Documentation

◆ ~CScrollingListBox()

virtual NXWidgets::CScrollingListBox::~CScrollingListBox ( void  )
inlineprotectedvirtual

Destructor.

Definition at line 144 of file cscrollinglistbox.hxx.

◆ CScrollingListBox() [1/2]

NXWidgets::CScrollingListBox::CScrollingListBox ( const CScrollingListBox scrollingListBox)
inlineprotected

Copy constructor is protected to prevent usage.

Definition at line 150 of file cscrollinglistbox.hxx.

◆ CScrollingListBox() [2/2]

CScrollingListBox::CScrollingListBox ( CWidgetControl pWidgetControl,
nxgl_coord_t  x,
nxgl_coord_t  y,
nxgl_coord_t  width,
nxgl_coord_t  height,
CWidgetStyle style = (CWidgetStyle *)NULL 
)

Constructor.

Parameters
pWidgetControlThe widget control for the display.
xThe x coordinate of the widget.
yThe y coordinate of the widget.
widthThe width of the widget.
heightThe height of the widget.
styleThe style that the widget should use. If this is not specified, the widget will use the values stored in the global g_defaultWidgetStyle object. The widget will copy the properties of the style into its own internal style object.

Definition at line 107 of file cscrollinglistbox.cxx.

Member Function Documentation

◆ addOption() [1/3]

void CScrollingListBox::addOption ( const CNxString text,
const uint32_t  value 
)
virtual

Add a new option to the widget using default colors.

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

Implements NXWidgets::IListBox.

Definition at line 145 of file cscrollinglistbox.cxx.

◆ addOption() [2/3]

void CScrollingListBox::addOption ( CListBoxDataItem item)
virtual

Add an option to the widget.

Parameters
optionThe option to add.

Implements NXWidgets::IListBox.

Definition at line 157 of file cscrollinglistbox.cxx.

◆ addOption() [3/3]

void CScrollingListBox::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 
)
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.

Implements NXWidgets::IListBox.

Definition at line 174 of file cscrollinglistbox.cxx.

◆ allowsMultipleSelections()

virtual const bool NXWidgets::CScrollingListBox::allowsMultipleSelections ( void  ) const
inlinevirtual

Sets whether multiple selections are possible or not.

Returns
True if multiple selections are allowed.

Implements NXWidgets::IListBox.

Definition at line 320 of file cscrollinglistbox.hxx.

◆ deselectAllOptions()

virtual void NXWidgets::CScrollingListBox::deselectAllOptions ( void  )
inlinevirtual

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

Implements NXWidgets::IListBox.

Definition at line 261 of file cscrollinglistbox.hxx.

◆ deselectOption()

virtual void NXWidgets::CScrollingListBox::deselectOption ( const int  index)
inlinevirtual

Select an option by its index. Does not deselect any other selected options. Redraws the widget and raises a value changed event.

Parameters
indexThe index of the option to select.

Implements NXWidgets::IListBox.

Definition at line 241 of file cscrollinglistbox.hxx.

◆ drawContents()

void CScrollingListBox::drawContents ( CGraphicsPort port)
protectedvirtual

Draw the area of this widget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters
portThe CGraphicsPort to draw to.
See also
redraw()

Reimplemented from NXWidgets::CNxWidget.

Definition at line 383 of file cscrollinglistbox.cxx.

◆ getOption() [1/2]

virtual const CListBoxDataItem* NXWidgets::CScrollingListBox::getOption ( const int  index)
inlinevirtual

Get the specified option.

Returns
The specified option.

Implements NXWidgets::IListBox.

Definition at line 340 of file cscrollinglistbox.hxx.

◆ getOption() [2/2]

virtual const CListBoxDataItem* NXWidgets::CScrollingListBox::getOption ( const int  index) const
inlinevirtual

Get the selected index. Returns -1 if nothing is selected.

Returns
The selected index.

Definition at line 351 of file cscrollinglistbox.hxx.

◆ getOptionCount()

virtual const int NXWidgets::CScrollingListBox::getOptionCount ( void  ) const
inlinevirtual

Get the total number of options.

Returns
The number of options.

Implements NXWidgets::IListBox.

Definition at line 371 of file cscrollinglistbox.hxx.

◆ getOptionHeight()

virtual const nxgl_coord_t NXWidgets::CScrollingListBox::getOptionHeight ( void  ) const
inlinevirtual

Get the height of a single option.

Returns
The height of an option.

Implements NXWidgets::IListBox.

Definition at line 382 of file cscrollinglistbox.hxx.

◆ getPreferredDimensions()

void CScrollingListBox::getPreferredDimensions ( CRect rect) const
virtual

Insert the dimensions that this widget wants to have into the rect passed in as a parameter. All coordinates are relative to the widget's parent. Value is based on the length of the largest string in the set of options.

Parameters
rectReference to a rect to populate with data.

Reimplemented from NXWidgets::CNxWidget.

Definition at line 363 of file cscrollinglistbox.cxx.

◆ getSelectedIndex()

virtual const int NXWidgets::CScrollingListBox::getSelectedIndex ( void  ) const
inlinevirtual

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.

Implements NXWidgets::IListBox.

Definition at line 273 of file cscrollinglistbox.hxx.

◆ getSelectedOption()

virtual const CListBoxDataItem* NXWidgets::CScrollingListBox::getSelectedOption ( void  ) const
inlinevirtual

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

Returns
The selected option.

Implements NXWidgets::IListBox.

Definition at line 297 of file cscrollinglistbox.hxx.

◆ handleActionEvent()

void CScrollingListBox::handleActionEvent ( const CWidgetEventArgs e)
virtual

Handle a widget action event.

Parameters
eThe event data.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 247 of file cscrollinglistbox.cxx.

◆ handleClickEvent()

void CScrollingListBox::handleClickEvent ( const CWidgetEventArgs e)
virtual

Handle a mouse button click event.

Parameters
eThe event data.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 291 of file cscrollinglistbox.cxx.

◆ handleDoubleClickEvent()

void CScrollingListBox::handleDoubleClickEvent ( const CWidgetEventArgs e)
virtual

Handles events raised by its sub-widgets.

Parameters
eEvent arguments.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 302 of file cscrollinglistbox.cxx.

◆ handleReleaseEvent()

void CScrollingListBox::handleReleaseEvent ( const CWidgetEventArgs e)
virtual

Handle a mouse button release event that occurred within the bounds of the source widget.

Parameters
eThe event data.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 314 of file cscrollinglistbox.cxx.

◆ handleReleaseOutsideEvent()

void CScrollingListBox::handleReleaseOutsideEvent ( const CWidgetEventArgs e)
virtual

Handle a mouse button release event that occurred outside the bounds of the source widget.

Parameters
eThe event data.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 326 of file cscrollinglistbox.cxx.

◆ handleScrollEvent()

void CScrollingListBox::handleScrollEvent ( const CWidgetEventArgs e)
virtual

Handles events raised by its sub-widgets.

Parameters
eEvent arguments.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 266 of file cscrollinglistbox.cxx.

◆ handleValueChangeEvent()

void CScrollingListBox::handleValueChangeEvent ( const CWidgetEventArgs e)
virtual

Handles events raised by its sub-widgets.

Parameters
eEvent arguments.

Reimplemented from NXWidgets::CWidgetEventHandler.

Definition at line 221 of file cscrollinglistbox.cxx.

◆ onResize()

void CScrollingListBox::onResize ( nxgl_coord_t  width,
nxgl_coord_t  height 
)
protectedvirtual

Resize the listbox to the new dimensions.

Parameters
widthThe new width.
heightThe new height.

Reimplemented from NXWidgets::CNxWidget.

Definition at line 395 of file cscrollinglistbox.cxx.

◆ removeAllOptions()

void CScrollingListBox::removeAllOptions ( void  )
virtual

Remove all options from the widget.

Implements NXWidgets::IListBox.

Definition at line 208 of file cscrollinglistbox.cxx.

◆ removeOption()

void CScrollingListBox::removeOption ( const int  index)
virtual

Remove an option from the widget by its index.

Parameters
indexThe index of the option to remove.

Implements NXWidgets::IListBox.

Definition at line 191 of file cscrollinglistbox.cxx.

◆ resizeCanvas()

virtual void NXWidgets::CScrollingListBox::resizeCanvas ( void  )
inlinevirtual

Resize the scrolling canvas to encompass all options.

Definition at line 329 of file cscrollinglistbox.hxx.

◆ selectAllOptions()

virtual void NXWidgets::CScrollingListBox::selectAllOptions ( void  )
inlinevirtual

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

Implements NXWidgets::IListBox.

Definition at line 251 of file cscrollinglistbox.hxx.

◆ selectOption()

virtual void NXWidgets::CScrollingListBox::selectOption ( const int  index)
inlinevirtual

Select an option by its index. Does not deselect any other selected options. Redraws the widget and raises a value changed event.

Parameters
indexThe index of the option to select.

Implements NXWidgets::IListBox.

Definition at line 229 of file cscrollinglistbox.hxx.

◆ setAllowMultipleSelections()

virtual void NXWidgets::CScrollingListBox::setAllowMultipleSelections ( const bool  allowMultipleSelections)
inlinevirtual

Sets whether multiple selections are possible or not.

Parameters
allowMultipleSelectionsTrue to allow multiple selections.

Implements NXWidgets::IListBox.

Definition at line 309 of file cscrollinglistbox.hxx.

◆ setFont()

void CScrollingListBox::setFont ( CNxFont font)
virtual

Set the font used in the textbox.

Parameters
fontPointer to the new font.

Reimplemented from NXWidgets::CNxWidget.

Definition at line 347 of file cscrollinglistbox.cxx.

◆ setSelectedIndex()

virtual void NXWidgets::CScrollingListBox::setSelectedIndex ( const int  index)
inlinevirtual

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

Parameters
indexThe selected index.

Implements NXWidgets::IListBox.

Definition at line 286 of file cscrollinglistbox.hxx.

◆ setSortInsertedItems()

virtual void NXWidgets::CScrollingListBox::setSortInsertedItems ( const bool  sortInsertedItems)
inlinevirtual

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

Parameters
sortInsertedItemsTrue to enable sort on insertion.

Implements NXWidgets::IListBox.

Definition at line 460 of file cscrollinglistbox.hxx.

◆ sort()

virtual void NXWidgets::CScrollingListBox::sort ( void  )
inlinevirtual

Sort the options alphabetically by the text of the options.

Implements NXWidgets::IListBox.

Definition at line 360 of file cscrollinglistbox.hxx.

Member Data Documentation

◆ m_listbox

CListBox* NXWidgets::CScrollingListBox::m_listbox
protected

Pointer to the list box.

Definition at line 117 of file cscrollinglistbox.hxx.

◆ m_scrollbar

CScrollbarVertical* NXWidgets::CScrollingListBox::m_scrollbar
protected

Pointer to the scrollbar.

Definition at line 118 of file cscrollinglistbox.hxx.

◆ m_scrollbarWidth

uint8_t NXWidgets::CScrollingListBox::m_scrollbarWidth
protected

Width of the scrollbar.

Definition at line 119 of file cscrollinglistbox.hxx.


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