NXWidgets: NXWidgets::CButtonArray Class Reference

NXWidgets 1.19

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

`#include <cbuttonarray.hxx>`

Inheritance diagram for NXWidgets::CButtonArray:

## Public Member Functions
| CButtonArray (CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y, uint8_t buttonColumns, uint8_t buttonRows, nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight, CWidgetStyle *style=(CWidgetStyle *) NULL)
| ~CButtonArray (void)
virtual const CNxString & | getText (int column, int row) const
virtual void | setText (int column, int row, const CNxString &text)
virtual bool | isButtonClicked (int &column, int &row) const
virtual bool | isThisButtonClicked (int column, int row) const
virtual void | cursor (bool cursorOn)
virtual bool | getCursorPosition (int &column, int &row) const
virtual bool | setCursorPosition (int column, int row)
virtual bool | isCursorPosition (int column, int row) const
virtual void | getPreferredDimensions (CRect &rect) const
virtual void | setFont (CNxFont *font)
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)
CNxWidget * | getParent (void) const
CNxWidget * | getFocusedWidget (void)
void | getClientRect (CRect &rect) const
void | getRect (CRect &rect) const
CNxFont * | getFont (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 CWidgetStyle * | getWidgetStyle () 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 CNxWidget * | getChild (int index) const
int | getChildCount (void) const
void | setBorderSize (const WidgetBorderSize &borderSize)

## Protected Member Functions
virtual void | drawContents (CGraphicsPort *port)
virtual void | drawBorder (CGraphicsPort *port)
virtual void | drawButton (CGraphicsPort *port, int column, int row, bool useClicked)
virtual void | onClick (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 bool | posToButton (nxgl_coord_t x, nxgl_coord_t y, int &column, int &row)
virtual void | onTextChange (void)
| CButtonArray (const CButtonArray &button)
Protected Member Functions inherited from NXWidgets::CNxWidget
void | useWidgetStyle (const CWidgetStyle *style)
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 | onDoubleClick (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)
virtual void | onResize (nxgl_coord_t width, nxgl_coord_t height)

## Protected Attributes
uint8_t | m_buttonColumns
uint8_t | m_buttonRows
bool | m_redrawButton
bool | m_cursorOn
bool | m_cursorChange
nxgl_coord_t | m_buttonWidth
nxgl_coord_t | m_buttonHeight
nxgl_coord_t | m_clickX
nxgl_coord_t | m_clickY
uint8_t | m_cursorColumn
uint8_t | m_cursorRow
CNxString * | m_buttonText
Protected Attributes inherited from NXWidgets::CNxWidget
CWidgetControl * | m_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
CWidgetEventHandlerList * | m_widgetEventHandlers
struct timespec | m_lastClickTime
nxgl_coord_t | m_lastClickX
nxgl_coord_t | m_lastClickY
int | m_doubleClickBounds
CNxWidget * | m_parent
CNxWidget * | m_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

Manages a two-dimensional array of buttons as one widget. A two- dimensional array of buttons might also be called a "keyboard".

Definition at line 77 of file cbuttonarray.hxx.

## Constructor & Destructor Documentation

## ◆ CButtonArray() [1/2]

NXWidgets::CButtonArray::CButtonArray | ( | const CButtonArray & | button | ) |
| inlineprotected

Copy constructor is protected to prevent usage.

Definition at line 186 of file cbuttonarray.hxx.

## ◆ CButtonArray() [2/2]

CButtonArray::CButtonArray | ( | CWidgetControl * | pWidgetControl,
|  | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | uint8_t | buttonColumns,
|  | uint8_t | buttonRows,
|  | nxgl_coord_t | buttonWidth,
|  | nxgl_coord_t | buttonHeight,
|  | CWidgetStyle * | style = `(CWidgetStyle *)NULL`
| ) |  |

Constructor for an array of buttons.

Parameters

  pWidgetControl | The widget control for the display.
  x | The x coordinate of the button array, relative to its parent.
  y | The y coordinate of the button array, relative to its parent.
  buttonColumns | The number of buttons in one row of the button array
  buttonRows | The number of buttons in one column of the button array
  buttonWidth | The width of one button
  buttonHeight | The height of one button
  style | The style that the button should use. If this is not specified, the button will use the global default widget style.

Definition at line 76 of file cbuttonarray.cxx.

## ◆ ~CButtonArray()

CButtonArray::~CButtonArray | ( | void |  | ) |

CButtonArray Destructor.

Definition at line 121 of file cbuttonarray.cxx.

## Member Function Documentation

## ◆ cursor()

void CButtonArray::cursor | ( | bool | cursorOn | ) |
| virtual

Control the cursor state.

Parameters

  cursorOn | True(1), the current cursor position will be highlighted

Definition at line 220 of file cbuttonarray.cxx.

## ◆ drawBorder()

void CButtonArray::drawBorder | ( | 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

  port | The CGraphicsPort to draw to.

See also
  redraw()

Reimplemented from NXWidgets::CNxWidget.

Definition at line 420 of file cbuttonarray.cxx.

## ◆ drawButton()

void CButtonArray::drawButton | ( | CGraphicsPort * | port,
|  | int | column,
|  | int | row,
|  | bool | useClicked
| ) |  |
| protectedvirtual

Redraw only one button

Parameters

  port | The CGraphicsPort to draw to.
  column | The button column index
  row | The button row index
  useClicked | Draw the button using the 'clicked' button style, regardless of the actual button state.

See also
  onClick() and onRelease()

Definition at line 436 of file cbuttonarray.cxx.

## ◆ drawContents()

void CButtonArray::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

  port | The CGraphicsPort to draw to.

See also
  redraw()

Reimplemented from NXWidgets::CNxWidget.

Reimplemented in NXWidgets::CStickyButtonArray.

Definition at line 362 of file cbuttonarray.cxx.

## ◆ getCursorPosition()

bool CButtonArray::getCursorPosition | ( | int & | column,
|  | int & | row
| ) |  | const
| virtual

Return the current cursor position (button indices) and an indication if the button at the cursor is currently hightlighted.

Parameters

  column | The location to return the column index of the button of interest
  row | The location to return the row index of the button of interest

Returns
  True if the cursor is enabled and the button is highlighted

Definition at line 247 of file cbuttonarray.cxx.

## ◆ getPreferredDimensions()

void CButtonArray::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.

Parameters

  rect | Reference to a rect to populate with data.

Reimplemented from NXWidgets::CNxWidget.

Definition at line 337 of file cbuttonarray.cxx.

## ◆ getText()

const CNxString & CButtonArray::getText | ( | int | column,
|  | int | row
| ) |  | const
| virtual

Returns the string shown in the label.

Parameters

  column | The column index of the button of interest
  row | The row index of the button of interest

Returns
  The label's text.

Definition at line 136 of file cbuttonarray.cxx.

## ◆ isButtonClicked()

bool CButtonArray::isButtonClicked | ( | int & | column,
|  | int & | row
| ) |  | const
| virtual

Return the position of the last clicked button (0,0 will be returned the no button has every been clicked). The button at this position is currently clicked then, in addition, return true.

Parameters

  column | The location to return the column index of the button of interest
  row | The location to return the row index of the button of interest

Returns
  True if any button in the array is clicked

Return the position of the last clicked button (0,0 will be returned the no button has every been clicked). The button at this position is currently clicked then, in addition, return true.

Parameters

  column | The location to return the column index of the button of interest
  row | The location to return the row index of the button of interest

Returns
  True if a button in the array is clicked

Definition at line 167 of file cbuttonarray.cxx.

## ◆ isCursorPosition()

bool CButtonArray::isCursorPosition | ( | int | column,
|  | int | row
| ) |  | const
| virtual

Check if this specific button in the array is at the cursor position and highlighted.

Parameters

  column | The column of the button to check.
  row | The row of the button to check.

Returns
  True if this button is at the cursor position and highlighted.

Definition at line 319 of file cbuttonarray.cxx.

## ◆ isThisButtonClicked()

bool CButtonArray::isThisButtonClicked | ( | int | column,
|  | int | row
| ) |  | const
| virtual

Check if this specific button in the array is clicked

Parameters

  column | The column of the button to check.
  row | The row of the button to check.

Returns
  True if this button is clicked

Definition at line 190 of file cbuttonarray.cxx.

## ◆ onClick()

void CButtonArray::onClick | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y
| ) |  |
| protectedvirtual

Redraws the button.

Parameters

  x | The x coordinate of the click.
  y | The y coordinate of the click.

Reimplemented from NXWidgets::CNxWidget.

Reimplemented in NXWidgets::CKeypad, and NXWidgets::CLatchButtonArray.

Definition at line 550 of file cbuttonarray.cxx.

## ◆ onPreRelease()

void CButtonArray::onPreRelease | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y
| ) |  |
| protectedvirtual

Raises an action.

Parameters

  x | The x coordinate of the mouse.
  y | The y coordinate of the mouse.

Reimplemented from NXWidgets::CNxWidget.

Definition at line 571 of file cbuttonarray.cxx.

## ◆ onRelease()

void CButtonArray::onRelease | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y
| ) |  |
| protectedvirtual

