NXWidgets  1.19
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
NXWidgets::CCallback Class Reference

#include <ccallback.hxx>

Inheritance diagram for NXWidgets::CCallback:
Inheritance graph

Public Member Functions

 CCallback (CWidgetControl *widgetControl)
 
 ~CCallback (void)
 
FAR struct nx_callback_s * getCallbackVTable (void)
 
void setNxTerm (NXTERM handle)
 

Static Private Member Functions

static void redraw (NXHANDLE hwnd, FAR const struct nxgl_rect_s *rect, bool bMore, FAR void *arg)
 
static void position (NXHANDLE hwnd, FAR const struct nxgl_size_s *size, FAR const struct nxgl_point_s *pos, FAR const struct nxgl_rect_s *bounds, FAR void *arg)
 
static void newMouseEvent (NXHANDLE hwnd, FAR const struct nxgl_point_s *pos, uint8_t buttons, FAR void *arg)
 
static void newKeyboardEvent (NXHANDLE hwnd, uint8_t nCh, FAR const uint8_t *str, FAR void *arg)
 
static void windowBlocked (NXWINDOW hwnd, FAR void *arg1, FAR void *arg2)
 

Private Attributes

CWidgetControlm_widgetControl
 
struct nx_callback_s m_callbacks
 
NXTERM m_nxterm
 

Detailed Description

Callback function proxies. This class receives and dispatches callbacks from the NX server. This calls also manages a few lower-level details such as keeping track of the reported window handles and window positions and sizes.

There are three instances that represent an NX window from the perspective of NXWidgets.

There a various kinds of of window instances, but each inherits (1) CCallback and dispatches the Windows callbacks and (2) INxWindow that describes the common window behavior.

Definition at line 91 of file ccallback.hxx.

Constructor & Destructor Documentation

◆ CCallback()

CCallback::CCallback ( CWidgetControl widgetControl)

Constructor.

Parameters
widgetControlControl object associated with this window

Definition at line 70 of file ccallback.cxx.

◆ ~CCallback()

NXWidgets::CCallback::~CCallback ( void  )
inline

Destructor.

Definition at line 226 of file ccallback.hxx.

Member Function Documentation

◆ getCallbackVTable()

FAR struct nx_callback_s* NXWidgets::CCallback::getCallbackVTable ( void  )
inline

Get the callback vtable. This is neeed only by the window instance that inherits this class. The window instance needs the C-callable vtable in order to create the NX window. Once the window is created, this class will begin to receive callbacks via the C-callable vtable methods.

Returns
This method returns the C-callable vtable needed for NX window creation.

Definition at line 239 of file ccallback.hxx.

◆ newKeyboardEvent()

void CCallback::newKeyboardEvent ( NXHANDLE  hwnd,
uint8_t  nCh,
FAR const uint8_t *  str,
FAR void *  arg 
)
staticprivate

New keyboard/keypad data is available for the window. The new keyboard data is handled by CWidgetControl::newKeyboardEvent.

NOTE: This method runs in the context of the NX callback which may either be the context of the NX event listener thread (if multi- user NX), or possibly in the connects of device driver or even a device driver interrupt.

The GUI thread is probably sleeping a semaphore, waiting to be awakened by a mouse or keyboard event.

Parameters
hwndHandle to a specific NX window.
nChThe number of characters that are available in str[].
strThe array of characters.
argUser provided argument (see nx_openwindow, nx_requestbg, nxtk_openwindow, or nxtk_opentoolbar).

New keyboard/keypad data is available for the window. The new keyboard data is handled by CWidgetControl::newKeyboardEvent.

Parameters
hwndHandle to a specific NX window.
nChThe number of characters that are available in str[].
strThe array of characters.
argUser provided argument (see nx_openwindow, nx_requestbg, nxtk_openwindow, or nxtk_opentoolbar).

Definition at line 198 of file ccallback.cxx.

◆ newMouseEvent()

void CCallback::newMouseEvent ( NXHANDLE  hwnd,
FAR const struct nxgl_point_s *  pos,
uint8_t  buttons,
FAR void *  arg 
)
staticprivate

New mouse data is available for the window. The new mouse data is handled by CWidgetControl::newMouseEvent.

NOTE: This method runs in the context of the NX callback which may either be the context of the NX event listener thread (if multi- user NX), or possibly in the connects of device driver or even a device driver interrupt.

The GUI thread is probably sleeping a semaphore, waiting to be awakened by a mouse or keyboard event.

Parameters
hwndHandle to a specific NX window.
posThe (x,y) position of the mouse.
buttonsSee NX_MOUSE_* definitions.
argUser provided argument (see nx_openwindow, nx_requestbg, nxtk_openwindow, or nxtk_opentoolbar).

New mouse data is available for the window. The new mouse data is handled by CWidgetControl::newMouseEvent.

Parameters
hwndHandle to a specific NX window.
posThe (x,y) position of the mouse.
buttonsSee NX_MOUSE_* definitions.
argUser provided argument (see nx_openwindow, nx_requestbg, nxtk_openwindow, or nxtk_opentoolbar).

Definition at line 169 of file ccallback.cxx.

◆ position()

