NXWidgets  1.19
cwidgetcontrol.hxx
Go to the documentation of this file.
1 /****************************************************************************
2  * NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
3  *
4  * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
5  * Author: Gregory Nutt <gnutt@nuttx.org>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
18  * me be used to endorse or promote products derived from this software
19  * without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ****************************************************************************/
35 
36 #ifndef __INCLUDE_CWIDGETCONTROLT_HXX
37 #define __INCLUDE_CWIDGETCONTROLT_HXX
38 
39 /****************************************************************************
40  * Included Files
41  ****************************************************************************/
42 
43 #include <nuttx/config.h>
44 
45 #include <stdint.h>
46 #include <stdbool.h>
47 #include <stdlib.h>
48 #include <semaphore.h>
49 #include <time.h>
50 
51 #include "nxconfig.hxx"
52 #include "cgraphicsport.hxx"
53 #include "cnxwidget.hxx"
54 #include "crect.hxx"
55 #include "cwidgetstyle.hxx"
56 #include "cwindoweventhandler.hxx"
58 #include "tnxarray.hxx"
59 
60 /****************************************************************************
61  * Pre-Processor Definitions
62  ****************************************************************************/
63 
64 /****************************************************************************
65  * Public Data
66  ****************************************************************************/
67 
68 /****************************************************************************
69  * Implementation Classes
70  ****************************************************************************/
71 
72 #if defined(__cplusplus)
73 
74 namespace NXWidgets
75 {
76  class INxWindow;
77  class CNxWidget;
78 
79  /**
80  * Class providing a top-level widget and an interface to the CWidgetControl
81  * widget hierarchy.
82  *
83  * There are three instances that represent an NX window from the
84  * perspective of NXWidgets.
85  *
86  * - There is one widget control instance per NX window,
87  * - One CCallback instance per window,
88  * - One window instance.
89  *
90  * There a various kinds of of window instances, but each inherits
91  * (1) CCallback and dispatches the Windows callbacks and (2) INxWindow
92  * that describes the common window behavior.
93  */
94 
96  {
97  protected:
98  /**
99  * Structure holding the status of the Mouse or Touchscreen. There must
100  * be one instance of this structure per window instance. The
101  * content of this structure is update by the CGraphicsPort on each
102  * NX mouse callback
103  */
104 
105 #ifdef CONFIG_NX_XYINPUT
106  struct SXYInput
107  {
108  // A touchscreen has no buttons. However, the convention is that
109  // touchscreen contacts are reported with the LEFT button pressed.
110  // The loss of contct is reported with no buttons pressed.
111 
112 #if 0 // Center and right buttons are not used
113  // But only a mouse has center and right buttons
114 
115  uint16_t leftPressed : 1; /**< Left button pressed (or
116  touchscreen contact) */
117  uint16_t centerPressed : 1; /**< Center button pressed (not
118  used with touchscreen) */
119  uint16_t rightPressed : 1; /**< Right button pressed (not
120  used with touchscreen) */
121  uint16_t leftHeld : 1; /**< Left button held down (or
122  touchscreen contact) */
123  uint16_t centerHeld : 1; /**< Center button held down
124  (not used with touchscreen) */
125  uint16_t rightHeld : 1; /**< Right button held down
126  (not used with touchscreen) */
127  uint16_t leftDrag : 1; /**< Left button held down (or
128  touchscreen contact) */
129  uint16_t centerDrag : 1; /**< Center button held down (or
130  touchscreen contact) */
131  uint16_t rightDrag : 1; /**< Right button held down (or
132  touchscreen contact) */
133  uint16_t leftReleased : 1; /**< Left button release (or
134  loss of touchscreen contact) */
135  uint16_t centerReleased : 1; /**< Center button release (or
136  loss of touchscreen contact) */
137  uint16_t rightReleased : 1; /**< Right button release (or
138  loss of touchscreen contact) */
139  uint16_t doubleClick : 1; /**< Left button double click */
140  uint16_t unused : 3; /**< Padding bits */
141 #else
142  uint8_t leftPressed : 1; /**< Left button pressed (or
143  touchscreen contact) */
144  uint8_t leftHeld : 1; /**< Left button held down (or
145  touchscreen contact) */
146  uint8_t leftDrag : 1; /**< Left button held down (or
147  touchscreen contact) */
148  uint8_t leftReleased : 1; /**< Left button release (or
149  loss of touchscreen contact) */
150  uint8_t doubleClick : 1; /**< Left button double click */
151  uint8_t unused : 3; /**< Padding bits */
152 #endif
153 
154  // These are attributes common to both touchscreen and mouse input devices
155 
156  nxgl_coord_t x; /**< Current X coordinate of
157  the mouse/touch */
158  nxgl_coord_t y; /**< Current Y coordinate of
159  the mouse/touch */
160  nxgl_coord_t lastX; /**< X coordinate of the mouse
161  at the previous poll */
162  nxgl_coord_t lastY; /**< Y coordinate of the mouse
163  at the previous poll */
164  struct timespec leftPressTime; /**< Time the left button was
165  pressed */
166  struct timespec leftReleaseTime; /**< Time the left button was
167  released */
168  };
169 #endif
170 
171  /**
172  * State data
173  */
174 
175  CGraphicsPort *m_port; /**< The graphics port
176  that is used for
177  drawing on this window */
178  TNxArray<CNxWidget*> m_deleteQueue; /**< Array of widgets
179  awaiting deletion. */
180  TNxArray<CNxWidget*> m_widgets; /**< List of controlled
181  widgets. */
182  bool m_haveGeometry; /**< True: indicates that we
183  have valid geometry data. */
184 #ifdef CONFIG_NXWIDGET_EVENTWAIT
185  bool m_waiting; /**< True: Extternal logic waiting for
186  window event */
187  sem_t m_waitSem; /**< External loops waits for
188  events on this semaphore */
189 #endif
190 
191  /**
192  * I/O
193  */
194 
195 #ifdef CONFIG_NX_XYINPUT
196  struct SXYInput m_xyinput; /**< Current XY input
197  device state */
198 #endif
199  CNxWidget *m_clickedWidget; /**< Pointer to the widget
200  that is clicked. */
201  CNxWidget *m_focusedWidget; /**< Pointer to the widget
202  that received keyboard
203  input. */
204  uint8_t m_kbdbuf[CONFIG_NXWIDGETS_KBDBUFFER_SIZE];
205  uint8_t m_nCh; /**< Number of buffered
206  keyboard characters */
207  uint8_t m_controls[CONFIG_NXWIDGETS_CURSORCONTROL_SIZE];
208  uint8_t m_nCc; /**< Number of buffered
209  cursor controls */
210  /**
211  * The following were picked off from the position callback.
212  */
213 
214  NXHANDLE m_hWindow; /**< Handle to the NX window */
215  struct nxgl_size_s m_size; /**< Size of the window */
216  struct nxgl_point_s m_pos; /**< Position in display space */
217  struct nxgl_rect_s m_bounds; /**< Size of the display */
218  sem_t m_geoSem; /**< Posted when geometry is valid */
219  sem_t m_boundsSem; /**< Posted when bounds are valid */
220  CWindowEventHandlerList m_eventHandlers; /**< List of event handlers. */
221 
222  /**
223  * Style
224  */
225 
226  CWidgetStyle m_style; /**< Default style used by all
227  widgets in the window. */
228 
229  /**
230  * Copy a widget style
231  *
232  * @param dest The destination style
233  * @param src The source to use
234  */
235 
236  void copyWidgetStyle(CWidgetStyle *dest, const CWidgetStyle *src);
237 
238  /**
239  * Return the elapsed time in millisconds
240  *
241  * @param startTime A time in the past from which to compute the elapsed time.
242  * @return The elapsed time since startTime
243  */
244 
245  uint32_t elapsedTime(FAR const struct timespec *startTime);
246 
247  /**
248  * Pass clicks to the widget hierarchy. Closes the context menu if
249  * the clicked widget is not the context menu. If a single widget
250  * is supplied, only that widget is sent the click.
251  *
252  * @param x Click xcoordinate.
253  * @param y Click ycoordinate.
254  * @param widget. Specific widget to poll. Use NULL to run the
255  * all widgets in the window.
256  */
257 
258  void handleLeftClick(nxgl_coord_t x, nxgl_coord_t y, CNxWidget *widget);
259 
260  /**
261  * Get the index of the specified controlled widget.
262  *
263  * @param widget The widget to get the index of.
264  * @return The index of the widget. -1 if the widget is not found.
265  */
266 
267  const int getWidgetIndex(const CNxWidget *widget) const;
268 
269  /**
270  * Delete any widgets in the deletion queue.
271  */
272 
273  void processDeleteQueue(void);
274 
275  /**
276  * Process mouse/touchscreen events and send throughout the hierarchy.
277  *
278  * @param widget. Specific widget to poll. Use NULL to run the
279  * all widgets in the window.
280  * @return True means a mouse event occurred
281  */
282 
283  bool pollMouseEvents(CNxWidget* widget);
284 
285  /**
286  * Process keypad events and send throughout the hierarchy.
287  *
288  * @return True means a keyboard event occurred
289  */
290 
291  bool pollKeyboardEvents(void);
292 
293  /**
294  * Process cursor control events and send throughout the hierarchy.
295  *
296  * @return True means a cursor control event was processes
297  */
298 
299  bool pollCursorControlEvents(void);
300 
301  /**
302  * Wake up and external logic that is waiting for a window event.
303  */
304 
305 #ifdef CONFIG_NXWIDGET_EVENTWAIT
306  void postWindowEvent(void);
307 #endif
308 
309  /**
310  * Take the geometry semaphore (handling signal interruptions)
311  */
312 
313  void takeGeoSem(void);
314 
315  /**
316  * Give the geometry semaphore
317  */
318 
319  inline void giveGeoSem(void)
320  {
321  sem_post(&m_geoSem);
322  }
323 
324  /**
325  * Wait for geometry data
326  */
327 
328  inline void waitGeoData(void)
329  {
330  takeGeoSem();
331  giveGeoSem();
332  }
333 
334  /**
335  * Take the bounds semaphore (handling signal interruptions)
336  */
337 
338  void takeBoundsSem(void);
339 
340  /**
341  * Give the bounds semaphore
342  */
343 
344  inline void giveBoundsSem(void)
345  {
346  sem_post(&m_boundsSem);
347  }
348 
349  /**
350  * Wait for bounds data
351  */
352 
353  inline void waitBoundsData(void)
354  {
355  takeBoundsSem();
356  giveBoundsSem();
357  }
358 
359 #ifdef CONFIG_NX_XYINPUT
360  /**
361  * Clear all mouse events
362  */
363 
364  void clearMouseEvents(void);
365 #endif
366 
367  public:
368 
369  /**
370  * Constructor
371  *
372  * @param style The default style that all widgets on this display
373  * should use. If this is not specified, the widget will use the
374  * values stored in the defaultCWidgetStyle object.
375  */
376 
377  CWidgetControl(FAR const CWidgetStyle *style = (const CWidgetStyle *)NULL);
378 
379  /**
380  * Destructor.
381  */
382 
383  virtual ~CWidgetControl(void);
384 
385  /**
386  * Wait for an interesting window event to occur (like a mouse or keyboard event)
387  * Caller's should exercise care to assure that the test for waiting and this
388  * call are "atomic" .. perhaps by locking the scheduler like:
389  *
390  * sched_lock();
391  * <check for events>
392  * if (<no interesting events>)
393  * {
394  * window->waitForWindowEvent();
395  * }
396  * sched_unlock();
397  */
398 
399 #ifdef CONFIG_NXWIDGET_EVENTWAIT
400  void waitForWindowEvent(void);
401 #endif
402 
403  /**
404  * Is external logic awaiting for a window event?
405  *
406  * @return True if the widget if external logic is waiting.
407  */
408 
409 #ifdef CONFIG_NXWIDGET_EVENTWAIT
410  inline const bool isWaiting(void) const
411  {
412  return m_waiting;
413  }
414 #endif
415 
416  /**
417  * Run all code that needs to take place on a periodic basis.
418  * This method normally called externally... either periodically
419  * or when a window event is detected. If CONFIG_NXWIDGET_EVENTWAIT
420  * is defined, then external logic want call waitWindow event and
421  * when awakened, they chould call this function. As an example:
422  *
423  * for (;;)
424  * {
425  * sched_lock(); // Make the sequence atomic
426  * if (!window->pollEvents(0))
427  * {
428  * window->waitWindowEvent();
429  * }
430  * sched_unlock();
431  * }
432  *
433  * This method is just a wrapper simply calls the followi.
434  *
435  * processDeleteQueue()
436  * pollMouseEvents(widget)
437  * pollKeyboardEvents()
438  * pollCursorControlEvents()
439  *
440  * @param widget. Specific widget to poll. Use NULL to run the
441  * all widgets in the window.
442  * @return True means some interesting event occurred
443  */
444 
445  bool pollEvents(CNxWidget *widget = (CNxWidget *)NULL);
446 
447  /**
448  * Swaps the depth of the supplied widget.
449  * This function presumes that all child widgets are screens.
450  *
451  * @param widget The widget to be depth-swapped.
452  * @return True if the depth swap occurred.
453  */
454 
455  bool swapWidgetDepth(CNxWidget *widget);
456 
457  /**
458  * Add another widget to be managed by this control instance
459  *
460  * @param widget The widget to be controlled.
461  */
462 
463  inline void addControlledWidget(CNxWidget* widget)
464  {
465  m_widgets.push_back(widget);
466  }
467 
468  /**
469  * Remove a controlled widget
470  *
471  * @param widget The widget to be removed
472  */
473 
474  void removeControlledWidget(CNxWidget* widget);
475 
476  /**
477  * Get the number of controlled widgets.
478  *
479  * @return The number of child widgets belonging to this widget.
480  */
481 
482  inline const int getControlledWidgetCount(void) const
483  {
484  return m_widgets.size();
485  }
486 
487  /**
488  * Add a widget to the list of widgets to be deleted.
489  * Must never be called by anything other than the framework itself.
490  *
491  * @param widget The widget to add to the delete queue.
492  */
493 
494  void addToDeleteQueue(CNxWidget *widget);
495 
496  /**
497  * Set the clicked widget pointer. Note that this should not be
498  * called by code other than within the CWidgetControl library itself.
499  *
500  * @param widget The new clicked widget.
501  */
502 
503  void setClickedWidget(CNxWidget *widget);
504 
505  /**
506  * Get the clicked widget pointer.
507  *
508  * @return Pointer to the clicked widget.
509  */
510 
512  {
513  return m_clickedWidget;
514  }
515 
516  /**
517  * Set the focused widget that will receive keyboard input.
518  *
519  * @param widget The new focused widget.
520  */
521 
522  void setFocusedWidget(CNxWidget *widget);
523 
524  /**
525  * Reset the focused widget so that it will no longer receive keyboard input.
526  *
527  * @param widget The new focused widget.
528  */
529 
531  {
532  if (widget == m_focusedWidget)
533  {
534  m_focusedWidget = (CNxWidget *)NULL;
535  }
536  }
537 
538  /**
539  * Get the focused widget pointer.
540  *
541  * @return Pointer to the focused widget.
542  */
543 
545  {
546  return m_focusedWidget;
547  }
548 
549  /**
550  * Check for the occurrence of a double click.
551  *
552  * @return Pointer to the clicked widget.
553  */
554 
555  inline bool doubleClick(void)
556  {
557  return (bool)m_xyinput.doubleClick;
558  }
559 
560  /**
561  * Get the default widget style for this window.
562  *
563  * @param style. The location to return the widget's style
564  */
565 
566  inline void getWidgetStyle(CWidgetStyle *style)
567  {
568  copyWidgetStyle(style, &m_style);
569  }
570 
571  /**
572  * Set the default widget style for this window.
573  *
574  * @param style. The new widget style to copy.
575  */
576 
577  inline void setWidgetStyle(const CWidgetStyle *style)
578  {
579  copyWidgetStyle(&m_style, style);
580  }
581 
582  /**
583  * These remaining methods are used by the CCallback instance to
584  * provide notifications of certain events.
585  */
586 
587  /**
588  * This event will occur when the position or size of the underlying
589  * window occurs.
590  *
591  * @param hWindow The window handle that should be used to communicate
592  * with the window
593  * @param pos The position of the window in the physical device space.
594  * @param size The size of the window.
595  * @param bounds The size of the underlying display (pixels x rows)
596  */
597 
598  void geometryEvent(NXHANDLE hWindow,
599  const struct nxgl_size_s *size,
600  const struct nxgl_point_s *pos,
601  const struct nxgl_rect_s *bounds);
602 
603  /**
604  * This event will occur when the a portion of the window that was
605  * previously obscured is now exposed.
606  *
607  * @param nxRect The region in the window that must be redrawn.
608  * @param more True means that more re-draw requests will follow
609  */
610 
611  void redrawEvent(FAR const struct nxgl_rect_s *nxRect, bool more);
612 
613  /**
614  * This event means that new mouse data is available for the window.
615  *
616  * @param pos The (x,y) position of the mouse.
617  * @param buttons See NX_MOUSE_* definitions.
618  */
619 
620  void newMouseEvent(FAR const struct nxgl_point_s *pos, uint8_t buttons);
621 
622  /**
623  * This event means that keyboard/keypad data is available for the window.
624  *
625  * @param nCh The number of characters that are available in pStr[].
626  * @param pStr The array of characters.
627  */
628 
629 #ifdef CONFIG_NX_KBD
630  void newKeyboardEvent(uint8_t nCh, FAR const uint8_t *pStr);
631 #endif
632 
633  /**
634  * This event is the response from nx_block (or nxtk_block). Those
635  * blocking interfaces are used to assure that no further messages are
636  * directed to the window. Receipt of the blocked callback signifies
637  * that (1) there are no further pending events and (2) that the
638  * window is now 'defunct' and will receive no further events.
639  *
640  * This event supports coordinated destruction of a window in multi-
641  * user mode. In multi-use mode, the client window logic must stay
642  * intact until all of the queued callbacks are processed. Then the
643  * window may be safely closed. Closing the window prior with pending
644  * callbacks can lead to bad behavior when the callback is executed.
645  *
646  * @param arg - User provided argument (see nx_block or nxtk_block)
647  */
648 
649  inline void windowBlocked(FAR void *arg)
650  {
651  m_eventHandlers.raiseBlockedEvent(arg);
652  }
653 
654  /**
655  * This event means that cursor control data is available for the window.
656  *
657  * @param cursorControl The cursor control code received.
658  */
659 
660  void newCursorControlEvent(ECursorControl cursorControl);
661 
662  /**
663  * Get the window handle reported on the first position callback.
664  *
665  * @return This function returns the window handle.
666  */
667 
668  inline NXHANDLE getWindowHandle(void)
669  {
670  return m_hWindow;
671  }
672 
673  /**
674  * Get the window bounding box in physical display coordinates. This
675  * method may need to wait until bounds data is available.
676  *
677  * @return This function returns the window handle.
678  */
679 
681  {
682  waitBoundsData();
683  return CRect(&m_bounds);
684  }
685 
686  inline void getWindowBoundingBox(FAR struct nxgl_rect_s *bounds)
687  {
688  waitBoundsData();
689  nxgl_rectcopy(bounds, &m_bounds);
690  }
691 
692  /**
693  * Get the position of the window (as reported by the last NX callback). This
694  * method may need to wait until geometry data is available.
695  *
696  * @return The position.
697  */
698 
699  inline bool getWindowPosition(FAR struct nxgl_point_s *pos)
700  {
701  waitGeoData();
702  pos->x = m_pos.x;
703  pos->y = m_pos.y;
704  return true;
705  }
706 
707  /**
708  * Get the size of the window (as reported by the last NX callback). This
709  * method may need to wait until geometry data is available.
710  *
711  * @return The size.
712  */
713 
714  inline bool getWindowSize(FAR struct nxgl_size_s *size)
715  {
716  waitGeoData();
717  size->h = m_size.h;
718  size->w = m_size.w;
719  return true;
720  }
721 
722  /**
723  * Get the width of the window (as reported by the last NX callback). This
724  * method may need to wait until geometry data is available.
725  *
726  * @return The size.
727  */
728 
729  inline nxgl_coord_t getWindowWidth(void)
730  {
731  waitGeoData();
732  return m_size.w;
733  }
734 
735  /**
736  * Get the height of the window (as reported by the last NX callback). This
737  * method may need to wait until geometry data is available.
738  *
739  * @return The size.
740  */
741 
742  inline nxgl_coord_t getWindowHeight(void)
743  {
744  waitGeoData();
745  return m_size.h;
746  }
747 
748  /**
749  * The creation sequence is:
750  *
751  * 1) Create a dumb CWigetControl instance
752  * 2) Pass the dumb CWidgetControl instance to the window constructor
753  * that inherits from INxWindow.
754  * 3) The call this method with the static_cast to INxWindow to,
755  * finally, create the CGraphicsPort for this window.
756  * 4) After that, the fully smartend CWidgetControl instance can
757  * be used to generate additional widgets.
758  *
759  * @param window The instance of INxWindow needed to construct the
760  * CGraphicsPort instance
761  */
762 
763  bool createGraphicsPort(INxWindow *window);
764 
765  /**
766  * Get the CGraphicsPort instance for drawing on this window
767  */
768 
770  {
771  return m_port;
772  }
773 
774  /**
775  * Adds a window event handler. The window handler will receive
776  * notification all NX events received by this window\.
777  *
778  * @param eventHandler A pointer to the event handler.
779  */
780 
781  inline void addWindowEventHandler(CWindowEventHandler *eventHandler)
782  {
783  m_eventHandlers.addWindowEventHandler(eventHandler);
784  }
785 
786  /**
787  * Remove a window event handler.
788  *
789  * @param eventHandler A pointer to the event handler to remove.
790  */
791 
793  {
794  m_eventHandlers.removeWindowEventHandler(eventHandler);
795  }
796  };
797 }
798 
799 #endif // __cplusplus
800 
801 #endif // __INCLUDE_CWIDGETCONTROLT_HXX
void removeWindowEventHandler(CWindowEventHandler *eventHandler)
bool createGraphicsPort(INxWindow *window)
CWidgetControl(FAR const CWidgetStyle *style=(const CWidgetStyle *) NULL)
CGraphicsPort * getGraphicsPort(void)
const int getControlledWidgetCount(void) const
void windowBlocked(FAR void *arg)
void addControlledWidget(CNxWidget *widget)
TNxArray< CNxWidget * > m_deleteQueue
void addToDeleteQueue(CNxWidget *widget)
void copyWidgetStyle(CWidgetStyle *dest, const CWidgetStyle *src)
void setFocusedWidget(CNxWidget *widget)
const int getWidgetIndex(const CNxWidget *widget) const
const bool isWaiting(void) const
uint32_t elapsedTime(FAR const struct timespec *startTime)
void redrawEvent(FAR const struct nxgl_rect_s *nxRect, bool more)
bool getWindowPosition(FAR struct nxgl_point_s *pos)
struct nxgl_rect_s m_bounds
nxgl_coord_t getWindowWidth(void)
uint8_t m_kbdbuf[CONFIG_NXWIDGETS_KBDBUFFER_SIZE]
struct nxgl_point_s m_pos
bool pollEvents(CNxWidget *widget=(CNxWidget *) NULL)
bool swapWidgetDepth(CNxWidget *widget)
void setWidgetStyle(const CWidgetStyle *style)
void handleLeftClick(nxgl_coord_t x, nxgl_coord_t y, CNxWidget *widget)
void newCursorControlEvent(ECursorControl cursorControl)
void addWindowEventHandler(CWindowEventHandler *eventHandler)
void getWindowBoundingBox(FAR struct nxgl_rect_s *bounds)
CNxWidget * getFocusedWidget(void)
CNxWidget * getClickedWidget(void)
void push_back(const T &value)
Definition: tnxarray.hxx:267
void removeWindowEventHandler(CWindowEventHandler *eventHandler)
void geometryEvent(NXHANDLE hWindow, const struct nxgl_size_s *size, const struct nxgl_point_s *pos, const struct nxgl_rect_s *bounds)
nxgl_coord_t getWindowHeight(void)
CWindowEventHandlerList m_eventHandlers
void getWidgetStyle(CWidgetStyle *style)
TNxArray< CNxWidget * > m_widgets
void newKeyboardEvent(uint8_t nCh, FAR const uint8_t *pStr)
void setClickedWidget(CNxWidget *widget)
uint8_t m_controls[CONFIG_NXWIDGETS_CURSORCONTROL_SIZE]
struct nxgl_size_s m_size
const int size(void) const
Definition: tnxarray.hxx:261
bool getWindowSize(FAR struct nxgl_size_s *size)
bool pollMouseEvents(CNxWidget *widget)
void newMouseEvent(FAR const struct nxgl_point_s *pos, uint8_t buttons)
void clearFocusedWidget(CNxWidget *widget)
void addWindowEventHandler(CWindowEventHandler *eventHandler)
void removeControlledWidget(CNxWidget *widget)