Redraws the button.

Parameters

  x | The x coordinate of the mouse.
  y | The y coordinate of the mouse.

Reimplemented from NXWidgets::CNxWidget.

Definition at line 583 of file cbuttonarray.cxx.

## ◆ onReleaseOutside()

void CButtonArray::onReleaseOutside | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y
| ) |  |
| protectedvirtual

Redraws the button.

Parameters

  x | The x coordinate of the mouse.
  y | The y coordinate of the mouse.

Reimplemented from NXWidgets::CNxWidget.

Definition at line 599 of file cbuttonarray.cxx.

## ◆ onTextChange()

void CButtonArray::onTextChange | ( | void |  | ) |
| protectedvirtual

Updates the GUI after the text has changed.

Definition at line 629 of file cbuttonarray.cxx.

## ◆ posToButton()

bool CButtonArray::posToButton | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | int & | column,
|  | int & | row
| ) |  |
| protectedvirtual

Convert an X/Y position to a button column/row index

Parameters

  x | The x position
  y | The y position
  column | The location to return the column index of the button of interest
  row | The location to return the row index of the button of interest

Returns
  false is the position is invalid

Definition at line 616 of file cbuttonarray.cxx.

## ◆ setCursorPosition()

bool CButtonArray::setCursorPosition | ( | int | column,
|  | int | row
| ) |  |
| virtual