void CCallback::position ( NXHANDLE  hwnd,
FAR const struct nxgl_size_s *  size,
FAR const struct nxgl_point_s *  pos,
FAR const struct nxgl_rect_s *  bounds,
FAR void *  arg 
)
staticprivate

Position Callback. The new positional data is handled by CWidgetControl::geometryEvent.

NOTE: This method runs in the context of the NX callback which may either be the context of the owning thread or, in the case of multi- user NX, the context of the NX event listener thread.

Parameters
hwndHandle to a specific NX window.
sizeThe size of the window.
posThe position of the upper left hand corner of the window on the overall display.
boundsThe bounding rectangle that describes the entire display.
argUser provided argument (see nx_openwindow, nx_requestbg, nxtk_openwindow, or nxtk_opentoolbar).

Position Callback. The new positional data is handled by CWidgetControl::geometryEvent.

Parameters
hwndHandle to a specific NX window.
sizeThe size of the window.
posThe position of the upper left hand corner of the window on the overall display.
boundsThe bounding rectangle that describes the entire display.
argUser provided argument (see nx_openwindow, nx_requestbg, nxtk_openwindow, or nxtk_opentoolbar).

Definition at line 137 of file ccallback.cxx.

◆ redraw()

void CCallback::redraw ( NXHANDLE  hwnd,
FAR const struct nxgl_rect_s *  rect,
bool  bMore,
FAR void *  arg 
)
staticprivate

Re-Draw Callback. The redraw event is handled by CWidgetControl::redrawEvent.

NOTE: This method runs in the context of the NX callback which may either be the context of the owning thread or, in the case of multi- user NX, the context of the NX event listener thread.

Parameters
hwndHandle to a specific NX window.
rectThe rectangle that needs to be re-drawn (in window relative coordinates).
bMoretrue: More re-draw requests will follow.
argUser provided argument (see nx_openwindow, nx_requestbg, nxtk_openwindow, or nxtk_opentoolbar).

ReDraw Callback. The redraw action is handled by CWidgetControl:redrawEvent.

Parameters
hwndHandle to a specific NX window.
rectThe rectangle that needs to be re-drawn (in window relative coordinates).
bMoretrue: More re-draw requests will follow.
argUser provided argument (see nx_openwindow, nx_requestbg, nxtk_openwindow, or nxtk_opentoolbar).

Definition at line 106 of file ccallback.cxx.

◆ setNxTerm()

void NXWidgets::CCallback::setNxTerm ( NXTERM  handle)
inline

By default, NX keyboard input is given to the various widgets residing in the window. But NxTerm is a different usage model; In this case, keyboard input needs to be directed to the NxTerm character driver. This method can be used to enable (or disable) redirection of NX keyboard input from the window widgets to the NxTerm

Parameters
handle.The NXTERM handle. If non-NULL, NX keyboard input will be directed to the NxTerm driver using this handle; If NULL (the default), NX keyboard input will be directed to the widgets within the window.

Definition at line 259 of file ccallback.hxx.

◆ windowBlocked()

void CCallback::windowBlocked ( NXWINDOW  hwnd,
FAR void *  arg1,
FAR void *  arg2 
)
staticprivate

This callback is the response from nx_block (or nxtk_block). Those blocking interfaces are used to assure that no further messages are directed to the window. Receipt of the blocked callback signifies that (1) there are no further pending callbacks and (2) that the window is now 'defunct' and will receive no further callbacks.

This callback supports coordinated destruction of a window in multi- user mode. In multi-use mode, the client window logic must stay intact until all of the queued callbacks are processed. Then the window may be safely closed. Closing the window prior with pending callbacks can lead to bad behavior when the callback is executed.

Parameters
hwnd.Window handle of the blocked window
arg1.User provided argument (see nx_openwindow, nx_requestbkgd, nxtk_openwindow, or nxtk_opentoolbar)
arg2- User provided argument (see nx_block or nxtk_block)

This callback is the response from nx_block (or nxtk_block). Those blocking interfaces are used to assure that no further messages are directed to the window. Receipt of the blocked callback signifies that (1) there are no further pending callbacks and (2) that the window is now 'defunct' and will receive no further callbacks.

This callback supports coordinated destruction of a window in multi- user mode. In multi-use more, the client window logic must stay intact until all of the queued callbacks are processed. Then the window may be safely closed. Closing the window prior with pending callbacks can lead to bad behavior when the callback is executed.

Parameters
hwnd.Window handle of the blocked window
arg1.User provided argument (see nx_openwindow, nx_requestbkgd, nxtk_openwindow, or nxtk_opentoolbar)
arg2- User provided argument (see nx_block or nxtk_block)

Definition at line 249 of file ccallback.cxx.

Member Data Documentation

◆ m_callbacks

struct nx_callback_s NXWidgets::CCallback::m_callbacks
private

C-callable vtable of callback function pointers

Definition at line 95 of file ccallback.hxx.

◆ m_nxterm

NXTERM NXWidgets::CCallback::m_nxterm
private

The NxTerm handle for redirection of keyboard input

Definition at line 97 of file ccallback.hxx.

◆ m_widgetControl

CWidgetControl* NXWidgets::CCallback::m_widgetControl
private

The widget control instance for this window

Definition at line 94 of file ccallback.hxx.


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