|
NXWidgets
1.19
|
#include <cwidgetcontrol.hxx>

Classes | |
| struct | SXYInput |
Public Member Functions | |
| CWidgetControl (FAR const CWidgetStyle *style=(const CWidgetStyle *) NULL) | |
| virtual | ~CWidgetControl (void) |
| void | waitForWindowEvent (void) |
| const bool | isWaiting (void) const |
| bool | pollEvents (CNxWidget *widget=(CNxWidget *) NULL) |
| bool | swapWidgetDepth (CNxWidget *widget) |
| void | addControlledWidget (CNxWidget *widget) |
| void | removeControlledWidget (CNxWidget *widget) |
| const int | getControlledWidgetCount (void) const |
| void | addToDeleteQueue (CNxWidget *widget) |
| void | setClickedWidget (CNxWidget *widget) |
| CNxWidget * | getClickedWidget (void) |
| void | setFocusedWidget (CNxWidget *widget) |
| void | clearFocusedWidget (CNxWidget *widget) |
| CNxWidget * | getFocusedWidget (void) |
| bool | doubleClick (void) |
| void | getWidgetStyle (CWidgetStyle *style) |
| void | setWidgetStyle (const CWidgetStyle *style) |
| void | geometryEvent (NXHANDLE hWindow, const struct nxgl_size_s *size, const struct nxgl_point_s *pos, const struct nxgl_rect_s *bounds) |
| void | redrawEvent (FAR const struct nxgl_rect_s *nxRect, bool more) |
| void | newMouseEvent (FAR const struct nxgl_point_s *pos, uint8_t buttons) |
| void | newKeyboardEvent (uint8_t nCh, FAR const uint8_t *pStr) |
| void | windowBlocked (FAR void *arg) |
| void | newCursorControlEvent (ECursorControl cursorControl) |
| NXHANDLE | getWindowHandle (void) |
| CRect | getWindowBoundingBox (void) |
| void | getWindowBoundingBox (FAR struct nxgl_rect_s *bounds) |
| bool | getWindowPosition (FAR struct nxgl_point_s *pos) |
| bool | getWindowSize (FAR struct nxgl_size_s *size) |
| nxgl_coord_t | getWindowWidth (void) |
| nxgl_coord_t | getWindowHeight (void) |
| bool | createGraphicsPort (INxWindow *window) |
| CGraphicsPort * | getGraphicsPort (void) |
| void | addWindowEventHandler (CWindowEventHandler *eventHandler) |
| void | removeWindowEventHandler (CWindowEventHandler *eventHandler) |
Protected Member Functions | |
| void | copyWidgetStyle (CWidgetStyle *dest, const CWidgetStyle *src) |
| uint32_t | elapsedTime (FAR const struct timespec *startTime) |
| void | handleLeftClick (nxgl_coord_t x, nxgl_coord_t y, CNxWidget *widget) |
| const int | getWidgetIndex (const CNxWidget *widget) const |
| void | processDeleteQueue (void) |
| bool | pollMouseEvents (CNxWidget *widget) |
| bool | pollKeyboardEvents (void) |
| bool | pollCursorControlEvents (void) |
| void | postWindowEvent (void) |
| void | takeGeoSem (void) |
| void | giveGeoSem (void) |
| void | waitGeoData (void) |
| void | takeBoundsSem (void) |
| void | giveBoundsSem (void) |
| void | waitBoundsData (void) |
| void | clearMouseEvents (void) |
Protected Attributes | |
| CGraphicsPort * | m_port |
| TNxArray< CNxWidget * > | m_deleteQueue |
| TNxArray< CNxWidget * > | m_widgets |
| bool | m_haveGeometry |
| bool | m_waiting |
| sem_t | m_waitSem |
| struct SXYInput | m_xyinput |
| CNxWidget * | m_clickedWidget |
| CNxWidget * | m_focusedWidget |
| uint8_t | m_kbdbuf [CONFIG_NXWIDGETS_KBDBUFFER_SIZE] |
| uint8_t | m_nCh |
| uint8_t | m_controls [CONFIG_NXWIDGETS_CURSORCONTROL_SIZE] |
| uint8_t | m_nCc |
| NXHANDLE | m_hWindow |
| struct nxgl_size_s | m_size |
| struct nxgl_point_s | m_pos |
| struct nxgl_rect_s | m_bounds |
| sem_t | m_geoSem |
| sem_t | m_boundsSem |
| CWindowEventHandlerList | m_eventHandlers |
| CWidgetStyle | m_style |
Class providing a top-level widget and an interface to the CWidgetControl widget hierarchy.
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 95 of file cwidgetcontrol.hxx.
| CWidgetControl::CWidgetControl | ( | FAR const CWidgetStyle * | style = (const CWidgetStyle *)NULL | ) |
Constructor
| style | The default style that all widgets on this display should use. If this is not specified, the widget will use the values stored in the defaultCWidgetStyle object. |
CWidgetControl constructor (for the case where the display size is known)
| style | The style that the widget should use. If this is not specified, the widget will use the values stored in the global defaultCWidgetStyle object. The widget will copy the properties of the style into its own internal style object. |
Definition at line 81 of file cwidgetcontrol.cxx.
|
virtual |
Destructor.
Definition at line 144 of file cwidgetcontrol.cxx.
|
inline |
Add another widget to be managed by this control instance
| widget | The widget to be controlled. |
Definition at line 463 of file cwidgetcontrol.hxx.
| void CWidgetControl::addToDeleteQueue | ( | CNxWidget * | widget | ) |
Add a widget to the list of widgets to be deleted. Must never be called by anything other than the framework itself.
| widget | The widget to add to the delete queue. |
Definition at line 303 of file cwidgetcontrol.cxx.
|
inline |
Adds a window event handler. The window handler will receive notification all NX events received by this window.
| eventHandler | A pointer to the event handler. |
Definition at line 781 of file cwidgetcontrol.hxx.
|
inline |
Reset the focused widget so that it will no longer receive keyboard input.
| widget | The new focused widget. |
Definition at line 530 of file cwidgetcontrol.hxx.
|
protected |
Clear all mouse events
Definition at line 944 of file cwidgetcontrol.cxx.
|
protected |
Copy a widget style
| dest | The destination style |
| src | The source to use |
Definition at line 673 of file cwidgetcontrol.cxx.
| bool CWidgetControl::createGraphicsPort | ( | INxWindow * | window | ) |
The creation sequence is:
1) Create a dumb CWigetControl instance 2) Pass the dumb CWidgetControl instance to the window constructor that inherits from INxWindow. 3) The call this method with the static_cast to INxWindow to, finally, create the CGraphicsPort for this window. 4) After that, the fully smartend CWidgetControl instance can be used to generate additional widgets.
| window | The instance of INxWindow needed to construct the CGraphicsPort instance |
The creation sequence is:
1) Create a dumb CWigetControl instance 2) Pass the dumb CWidgetControl instance to the window constructor that inherits from INxWindow. 3) The call this method with the static_cast to INxWindow to, finally, create the CGraphicsPort for this window. 4) After that, the fully smartened CWidgetControl instance can be used to generate additional widgets.
| window | The instance of INxWindow needed to construct the CGraphicsPort instance |
Definition at line 656 of file cwidgetcontrol.cxx.
|
inline |
Check for the occurrence of a double click.
Definition at line 555 of file cwidgetcontrol.hxx.
|
protected |
Return the elapsed time in millisconds
| startTime | A time in the past from which to compute the elapsed time. |
Return the elapsed time in milliseconds
| tp | A time in the past from which to compute the elapsed time. |
Definition at line 693 of file cwidgetcontrol.cxx.
| void CWidgetControl::geometryEvent | ( | NXHANDLE | hWindow, |
| const struct nxgl_size_s * | size, | ||
| const struct nxgl_point_s * | pos, | ||
| const struct nxgl_rect_s * | bounds | ||
| ) |
These remaining methods are used by the CCallback instance to provide notifications of certain events. This event will occur when the position or size of the underlying window occurs.
| hWindow | The window handle that should be used to communicate with the window |
| pos | The position of the window in the physical device space. |
| size | The size of the window. |
| bounds | The size of the underlying display (pixels x rows) |
This event is called from CCallback instance to provide notifications of certain NX-server related events. This event, in particular, will occur when the position or size of the underlying window occurs.
| hWindow | The window handle that should be used to communicate with the window |
| pos | The position of the window in the physical device space. |
| size | The size of the window. |
| bounds | The size of the underlying display (pixels x rows) |
Definition at line 372 of file cwidgetcontrol.cxx.
|
inline |
Get the clicked widget pointer.
Definition at line 511 of file cwidgetcontrol.hxx.
|
inline |
Get the number of controlled widgets.
Definition at line 482 of file cwidgetcontrol.hxx.
|
inline |
Get the focused widget pointer.
Definition at line 544 of file cwidgetcontrol.hxx.
|
inline |
Get the CGraphicsPort instance for drawing on this window
Definition at line 769 of file cwidgetcontrol.hxx.
|
protected |
Get the index of the specified controlled widget.
| widget | The widget to get the index of. |
Definition at line 266 of file cwidgetcontrol.cxx.
|
inline |
Get the default widget style for this window.
| style. | The location to return the widget's style |
Definition at line 566 of file cwidgetcontrol.hxx.
|
inline |
Get the window bounding box in physical display coordinates. This method may need to wait until bounds data is available.
Definition at line 680 of file cwidgetcontrol.hxx.
|
inline |
Definition at line 686 of file cwidgetcontrol.hxx.
|
inline |
Get the window handle reported on the first position callback.
Definition at line 668 of file cwidgetcontrol.hxx.
|
inline |
Get the height of the window (as reported by the last NX callback). This method may need to wait until geometry data is available.
Definition at line 742 of file cwidgetcontrol.hxx.
|
inline |
Get the position of the window (as reported by the last NX callback). This method may need to wait until geometry data is available.
Definition at line 699 of file cwidgetcontrol.hxx.
|
inline |
Get the size of the window (as reported by the last NX callback). This method may need to wait until geometry data is available.
Definition at line 714 of file cwidgetcontrol.hxx.
|
inline |
Get the width of the window (as reported by the last NX callback). This method may need to wait until geometry data is available.
Definition at line 729 of file cwidgetcontrol.hxx.
|
inlineprotected |
Give the bounds semaphore
Definition at line 344 of file cwidgetcontrol.hxx.
|
inlineprotected |
Give the geometry semaphore
Definition at line 319 of file cwidgetcontrol.hxx.
|
protected |
Pass clicks to the widget hierarchy. Closes the context menu if the clicked widget is not the context menu. If a single widget is supplied, only that widget is sent the click.
| x | Click xcoordinate. |
| y | Click ycoordinate. |
| widget. | Specific widget to poll. Use NULL to run the all widgets in the window. |
Pass clicks to the widget hierarchy. If a single widget is supplied, only that widget is sent the click.
| x | Click xcoordinate. |
| y | Click ycoordinate. |
| widget | Pointer to a specific widget or NULL. |
Definition at line 744 of file cwidgetcontrol.cxx.
|
inline |
Is external logic awaiting for a window event?
Definition at line 410 of file cwidgetcontrol.hxx.
| void CWidgetControl::newCursorControlEvent | ( | ECursorControl | cursorControl | ) |
This event means that cursor control data is available for the window.
| cursorControl | The cursor control code received. |
Definition at line 624 of file cwidgetcontrol.cxx.
| void CWidgetControl::newKeyboardEvent | ( | uint8_t | nCh, |
| FAR const uint8_t * | pStr | ||
| ) |
This event means that keyboard/keypad data is available for the window.
| nCh | The number of characters that are available in pStr[]. |
| pStr | The array of characters. |
This event is called from CCallback instance to provide notifications of certain NX-server related events. This event, in particular, means that keyboard/keypad data is available for the window.
| nCh | The number of characters that are available in pStr[]. |
| pStr | The array of characters. |
Definition at line 593 of file cwidgetcontrol.cxx.
| void CWidgetControl::newMouseEvent | ( | FAR const struct nxgl_point_s * | pos, |
| uint8_t | buttons | ||
| ) |
This event means that new mouse data is available for the window.
| pos | The (x,y) position of the mouse. |
| buttons | See NX_MOUSE_* definitions. |
This event is called from CCallback instance to provide notifications of certain NX-server related events. This event, in particular, means that new mouse data is available for the window.
| pos | The (x,y) position of the mouse. |
| buttons | See NX_MOUSE_* definitions. |
Definition at line 452 of file cwidgetcontrol.cxx.
|
protected |
Process cursor control events and send throughout the hierarchy.
Definition at line 881 of file cwidgetcontrol.cxx.
Run all code that needs to take place on a periodic basis. This method normally called externally... either periodically or when a window event is detected. If CONFIG_NXWIDGET_EVENTWAIT is defined, then external logic want call waitWindow event and when awakened, they chould call this function. As an example:
for (;;) { sched_lock(); // Make the sequence atomic if (!window->pollEvents(0)) { window->waitWindowEvent(); } sched_unlock(); }
This method is just a wrapper simply calls the followi.
processDeleteQueue() pollMouseEvents(widget) pollKeyboardEvents() pollCursorControlEvents()
| widget. | Specific widget to poll. Use NULL to run the all widgets in the window. |
Run all code that needs to take place on a periodic basis. This method normally called externally... either periodically or when a window event is detected. If CONFIG_NXWIDGET_EVENTWAIT is defined, then external logic want call waitWindow event and when awakened, they chould call this function. As an example:
for (;;) { sched_lock(); // Make the sequence atomic if (!window->pollEvents(0)) { window->waitWindowEvent(); } sched_unlock(); }
This method is just a wrapper simply calls the following methods. It can easily be replace with custom, external logic.
processDeleteQueue() pollMouseEvents(widget) pollKeyboardEvents() pollCursorControlEvents()
| widget. | Specific widget to poll. Use NULL to run the all widgets in the window. |
Definition at line 239 of file cwidgetcontrol.cxx.
|
protected |
Process keypad events and send throughout the hierarchy.
Definition at line 851 of file cwidgetcontrol.cxx.
|
protected |
Process mouse/touchscreen events and send throughout the hierarchy.
| widget. | Specific widget to poll. Use NULL to run the all widgets in the window. |
Definition at line 792 of file cwidgetcontrol.cxx.
|
protected |
Wake up and external logic that is waiting for a window event.
Wake up external logic waiting for a window event
Definition at line 200 of file cwidgetcontrol.cxx.
|
protected |
Delete any widgets in the deletion queue.
Definition at line 772 of file cwidgetcontrol.cxx.
| void CWidgetControl::redrawEvent | ( | FAR const struct nxgl_rect_s * | nxRect, |
| bool | more | ||
| ) |
This event will occur when the a portion of the window that was previously obscured is now exposed.
| nxRect | The region in the window that must be redrawn. |
| more | True means that more re-draw requests will follow |
This event is called from CCallback instance to provide notifications of certain NX-server related events. This event, in particular, will occur when the a portion of the window that was previously obscured is now exposed.
| rect | The region in the window that must be redrawn. |
| more | True means that more re-draw requests will follow |
Definition at line 434 of file cwidgetcontrol.cxx.
| void CWidgetControl::removeControlledWidget | ( | CNxWidget * | widget | ) |
Remove a controlled widget
| widget | The widget to be removed |
Definition at line 285 of file cwidgetcontrol.cxx.
|
inline |
Remove a window event handler.
| eventHandler | A pointer to the event handler to remove. |
Definition at line 792 of file cwidgetcontrol.hxx.
| void CWidgetControl::setClickedWidget | ( | CNxWidget * | widget | ) |
Set the clicked widget pointer. Note that this should not be called by code other than within the CWidgetControl library itself.
| widget | The new clicked widget. |
Definition at line 323 of file cwidgetcontrol.cxx.
| void CWidgetControl::setFocusedWidget | ( | CNxWidget * | widget | ) |
Set the focused widget that will receive keyboard input.
| widget | The new focused widget. |
Definition at line 345 of file cwidgetcontrol.cxx.
|
inline |
Set the default widget style for this window.
| style. | The new widget style to copy. |
Definition at line 577 of file cwidgetcontrol.hxx.
| bool NXWidgets::CWidgetControl::swapWidgetDepth | ( | CNxWidget * | widget | ) |
Swaps the depth of the supplied widget. This function presumes that all child widgets are screens.
| widget | The widget to be depth-swapped. |
|
protected |
Take the bounds semaphore (handling signal interruptions)
Definition at line 926 of file cwidgetcontrol.cxx.
|
protected |
Take the geometry semaphore (handling signal interruptions)
Definition at line 909 of file cwidgetcontrol.cxx.
|
inlineprotected |
Wait for bounds data
Definition at line 353 of file cwidgetcontrol.hxx.
| void CWidgetControl::waitForWindowEvent | ( | void | ) |
Wait for an interesting window event to occur (like a mouse or keyboard event) Caller's should exercise care to assure that the test for waiting and this call are "atomic" .. perhaps by locking the scheduler like:
sched_lock(); <check for="" events>=""> if (<no interesting="" events>="">) { window->waitForWindowEvent(); } sched_unlock();
Wait for an interesting window event to occur (like a mouse or keyboard event). Caller's should exercise care to assure that the test for waiting and this call are "atomic" .. perhaps by locking the scheduler like:
sched_lock(); ... if (no interesting events) { window->waitForWindowEvent(); } sched_unlock();
Definition at line 187 of file cwidgetcontrol.cxx.
|
inlineprotected |
Wait for geometry data
Definition at line 328 of file cwidgetcontrol.hxx.
|
inline |
This event 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 events and (2) that the window is now 'defunct' and will receive no further events.
This event 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.
| arg | - User provided argument (see nx_block or nxtk_block) |
Definition at line 649 of file cwidgetcontrol.hxx.
|
protected |
Size of the display
Definition at line 217 of file cwidgetcontrol.hxx.
|
protected |
Posted when bounds are valid
Definition at line 219 of file cwidgetcontrol.hxx.
|
protected |
Pointer to the widget that is clicked.
Definition at line 199 of file cwidgetcontrol.hxx.
|
protected |
Definition at line 207 of file cwidgetcontrol.hxx.
Array of widgets awaiting deletion.
Definition at line 178 of file cwidgetcontrol.hxx.
|
protected |
List of event handlers.
Definition at line 220 of file cwidgetcontrol.hxx.
|
protected |
Pointer to the widget that received keyboard input.
Definition at line 201 of file cwidgetcontrol.hxx.
|
protected |
Posted when geometry is valid
Definition at line 218 of file cwidgetcontrol.hxx.
|
protected |
True: indicates that we have valid geometry data.
Definition at line 182 of file cwidgetcontrol.hxx.
|
protected |
The following were picked off from the position callback.Handle to the NX window
Definition at line 214 of file cwidgetcontrol.hxx.
|
protected |
Definition at line 204 of file cwidgetcontrol.hxx.
|
protected |
Number of buffered cursor controls
Definition at line 208 of file cwidgetcontrol.hxx.
|
protected |
Number of buffered keyboard characters
Definition at line 205 of file cwidgetcontrol.hxx.
|
protected |
State dataThe graphics port that is used for drawing on this window
Definition at line 175 of file cwidgetcontrol.hxx.
|
protected |
Position in display space
Definition at line 216 of file cwidgetcontrol.hxx.
|
protected |
Size of the window
Definition at line 215 of file cwidgetcontrol.hxx.
|
protected |
StyleDefault style used by all widgets in the window.
Definition at line 226 of file cwidgetcontrol.hxx.
|
protected |
True: Extternal logic waiting for window event
Definition at line 185 of file cwidgetcontrol.hxx.
|
protected |
External loops waits for events on this semaphore
Definition at line 187 of file cwidgetcontrol.hxx.
List of controlled widgets.
Definition at line 180 of file cwidgetcontrol.hxx.
|
protected |
I/OCurrent XY input device state
Definition at line 196 of file cwidgetcontrol.hxx.
1.8.13