Set the cursor position (button indices). Note that the cursor does not have to be enabled to set the position.

Parameters

  column | The column index of the button of interest
  row | The row index of the button of interest

Returns
  True if the cursor position is valid

Definition at line 263 of file cbuttonarray.cxx.

## ◆ setFont()

void CButtonArray::setFont | ( | CNxFont * | font | ) |
| virtual

Sets the font.

Parameters

  font | A pointer to the font to use.

Reimplemented from NXWidgets::CNxWidget.

Definition at line 348 of file cbuttonarray.cxx.

## ◆ setText()

void CButtonArray::setText | ( | int | column,
|  | int | row,
|  | const CNxString & | text
| ) |  |
| virtual

Set the text displayed in the label.

Parameters

  column | The column index of the button to set
  row | The row index of the button to set
  text | String to display.

Definition at line 149 of file cbuttonarray.cxx.

## Member Data Documentation

## ◆ m_buttonColumns

uint8_t NXWidgets::CButtonArray::m_buttonColumns
| protected

The number of columns in one row

Definition at line 80 of file cbuttonarray.hxx.

## ◆ m_buttonHeight

nxgl_coord_t NXWidgets::CButtonArray::m_buttonHeight
| protected

The height of one button in rows

Definition at line 86 of file cbuttonarray.hxx.

## ◆ m_buttonRows

uint8_t NXWidgets::CButtonArray::m_buttonRows
| protected

The number buttons in one column

Definition at line 81 of file cbuttonarray.hxx.

## ◆ m_buttonText

CNxString* NXWidgets::CButtonArray::m_buttonText
| protected

Text for each button

Definition at line 91 of file cbuttonarray.hxx.

## ◆ m_buttonWidth

nxgl_coord_t NXWidgets::CButtonArray::m_buttonWidth
| protected

The width of one button in pixels

Definition at line 85 of file cbuttonarray.hxx.

## ◆ m_clickX

nxgl_coord_t NXWidgets::CButtonArray::m_clickX
| protected

The X position of the last clicked button

Definition at line 87 of file cbuttonarray.hxx.

## ◆ m_clickY

nxgl_coord_t NXWidgets::CButtonArray::m_clickY
| protected

The Y position of the last clicked button

Definition at line 88 of file cbuttonarray.hxx.

## ◆ m_cursorChange

bool NXWidgets::CButtonArray::m_cursorChange
| protected

True: Redraw cursor button only

Definition at line 84 of file cbuttonarray.hxx.

## ◆ m_cursorColumn

uint8_t NXWidgets::CButtonArray::m_cursorColumn
| protected

The column index of the highlighted button

Definition at line 89 of file cbuttonarray.hxx.

## ◆ m_cursorOn

bool NXWidgets::CButtonArray::m_cursorOn
| protected

Cursor on; highlighted button displayed

Definition at line 83 of file cbuttonarray.hxx.

## ◆ m_cursorRow

uint8_t NXWidgets::CButtonArray::m_cursorRow
| protected

The row index of the highlighted button

Definition at line 90 of file cbuttonarray.hxx.

## ◆ m_redrawButton

bool NXWidgets::CButtonArray::m_redrawButton
| protected

True: Redraw button; False: redraw all

Definition at line 82 of file cbuttonarray.hxx.

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

- cbuttonarray.hxx
- cbuttonarray.cxx