NXWidgets: NXWidgets::CNxTimer Class Reference

NXWidgets 1.19

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

`#include <cnxtimer.hxx>`

Inheritance diagram for NXWidgets::CNxTimer:

## Public Member Functions
| CNxTimer (CWidgetControl *pWidgetControl, uint32_t timeout, bool repeat)
| ~CNxTimer (void)
void | reset (void)
void | start (void)
void | stop (void)
bool | isRunning () const
void | setTimeout (uint32_t timeout)
uint32_t | getTimeout (void) const
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)
virtual void | getPreferredDimensions (CRect &rect) const
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)
virtual void | setFont (CNxFont *font)
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
| CNxTimer (const CNxTimer &timer)
Protected Member Functions inherited from NXWidgets::CNxWidget
void | useWidgetStyle (const CWidgetStyle *style)
virtual void | drawContents (CGraphicsPort *port)
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)
virtual void | onResize (nxgl_coord_t width, nxgl_coord_t height)

## Static Protected Member Functions
static void | workQueueCallback (FAR void *arg)

## Protected Attributes
struct work_s | m_work
uint32_t | m_timeout
bool | m_isRunning
bool | m_isRepeater
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

Timer widget. It can drive time-based events, animations, etc.

Using the timer is simple:

- Create an instance of the CNxTimer and add it as a child to a widget.
- Call the instance's "start()" method.
- Catch the timer's action event and call any code that should run.

Definition at line 110 of file cnxtimer.hxx.

## Constructor & Destructor Documentation

## ◆ CNxTimer() [1/2]

NXWidgets::CNxTimer::CNxTimer | ( | const CNxTimer & | timer | ) |
| inlineprotected

Copy constructor is protected to prevent usage.

Definition at line 130 of file cnxtimer.hxx.

## ◆ CNxTimer() [2/2]

CNxTimer::CNxTimer | ( | CWidgetControl * | pWidgetControl,
|  | uint32_t | timeout,
|  | bool | repeat
| ) |  |

Constructor.

Parameters

  pWidgetControl | The controlling widget for the display.
  timeout | Time, in milliseconds, before the timer fires an EVENT_ACTION event.
  repeat | If true, the timer will fire multiple events. If false, the timer will fire just once and stop.

Definition at line 112 of file cnxtimer.cxx.

## ◆ ~CNxTimer()

CNxTimer::~CNxTimer | ( | void |  | ) |

Destructor.

Definition at line 130 of file cnxtimer.cxx.

## Member Function Documentation

## ◆ getTimeout()

uint32_t NXWidgets::CNxTimer::getTimeout | ( | void |  | ) | const
| inline

Return the timeout of this timer.

Returns
  The number of milliseconds that this timer will run before firing an event.

Definition at line 198 of file cnxtimer.hxx.

## ◆ isRunning()

bool NXWidgets::CNxTimer::isRunning | ( |  | ) | const
| inline

Returns true if the timer is currently running.

Definition at line 176 of file cnxtimer.hxx.

## ◆ reset()

void CNxTimer::reset | ( | void |  | ) |

Resets the (running) timer to its initial timeout value. This call does nothing if the timer is not running.

Resets the millisecond timer.

Definition at line 139 of file cnxtimer.cxx.

## ◆ setTimeout()

void NXWidgets::CNxTimer::setTimeout | ( | uint32_t | timeout | ) |
| inline

Set the timeout of this timer. This timeout value will not take effect until start() or reset() is called.

Parameters

  timeout | The number of milliseconds that this timer will run before firing an event.

Definition at line 186 of file cnxtimer.hxx.

## ◆ start()

void CNxTimer::start | ( | void |  | ) |

Starts the timer. This call does nothing if the timer is already running.

Starts the timer.

Definition at line 154 of file cnxtimer.cxx.

## ◆ stop()

void CNxTimer::stop | ( | void |  | ) |

Stops the timer. Does nothing if the timer is not running.

Stops the timer

Definition at line 176 of file cnxtimer.cxx.

## ◆ workQueueCallback()

void CNxTimer::workQueueCallback | ( | FAR void * | arg | ) |
| staticprotected

Static function called from work queue when the timeout expires.

Parameters

  arg | Pointer to the CNxTimer instance.

Definition at line 191 of file cnxtimer.cxx.

## Member Data Documentation

## ◆ m_isRepeater

bool NXWidgets::CNxTimer::m_isRepeater
| protected

Indicates whether or not the timer repeats

Definition at line 116 of file cnxtimer.hxx.

## ◆ m_isRunning

bool NXWidgets::CNxTimer::m_isRunning
| protected

Indicates whether or not the timer is running

Definition at line 115 of file cnxtimer.hxx.

## ◆ m_timeout

uint32_t NXWidgets::CNxTimer::m_timeout
| protected

The timeout value in milliseconds

Definition at line 114 of file cnxtimer.hxx.

## ◆ m_work

struct work_s NXWidgets::CNxTimer::m_work
| protected

Work queue entry

Definition at line 113 of file cnxtimer.hxx.

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

- cnxtimer.hxx
- cnxtimer.cxx