NXWidgets  1.19
cnxwidget.hxx
Go to the documentation of this file.
1 /****************************************************************************
2  * include/cnxwidget.hxx
3  * NxWidgets/libnxwidgets/
4  *
5  * Copyright (C) 2012 Gregory Nutt. All rights reserved.
6  * Author: Gregory Nutt <gnutt@nuttx.org>
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
19  * me be used to endorse or promote products derived from this software
20  * without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
29  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *
35  ****************************************************************************
36  *
37  * Portions of this package derive from Woopsi (http://woopsi.org/) and
38  * portions are original efforts. It is difficult to determine at this
39  * point what parts are original efforts and which parts derive from Woopsi.
40  * However, in any event, the work of Antony Dzeryn will be acknowledged
41  * in most NxWidget files. Thanks Antony!
42  *
43  * Copyright (c) 2007-2011, Antony Dzeryn
44  * All rights reserved.
45  *
46  * Redistribution and use in source and binary forms, with or without
47  * modification, are permitted provided that the following conditions are met:
48  *
49  * * Redistributions of source code must retain the above copyright
50  * notice, this list of conditions and the following disclaimer.
51  * * Redistributions in binary form must reproduce the above copyright
52  * notice, this list of conditions and the following disclaimer in the
53  * documentation and/or other materials provided with the distribution.
54  * * Neither the names "Woopsi", "Simian Zombie" nor the
55  * names of its contributors may be used to endorse or promote products
56  * derived from this software without specific prior written permission.
57  *
58  * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
59  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
60  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
61  * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
62  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
63  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
64  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
65  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
66  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
67  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68  *
69  ****************************************************************************/
70 
71 #ifndef __INCLUDE_CNXWIDGET_HXX
72 #define __INCLUDE_CNXWIDGET_HXX
73 
74 /****************************************************************************
75  * Included Files
76  ****************************************************************************/
77 
78 #include <nuttx/config.h>
79 
80 #include <stdint.h>
81 #include <stdbool.h>
82 #include <ctime>
83 
84 #include <nuttx/nx/nxglib.h>
85 
86 #include "cnxstring.hxx"
87 #include "cnxfont.hxx"
88 #include "crect.hxx"
89 #include "cwidgetstyle.hxx"
90 #include "cwidgeteventargs.hxx"
91 #include "cwidgeteventhandler.hxx"
93 #include "tnxarray.hxx"
94 
95 /****************************************************************************
96  * Pre-Processor Definitions
97  ****************************************************************************/
98 
99 /****************************************************************************
100  * Implementation Classes
101  ****************************************************************************/
102 
103 #if defined(__cplusplus)
104 
105 namespace NXWidgets
106 {
107  /**
108  * Forward references
109  */
110 
111  class CWidgetControl;
112  class CGraphicsPort;
113  class CNxFont;
114  class CWidgetEventHandlerList;
115 
116  /**
117  * Class providing all the basic functionality of a NxWidget. All other
118  * widgets must must inherit from this class.
119  */
120 
121  class CNxWidget
122  {
123  public:
124 
125  /**
126  * Enum listing flags that can be set in the constructor's "flags" parameter.
127  */
128 
130  {
131  WIDGET_BORDERLESS = 0x0001, /**< Widget has no border */
132  WIDGET_DRAGGABLE = 0x0002, /**< Widget can be dragged by the user */
133  WIDGET_PERMEABLE = 0x0004, /**< Widget's children can exceed this widget's edges */
134  WIDGET_DOUBLE_CLICKABLE = 0x0008, /**< Widget can be double-clicked */
135  WIDGET_NO_RAISE_EVENTS = 0x0010, /**< Widget does not raise events */
136  };
137 
138  /**
139  * Struct describing some basic properties of a widget.
140  */
141 
142  typedef struct
143  {
144  uint8_t clicked : 1; /**< True if the widget is currently clicked. */
145  uint8_t hasFocus : 1; /**< True if the widget has focus. */
146  uint8_t dragging : 1; /**< True if the widget is being dragged. */
147  uint8_t deleted : 1; /**< True if the widget has been deleted. */
148  uint8_t borderless : 1; /**< True if the widget is borderless. */
149  uint8_t draggable : 1; /**< True if the widget can be dragged. */
150  uint8_t drawingEnabled : 1; /**< True if the widget can be drawn. */
151  uint8_t enabled : 1; /**< True if the widget is enabled. */
152  uint8_t permeable : 1; /**< True if the widget's children can exceed its dimensions. */
153  uint8_t erased : 1; /**< True if the widget is currently erased from the frame buffer. */
154  uint8_t hidden : 1; /**< True if the widget is hidden. */
155  uint8_t doubleClickable : 1; /**< True if the widget can be double-clicked. */
156  } Flags;
157 
158  /**
159  * Struct describing the size of all four borders of a widget.
160  */
161 
162  typedef struct
163  {
164  uint8_t top; /**< Height of the top border. */
165  uint8_t right; /**< Width of the right border. */
166  uint8_t bottom; /**< Height of the bottom border. */
167  uint8_t left; /**< Width of the left border. */
169 
170  protected:
171  CWidgetControl *m_widgetControl; /**< The controlling widget for the display */
172  CRect m_rect; /**< Rectangle bounding the widget. */
173 
174  // Dragging variables
175 
176  nxgl_coord_t m_grabPointX; /**< Physical space x coordinate where dragging began. */
177  nxgl_coord_t m_grabPointY; /**< Physical space y coordinate where dragging began. */
178  nxgl_coord_t m_newX; /**< Physical x coordinate where widget is being dragged to. */
179  nxgl_coord_t m_newY; /**< Physical y coordinate where widget is being dragged to. */
180 
181  // Style
182 
183  CWidgetStyle m_style; /**< All style information used by a widget. */
184 
185  // Status
186 
187  Flags m_flags; /**< Flags struct. */
188 
189  // Event handling
190 
191  CWidgetEventHandlerList *m_widgetEventHandlers; /**< List of event handlers. */
192 
193  // Double-clicking
194 
195  struct timespec m_lastClickTime; /**< System timer when last clicked. */
196  nxgl_coord_t m_lastClickX; /**< X coordinate of last click. */
197  nxgl_coord_t m_lastClickY; /**< Y coordinate of last click. */
198  int m_doubleClickBounds; /**< Area in which a click is assumed to be a double-click. */
199 
200  // Hierarchy control
201 
202  CNxWidget *m_parent; /**< Pointer to the widget's parent. */
203  CNxWidget *m_focusedChild; /**< Pointer to the child widget that has focus. */
204  TNxArray<CNxWidget*> m_children; /**< List of child widgets. */
205 
206  // Borders
207 
208  WidgetBorderSize m_borderSize; /**< Size of the widget borders. */
209 
210  /**
211  * Use the provided widget style
212  */
213 
214  void useWidgetStyle(const CWidgetStyle *style);
215 
216  /**
217  * Draw the area of this widget that falls within the clipping region.
218  * Called by the redraw() function to draw all visible regions.
219  *
220  * @param port The CGraphicsPort to draw to.
221  * @see redraw().
222  */
223 
224  virtual void drawContents(CGraphicsPort* port);
225 
226  /**
227  * Draw the area of this widget that falls within the clipping region.
228  * Called by the redraw() function to draw all visible regions.
229  *
230  * @param port The CGraphicsPort to draw to.
231  * @see redraw().
232  */
233 
234  virtual void drawBorder(CGraphicsPort* port) { }
235 
236  /**
237  * Draw all visible regions of this widget's children.
238  */
239 
240  void drawChildren(void);
241 
242  /**
243  * Erase and remove the supplied child widget from this widget and
244  * send it to the deletion queue.
245  *
246  * @param widget The widget to close.
247  * @see close().
248  */
249 
250  void closeChild(CNxWidget *widget);
251 
252  /**
253  * Notify this widget that it is being dragged, and set its drag point.
254  *
255  * @param x The x coordinate of the drag position relative to this widget.
256  * @param y The y coordinate of the drag position relative to this widget.
257  */
258 
259  void startDragging(nxgl_coord_t x, nxgl_coord_t y);
260 
261  /**
262  * Notify this widget that it is no longer being dragged.
263  */
264 
265  void stopDragging(nxgl_coord_t x, nxgl_coord_t y);
266 
267  /**
268  * Copy constructor is protected to prevent usage.
269  */
270 
271  inline CNxWidget(const CNxWidget &widget) { }
272 
273  /**
274  * Called when the widget is clicked. Override this when creating new
275  * widgets if the widget should exhibit additional behaviour when it is
276  * clicked.
277  *
278  * @param x The x coordinate of the click.
279  * @param y The y coordinate of the click.
280  */
281 
282  virtual inline void onClick(nxgl_coord_t x, nxgl_coord_t y) { }
283 
284  /**
285  * Called when the widget is double-clicked. Override this when
286  * creating new widgets if the widget should exhibit additional
287  * behaviour when it is double-clicked. To change the conditions that
288  * apply in detecting a double-click, override the isDoubleClicked()
289  * method.
290  *
291  * @param x The x coordinate of the click.
292  * @param y The y coordinate of the click.
293  */
294 
295  virtual inline void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y) { }
296 
297  /**
298  * Called just before the widget is released; the widget will be in the
299  * clicked stated. Override this when creating new widgets if the
300  * widget should exhibit additional behaviour when it is released.
301  *
302  * @param x The x coordinate of the mouse when released.
303  * @param y The y coordinate of the mouse when released.
304  */
305 
306  virtual inline void onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { }
307 
308  /**
309  * Called just after the widget is released; the widget will be in the
310  * released stated. Override this when creating new widgets if the
311  * widget should exhibit additional behaviour when it is released.
312  *
313  * @param x The x coordinate of the mouse when released.
314  * @param y The y coordinate of the mouse when released.
315  */
316 
317  virtual inline void onRelease(nxgl_coord_t x, nxgl_coord_t y) { }
318 
319  /**
320  * Called when the widget is released outside of its boundaries.
321  * Override this when creating new widgets if the widget should exhibit
322  * additional behaviour when it is released outside of its boundaries.
323  *
324  * @param x The x coordinate of the mouse when released.
325  * @param y The y coordinate of the mouse when released.
326  */
327 
328  virtual inline void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y) { }
329 
330  /**
331  * Called when the widget is dragged. Override this when creating new
332  * widgets if the widget should exhibit additional behaviour when it is
333  * dragged.
334  *
335  * @param x The x coordinate of the mouse.
336  * @param y The y coordinate of the mouse.
337  * @param vX X distance dragged.
338  * @param vY Y distance dragged.
339  */
340 
341  virtual inline void onDrag(nxgl_coord_t x, nxgl_coord_t y,
342  nxgl_coord_t vX, nxgl_coord_t vY) { }
343 
344  /**
345  * Called when the widget starts being dragged. Override this when
346  * creating new widgets if the widget should exhibit additional
347  * behaviour when dragging starts.
348  */
349 
350  virtual inline void onDragStart(void) { }
351 
352  /**
353  * Called when the widget stops being dragged. Override this when
354  * creating new widgets if the widget should exhibit additional
355  * behaviour when dragging stops.
356  */
357 
358  virtual inline void onDragStop(void) { }
359 
360  /**
361  * Called when the widget gains focus. Override this when creating new
362  * widgets if the widget should exhibit additional behaviour when
363  * gaining focus.
364  */
365 
366  virtual inline void onFocus(void) { }
367 
368  /**
369  * Called when the widget loses focus. Override this when creating new
370  * widgets if the widget should exhibit additional behaviour when
371  * losing focus.
372  */
373 
374  virtual inline void onBlur(void) { }
375 
376  /**
377  * Called when the widget is enabled. Override this when creating new
378  * widgets if the widget should exhibit additional behaviour when
379  * enabled.
380  */
381 
382  virtual inline void onEnable(void) { }
383 
384  /**
385  * Called when the widget is disabled. Override this when creating new
386  * widgets if the widget should exhibit additional behaviour when
387  * disabled.
388  */
389 
390  virtual inline void onDisable(void) { }
391 
392  /**
393  * Called when the widget is resized. Override this when creating new
394  * widgets if the widget should exhibit additional behaviour when
395  * resized.
396  *
397  * @param width The new width.
398  * @param height The new height.
399  */
400 
401  virtual inline void onResize(nxgl_coord_t width, nxgl_coord_t height) { }
402 
403  public:
404 
405  /**
406  * CNxWidget constructor.
407  *
408  * @param pWidgetControl The controllwing widget for the display
409  * @param x The x coordinate of the widget.
410  * @param y The y coordinate of the widget.
411  * @param width The width of the widget.
412  * @param height The height of the widget.
413  * @param flags Bitmask specifying some set-up values for the widget.
414  * @param style The style that the button should use. If this is not
415  * specified, the button will use the global default widget
416  * style.
417  * @see WidgetFlagType.
418  */
419 
420  CNxWidget(CWidgetControl *pWidgetControl,
421  nxgl_coord_t x, nxgl_coord_t y,
422  nxgl_coord_t width, nxgl_coord_t height,
423  uint32_t flags,
424  FAR const CWidgetStyle *style = (FAR const CWidgetStyle *)NULL);
425 
426  /**
427  * Destructor.
428  */
429 
430  virtual ~CNxWidget(void);
431 
432  /**
433  * Get the x coordinate of the widget in "Widget space".
434  *
435  * @return Widget space x coordinate.
436  */
437 
438  nxgl_coord_t getX(void) const;
439 
440  /**
441  * Get the y coordinate of the widget in "Widget space".
442  *
443  * @return Widget space y coordinate.
444  */
445 
446  nxgl_coord_t getY(void) const;
447 
448  /**
449  * Get the x coordinate of the widget relative to its parent.
450  *
451  * @return Parent-space x coordinate.
452  */
453 
454  nxgl_coord_t getRelativeX(void) const;
455 
456  /**
457  * Get the y coordinate of the widget relative to its parent.
458  *
459  * @return Parent-space y coordinate.
460  */
461 
462  nxgl_coord_t getRelativeY(void) const;
463 
464  /**
465  * Is the widget active?
466  * A value of true indicates that this widget has focus or is an ancestor
467  * of the widget with focus.
468  *
469  * @return True if active.
470  */
471 
472  inline bool hasFocus(void) const
473  {
474  return m_flags.hasFocus;
475  }
476 
477  /**
478  * Has the widget been marked for deletion? This function recurses up the widget
479  * hierarchy and only returns true if all of the widgets in the ancestor
480  * chain are not deleted.
481  *
482  * Widgets marked for deletion are automatically deleted and should not be
483  * interacted with.
484  *
485  * @return True if marked for deletion.
486  */
487 
488  bool isDeleted(void) const;
489 
490  /**
491  * Is the widget allowed to draw? This function recurses up the widget
492  * hierarchy and only returns true if all of the widgets in the ancestor
493  * chain are visible.
494  *
495  * @return True if drawing is enabled.
496  */
497 
498  bool isDrawingEnabled(void) const;
499 
500  /**
501  * Is the widget hidden? This function recurses up the widget
502  * hierarchy and returns true if any of the widgets in the ancestor
503  * chain are hidden.
504  *
505  * @return True if hidden.
506  */
507 
508  bool isHidden(void) const;
509 
510  /**
511  * Is the widget enabled? This function recurses up the widget
512  * hierarchy and only returns true if all of the widgets in the ancestor
513  * chain are enabled.
514  *
515  * @return True if enabled.
516  */
517 
518  bool isEnabled(void) const;
519 
520  /**
521  * Are the widget's edges permeable or solid?
522  * Permeable widgets do not enforce their dimensions on the
523  * coordinates and dimensions of child widgets.
524  *
525  * @return True if permeable.
526  */
527 
528  inline bool isPermeable(void) const
529  {
530  return m_flags.permeable;
531  }
532 
533  /**
534  * IS the widget double-clickable?
535  * @return True if the widget watches for double-clicks.
536  */
537 
538  inline bool isDoubleClickable(void) const
539  {
540  return m_flags.doubleClickable;
541  }
542 
543  /**
544  * Does the widget have a border?
545  *
546  * @return True if the widget does not have a border.
547  */
548 
549  inline bool isBorderless(void) const
550  {
551  return m_flags.borderless;
552  }
553 
554  /**
555  * Is the widget clicked?
556  *
557  * @return True if the widget is currently clicked.
558  */
559 
560  inline bool isClicked(void) const
561  {
562  return m_flags.clicked;
563  }
564 
565  /**
566  * Is the widget being dragged?
567  *
568  * @return True if the widget is currently being dragged.
569  */
570 
571  inline bool isBeingDragged(void) const
572  {
573  return m_flags.dragging;
574  }
575 
576  /**
577  * Get the width of the widget.
578  *
579  * @return The widget width.
580  */
581 
582  inline nxgl_coord_t getWidth(void) const
583  {
584  return m_rect.getWidth();
585  }
586 
587  /**
588  * Get the height of the widget.
589  *
590  * @return The widget height.
591  */
592 
593  inline nxgl_coord_t getHeight(void) const
594  {
595  return m_rect.getHeight();
596  }
597 
598  /**
599  * Get the size of the widget
600  *
601  * @return The widgets's size
602  */
603 
604  inline void getSize(struct nxgl_size_s &size) const
605  {
606  size.h = m_rect.getHeight();
607  size.w = m_rect.getWidth();
608  }
609 
610  /**
611  * Get the position of the widget
612  *
613  * @return The widgets's position
614  */
615 
616  inline void getPos(struct nxgl_point_s &pos) const
617  {
618  pos.x = m_rect.getX();
619  pos.y = m_rect.getY();
620  }
621 
622  /**
623  * Get the window bounding box in physical display coordinated.
624  *
625  * @return This function returns the window handle.
626  */
627 
628  inline CRect getBoundingBox(void)
629  {
630  return CRect(m_rect);
631  }
632 
633  /**
634  * Get the dimensions of the border
635  *
636  */
637 
638  inline void getBorderSize(WidgetBorderSize &borderSize)
639  {
640  borderSize.top = m_borderSize.top;
641  borderSize.left = m_borderSize.left;
642  borderSize.bottom = m_borderSize.bottom;
643  borderSize.right = m_borderSize.right;
644  }
645 
646  /**
647  * Get a pointer to this widget's parent.
648  *
649  * @return This widget's parent.
650  */
651 
652  inline CNxWidget *getParent(void) const
653  {
654  return m_parent;
655  }
656 
657  /**
658  * Get a pointer to this widget's focused child.
659  *
660  * @return This widget's focused child.
661  */
662 
664  {
665  return m_focusedChild;
666  }
667 
668  /**
669  * Insert the dimensions that this widget wants to have into the rect
670  * passed in as a parameter. All coordinates are relative to the widget's
671  * parent.
672  *
673  * @param rect Reference to a rect to populate with data.
674  */
675 
676  virtual void getPreferredDimensions(CRect &rect) const;
677 
678  /**
679  * Insert the properties of the space within this widget that is
680  * available for children into the rect passed in as a parameter.
681  * All coordinates are relative to this widget.
682  *
683  * @param rect Reference to a rect to populate with data.
684  */
685 
686  void getClientRect(CRect &rect) const;
687 
688  /**
689  * Insert the properties of the space within this widget that is
690  * available for children into the rect passed in as a parameter.
691  * Identical to getClientRect() except that all coordinates are
692  * absolute positions within the window.
693  *
694  * @param rect Reference to a rect to populate with data.
695  */
696 
697  void getRect(CRect &rect) const;
698 
699  /**
700  * Gets a pointer to the widget's font.
701  *
702  * @return A pointer to the widget's font.
703  */
704 
705  inline CNxFont *getFont(void) const
706  {
707  return m_style.font;
708  }
709 
710  /**
711  * Gets the color used for the normal background fill.
712  *
713  * @return Background fill color.
714  */
715 
716  inline nxgl_mxpixel_t getBackgroundColor(void) const
717  {
718  return m_style.colors.background;
719  }
720 
721  /**
722  * Gets the color used for the background fill when the widget is selected.
723  *
724  * @return Dark color.
725  */
726 
727  inline nxgl_mxpixel_t getSelectedBackgroundColor(void) const
728  {
729  return m_style.colors.selectedBackground;
730  }
731 
732  /**
733  * Gets the color used as the light edge in bevelled boxes.
734  *
735  * @return Shine color.
736  */
737 
738  inline nxgl_mxpixel_t getShineEdgeColor(void) const
739  {
740  return m_style.colors.shineEdge;
741  }
742 
743  /**
744  * Gets the color used as the dark edge in bevelled boxes.
745  *
746  * @return Shadow color.
747  */
748 
749  inline nxgl_mxpixel_t getShadowEdgeColor(void) const
750  {
751  return m_style.colors.shadowEdge;
752  }
753 
754  /**
755  * Gets the color used as the fill in focused window borders.
756  *
757  * @return Highlight color.
758  */
759 
760  inline nxgl_mxpixel_t getHighlightColor(void) const
761  {
762  return m_style.colors.highlight;
763  }
764 
765  /**
766  * Gets the color used for text in a disabled widget.
767  *
768  * @return Disabled text color.
769  */
770 
771  inline nxgl_mxpixel_t getDisabledTextColor(void) const
772  {
773  return m_style.colors.disabledText;
774  }
775 
776  /**
777  * Gets the color used for text in a enabled widget.
778  *
779  * @return Enabled text color.
780  */
781 
782  inline nxgl_mxpixel_t getEnabledTextColor(void) const
783  {
784  return m_style.colors.enabledText;
785  }
786 
787  /**
788  * Gets the color used for text in a clicked widget.
789  *
790  * @return Selected text color.
791  */
792 
793  inline nxgl_mxpixel_t getSelectedTextColor(void) const
794  {
795  return m_style.colors.selectedText;
796  }
797 
798  /**
799  * Get the style used by this widget
800  *
801  * @return Const pointer to CWidgetStyle stored inside this widget.
802  */
803 
804  inline const CWidgetStyle *getWidgetStyle() const { return &m_style; }
805 
806  /**
807  * Sets this widget's border state.
808  *
809  * @param isBorderless The border state.
810  */
811 
812  void setBorderless(bool isBorderless);
813 
814  /**
815  * Sets whether or not this widget can be dragged.
816  *
817  * @param isDraggable The draggable state.
818  */
819 
820  inline void setDraggable(bool isDraggable)
821  {
822  m_flags.draggable = isDraggable;
823  }
824 
825  /**
826  * Sets whether or not child widgets can exceed this widget's dimensions.
827  *
828  * @param permeable The permeable state.
829  */
830 
831  inline void setPermeable(bool permeable)
832  {
833  m_flags.permeable = permeable;
834  }
835 
836  /**
837  * Sets whether or not the widgets processes double-clicks.
838  *
839  * @param doubleClickable The double-clickable state.
840  */
841 
842  inline void setDoubleClickable(bool doubleClickable)
843  {
844  m_flags.doubleClickable = doubleClickable;
845  }
846 
847  /**
848  * Adds a widget event handler. The event handler will receive
849  * all events raised by this widget.
850  *
851  * @param eventHandler A pointer to the event handler.
852  */
853 
854  inline void addWidgetEventHandler(CWidgetEventHandler *eventHandler)
855  {
856  m_widgetEventHandlers->addWidgetEventHandler(eventHandler);
857  }
858 
859  /**
860  * Remove a widget event handler.
861  *
862  * @param eventHandler A pointer to the event handler to remove.
863  */
864 
866  {
867  m_widgetEventHandlers->removeWidgetEventHandler(eventHandler);
868  }
869 
870  /**
871  * Return the number of registered event handlers
872  *
873  * @return The number of registered event handlers
874  */
875 
876  inline int nWidgetEventHandlers(void) const
877  {
878  return m_widgetEventHandlers->size();
879  }
880 
881  /**
882  * Enables or disables event firing for this widget.
883  *
884  * @param raises True to enable events, false to disable.
885  */
886 
887  inline void setRaisesEvents(bool raises)
888  {
889  raises ? m_widgetEventHandlers->enable() : m_widgetEventHandlers->disable();
890  }
891 
892  /**
893  * Check if event handling is enabled for this widget.
894  *
895  * @return True is event handling is enabled.
896  */
897 
898  inline bool raisesEvents(void) const
899  {
900  return m_widgetEventHandlers->isEnabled();
901  }
902 
903  /**
904  * Disabled drawing of this widget. Widgets hidden using this method will still
905  * be processed.
906  */
907 
908  inline void disableDrawing(void)
909  {
910  m_flags.drawingEnabled = false;
911  }
912 
913  /**
914  * Enables drawing of this widget.
915  */
916 
917  inline void enableDrawing(void)
918  {
919  m_flags.drawingEnabled = true;
920  }
921 
922  /**
923  * Sets the normal background color.
924  *
925  * @param color The new background color.
926  */
927 
928  inline void setBackgroundColor(nxgl_mxpixel_t color)
929  {
930  m_style.colors.background = color;
931  }
932 
933  /**
934  * Sets the background color for a selected widget.
935  *
936  * @param color The new selected background color.
937  */
938 
939  inline void setSelectedBackgroundColor(nxgl_mxpixel_t color)
940  {
941  m_style.colors.selectedBackground = color;
942  }
943 
944  /**
945  * Sets the shiny edge color.
946  *
947  * @param color The new shine edge color.
948  */
949 
950  inline void setShineEdgeColor(nxgl_mxpixel_t color)
951  {
952  m_style.colors.shineEdge = color;
953  }
954 
955  /**
956  * Sets the shadow edge color.
957  *
958  * @param color The new shadow edge color.
959  */
960 
961  inline void setShadowEdgeColor(nxgl_mxpixel_t color)
962  {
963  m_style.colors.shadowEdge = color;
964  }
965 
966  /**
967  * Sets the highlight color.
968  *
969  * @param color The new highlight color.
970  */
971 
972  inline void setHighlightColor(nxgl_mxpixel_t color)
973  {
974  m_style.colors.highlight = color;
975  }
976 
977  /**
978  * Sets the text color to use when the widget is disabled.
979  *
980  * @param color The new text color.
981  */
982 
983  inline void setDisabledTextColor(nxgl_mxpixel_t color)
984  {
985  m_style.colors.disabledText = color;
986  }
987 
988  /**
989  * Sets the text color to use when the widget is enabled.
990  *
991  * @param color The new text color.
992  */
993 
994  inline void setEnabledTextColor(nxgl_mxpixel_t color)
995  {
996  m_style.colors.enabledText = color;
997  }
998 
999  /**
1000  * Sets the text color to use when the widget is highlighted or clicked.
1001  *
1002  * @param color The new selected text color.
1003  */
1004 
1005  inline void setSelectedTextColor(nxgl_mxpixel_t color)
1006  {
1007  m_style.colors.selectedText = color;
1008  }
1009 
1010  /**
1011  * Sets the font.
1012  *
1013  * @param font A pointer to the font to use.
1014  *
1015  * NOTE: This font is not deleted when the widget is destroyed!
1016  */
1017 
1018  virtual void setFont(CNxFont *font);
1019 
1020  /**
1021  * Draws the visible regions of the widget and the widget's child widgets.
1022  */
1023 
1024  void redraw(void);
1025 
1026  /**
1027  * Enables the widget.
1028  *
1029  * @return True if the widget was enabled.
1030  */
1031 
1032  bool enable(void);
1033 
1034  /**
1035  * Disabled the widget.
1036  *
1037  * @return True if the widget was disabled.
1038  */
1039 
1040  bool disable(void);
1041 
1042  /**
1043  * Erases the widget, marks it as deleted, and moves it to the CNxWidget
1044  * deletion queue. Widgets are automatically deleted by the framework and
1045  * should not be deleted externally.
1046  */
1047 
1048  void close(void);
1049 
1050  /**
1051  * Draws the widget and makes it visible.
1052  * Does not steal focus from other widgets.
1053  *
1054  * @return True if the widget was shown.
1055  * @see hide()
1056  */
1057 
1058  bool show(void);
1059 
1060  /**
1061  * Erases the widget and makes it invisible.
1062  * Does not re-assign focus to another widget.
1063  *
1064  * @return True if the widget was hidden.
1065  * @see show()
1066  */
1067 
1068  bool hide(void);
1069 
1070  /**
1071  * Click this widget at the supplied coordinates. This should only be
1072  * overridden in subclasses if the default click behaviour needs to be changed.
1073  * If the subclassed widget should just respond to a standard click,
1074  * the onClick() method should be overridden instead.
1075  *
1076  * @param x X coordinate of the click.
1077  * @param y Y coordinate of the click.
1078  * @return True if the click was successful.
1079  */
1080 
1081  virtual bool click(nxgl_coord_t x, nxgl_coord_t y);
1082 
1083  /**
1084  * Check if the click is a double-click.
1085  *
1086  * @param x X coordinate of the click.
1087  * @param y Y coordinate of the click.
1088  * @return True if the click is a double-click.
1089  */
1090 
1091  virtual bool isDoubleClick(nxgl_coord_t x, nxgl_coord_t y);
1092 
1093  /**
1094  * Double-click this widget at the supplied coordinates. This
1095  * should only be overridden in subclasses if the default
1096  * double-click behaviour needs to be changed. If the subclassed
1097  * widget should just respond to a standard double-click, the
1098  * onDoubleClick() method should be overridden instead.
1099  *
1100  * @param x X coordinate of the click.
1101  * @param y Y coordinate of the click.
1102  * @return True if the click was successful.
1103  */
1104 
1105  bool doubleClick(nxgl_coord_t x, nxgl_coord_t y);
1106 
1107  /**
1108  * Release this widget at the supplied coordinates. This
1109  * should only be overridden in subclasses if the default
1110  * release behaviour needs to be changed. If the subclassed
1111  * widget should just respond to a standard release, the
1112  * onRelease() method should be overridden instead.
1113  *
1114  * @param x X coordinate of the release.
1115  * @param y Y coordinate of the release.
1116  * @return True if the release was successful.
1117  */
1118 
1119  bool release(nxgl_coord_t x, nxgl_coord_t y);
1120 
1121  /**
1122  * Drag the widget to the supplied coordinates.
1123  *
1124  * @param x The x coordinate of the mouse.
1125  * @param y The y coordinate of the mouse.
1126  * @param vX The horizontal distance that the mouse was dragged.
1127  * @param vY The vertical distance that the mouse was dragged.
1128  * @return True if the drag was successful.
1129  */
1130 
1131  bool drag(nxgl_coord_t x, nxgl_coord_t y,
1132  nxgl_coord_t vX, nxgl_coord_t vY);
1133 
1134  /**
1135  * Send a keypress to the widget.
1136  *
1137  * @param key The keycode to send to the widget.
1138  * @return True if the keypress was processed.
1139  */
1140 
1141  bool keyPress(nxwidget_char_t key);
1142 
1143  /**
1144  * Send a cursor control event to the widget.
1145  *
1146  * @param control The cursor control code to send to the widget.
1147  * @return True if the cursor control was processed.
1148  */
1149 
1150  bool cursorControl(ECursorControl control);
1151 
1152  /**
1153  * Give the widget focus.
1154  *
1155  * @return True if the widget received focus correctly.
1156  */
1157 
1158  bool focus(void);
1159 
1160  /**
1161  * Remove focus from the widget.
1162  *
1163  * @return True if the widget lost focus correctly.
1164  */
1165 
1166  bool blur(void);
1167 
1168  /**
1169  * Move the widget to the new coordinates.
1170  * Co-ordinates are relative to the parent widget.
1171  *
1172  * @param x The new x coordinate.
1173  * @param y The new y coordinate.
1174  * @return True if the move was successful.
1175  */
1176 
1177  bool moveTo(nxgl_coord_t x, nxgl_coord_t y);
1178 
1179  /**
1180  * Resize the widget to the new dimensions.
1181  *
1182  * @param width The new width.
1183  * @param height The new height.
1184  * @return True if the resize was successful.
1185  */
1186 
1187  bool resize(nxgl_coord_t width, nxgl_coord_t height);
1188 
1189  /**
1190  * Resize and move the widget in one operation.
1191  * Only performs one redraw so it is faster than calling the
1192  * two separate functions.
1193  *
1194  * @param x The new x coordinate.
1195  * @param y The new y coordinate.
1196  * @param width The new width.
1197  * @param height The new height.
1198  * @return True if the widget was adjusted successfully.
1199  */
1200 
1201  bool changeDimensions(nxgl_coord_t x, nxgl_coord_t y,
1202  nxgl_coord_t width, nxgl_coord_t height);
1203 
1204  /**
1205  * Moves the supplied child widget to the deletion queue.
1206  * For framework use only.
1207  *
1208  * @param widget A pointer to the child widget.
1209  */
1210 
1211  void moveChildToDeleteQueue(CNxWidget *widget);
1212 
1213  /**
1214  * Sets the supplied widget as the focused child. The widget must
1215  * be a child of this widget.
1216  *
1217  * @param widget A pointer to the child widget.
1218  * @see getFocusedWidget()
1219  */
1220 
1221  void setFocusedWidget(CNxWidget *widget);
1222 
1223  /**
1224  * Checks if the supplied coordinates collide with this widget.
1225  *
1226  * @param x The x coordinate to check.
1227  * @param y The y coordinate to check.
1228  * @return True if a collision occurred.
1229  */
1230 
1231  virtual bool checkCollision(nxgl_coord_t x, nxgl_coord_t y) const;
1232 
1233  /**
1234  * Checks if the supplied rectangle definition collides with this widget.
1235  *
1236  * @param x The x coordinate of the rectangle to check.
1237  * @param y The y coordinate of the rectangle to check.
1238  * @param width The width of the rectangle to check.
1239  * @param height The height of the rectangle to check.
1240  * @return True if a collision occurred.
1241  */
1242 
1243  virtual bool checkCollision(nxgl_coord_t x, nxgl_coord_t y,
1244  nxgl_coord_t width, nxgl_coord_t height) const;
1245 
1246  /**
1247  * Checks if the supplied widget collides with this widget.
1248  *
1249  * @param widget A pointer to another widget to check for collisions with.
1250  * @return True if a collision occurred.
1251  */
1252 
1253  bool checkCollision(CNxWidget *widget) const;
1254 
1255  /**
1256  * Adds a widget to this widget's child stack. The widget is added to the
1257  * top of the stack. Note that the widget can only be added if it is not
1258  * already a child of another widget.
1259  *
1260  * @param widget A pointer to the widget to add to the child list.
1261  * @see insertWidget()
1262  */
1263 
1264  void addWidget(CNxWidget *widget);
1265 
1266  /**
1267  * Inserts a widget into this widget's child stack at the bottom of the
1268  * stack. Note that the widget can only be added if it is not already
1269  * a child of another widget.
1270  *
1271  * @param widget A pointer to the widget to add to the child list.
1272  * @see addWidget()
1273  */
1274 
1275  void insertWidget(CNxWidget *widget);
1276 
1277  /**
1278  * Set the widget's parent to the widget passed in as a parameter.
1279  * Called automatically when a widget is added as a child.
1280  *
1281  * @param parent A pointer to the parent widget.
1282  */
1283 
1284  inline void setParent(CNxWidget *parent)
1285  {
1286  m_parent = parent;
1287  }
1288 
1289  /**
1290  * Delete this widget. This should never be called in user code; widget
1291  * deletion is handled internally.
1292  */
1293 
1294  inline void destroy(void)
1295  {
1296  delete this;
1297  }
1298 
1299  /**
1300  * Remove this widget from the widget hierarchy. Returns
1301  * responsibility for deleting the widget back to the developer.
1302  * Does not unregister the widget from the VBL system.
1303  * Does not erase the widget from the display.
1304  *
1305  * @return True if the widget was successfully removed.
1306  */
1307 
1308  bool remove(void);
1309 
1310  /**
1311  * Remove a child widget from the widget hierarchy. Returns
1312  * responsibility for deleting the widget back to the developer.
1313  * Does not unregister the widget from the VBL system.
1314  * Does not erase the widget from the display.
1315  *
1316  * @param widget Pointer to the widget to remove from the hierarchy.
1317  * @return True if the widget was succesfully removed.
1318  */
1319 
1320  bool removeChild(CNxWidget *widget);
1321 
1322  /**
1323  * Get the child widget at the specified index.
1324  *
1325  * @param index Index of the child to retrieve.
1326  * @return Pointer to the child at the specified index.
1327  */
1328 
1329  const CNxWidget *getChild(int index) const;
1330 
1331  /**
1332  * Get the number of child widgets.
1333  *
1334  * @return The number of child widgets belonging to this widget.
1335  */
1336 
1337  int getChildCount(void) const
1338  {
1339  return m_children.size();
1340  }
1341 
1342  /**
1343  * Sets the border size. The border cannot be drawn over in the
1344  * drawContents() method.
1345  *
1346  * @param borderSize The new border size.
1347  */
1348 
1349  void setBorderSize(const WidgetBorderSize &borderSize);
1350  };
1351 }
1352 
1353 #endif // __cplusplus
1354 
1355 #endif // __INCLUDE_CNXWIDGET_HXX
1356 
virtual void onClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.hxx:282
CRect getBoundingBox(void)
Definition: cnxwidget.hxx:628
nxgl_mxpixel_t selectedBackground
WidgetBorderSize m_borderSize
Definition: cnxwidget.hxx:208
nxgl_coord_t getRelativeY(void) const
Definition: cnxwidget.cxx:288
bool isClicked(void) const
Definition: cnxwidget.hxx:560
bool isBorderless(void) const
Definition: cnxwidget.hxx:549
nxgl_coord_t m_newY
Definition: cnxwidget.hxx:179
nxgl_mxpixel_t getShadowEdgeColor(void) const
Definition: cnxwidget.hxx:749
nxgl_mxpixel_t enabledText
nxgl_coord_t getHeight(void) const
Definition: crect.hxx:204
nxgl_coord_t m_newX
Definition: cnxwidget.hxx:178
virtual bool isDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:687
virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.hxx:328
bool moveTo(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:990
nxgl_coord_t m_grabPointY
Definition: cnxwidget.hxx:177
nxgl_mxpixel_t disabledText
int nWidgetEventHandlers(void) const
Definition: cnxwidget.hxx:876
const CWidgetStyle * getWidgetStyle() const
Definition: cnxwidget.hxx:804
virtual void getPreferredDimensions(CRect &rect) const
Definition: cnxwidget.cxx:408
bool isPermeable(void) const
Definition: cnxwidget.hxx:528
void disableDrawing(void)
Definition: cnxwidget.hxx:908
void getRect(CRect &rect) const
Definition: cnxwidget.cxx:448
void setRaisesEvents(bool raises)
Definition: cnxwidget.hxx:887
bool cursorControl(ECursorControl control)
Definition: cnxwidget.cxx:886
nxgl_coord_t getWidth(void) const
Definition: crect.hxx:181
virtual void drawBorder(CGraphicsPort *port)
Definition: cnxwidget.hxx:234
virtual void drawContents(CGraphicsPort *port)
Definition: cnxwidget.cxx:1458
nxgl_coord_t getX(void) const
Definition: crect.hxx:160
int getChildCount(void) const
Definition: cnxwidget.hxx:1337
void setShineEdgeColor(nxgl_mxpixel_t color)
Definition: cnxwidget.hxx:950
bool raisesEvents(void) const
Definition: cnxwidget.hxx:898
void setSelectedBackgroundColor(nxgl_mxpixel_t color)
Definition: cnxwidget.hxx:939
void setEnabledTextColor(nxgl_mxpixel_t color)
Definition: cnxwidget.hxx:994
nxgl_mxpixel_t getBackgroundColor(void) const
Definition: cnxwidget.hxx:716
bool isBeingDragged(void) const
Definition: cnxwidget.hxx:571
nxgl_coord_t m_grabPointX
Definition: cnxwidget.hxx:176
CNxWidget(const CNxWidget &widget)
Definition: cnxwidget.hxx:271
virtual ~CNxWidget(void)
Definition: cnxwidget.cxx:203
const CNxWidget * getChild(int index) const
Definition: cnxwidget.cxx:1408
bool drag(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t vX, nxgl_coord_t vY)
Definition: cnxwidget.cxx:835
void removeWidgetEventHandler(CWidgetEventHandler *eventHandler)
Definition: cnxwidget.hxx:865
bool isEnabled(void) const
Definition: cnxwidget.cxx:381
void addWidgetEventHandler(CWidgetEventHandler *eventHandler)
bool resize(nxgl_coord_t width, nxgl_coord_t height)
Definition: cnxwidget.cxx:1079
virtual void onDisable(void)
Definition: cnxwidget.hxx:390
void setDisabledTextColor(nxgl_mxpixel_t color)
Definition: cnxwidget.hxx:983
void stopDragging(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:1561
CWidgetControl * m_widgetControl
Definition: cnxwidget.hxx:171
nxgl_mxpixel_t getEnabledTextColor(void) const
Definition: cnxwidget.hxx:782
nxgl_coord_t getHeight(void) const
Definition: cnxwidget.hxx:593
void useWidgetStyle(const CWidgetStyle *style)
Definition: cnxwidget.cxx:1437
bool isDeleted(void) const
Definition: cnxwidget.cxx:304
void setSelectedTextColor(nxgl_mxpixel_t color)
Definition: cnxwidget.hxx:1005
virtual bool click(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:630
void getClientRect(CRect &rect) const
Definition: cnxwidget.cxx:421
bool changeDimensions(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height)
Definition: cnxwidget.cxx:1151
bool isDoubleClickable(void) const
Definition: cnxwidget.hxx:538
void getPos(struct nxgl_point_s &pos) const
Definition: cnxwidget.hxx:616
virtual void onFocus(void)
Definition: cnxwidget.hxx:366
void addWidgetEventHandler(CWidgetEventHandler *eventHandler)
Definition: cnxwidget.hxx:854
virtual void onDrag(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t vX, nxgl_coord_t vY)
Definition: cnxwidget.hxx:341
uint16_t nxwidget_char_t
Definition: nxconfig.hxx:454
nxgl_mxpixel_t getSelectedBackgroundColor(void) const
Definition: cnxwidget.hxx:727
void setPermeable(bool permeable)
Definition: cnxwidget.hxx:831
bool doubleClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:719
CNxWidget * getParent(void) const
Definition: cnxwidget.hxx:652
virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.hxx:317
nxgl_coord_t m_lastClickY
Definition: cnxwidget.hxx:197
virtual void onDragStart(void)
Definition: cnxwidget.hxx:350
void drawChildren(void)
Definition: cnxwidget.cxx:1468
virtual void setFont(CNxFont *font)
Definition: cnxwidget.cxx:474
CNxWidget * getFocusedWidget(void)
Definition: cnxwidget.hxx:663
CNxFont * getFont(void) const
Definition: cnxwidget.hxx:705
void setParent(CNxWidget *parent)
Definition: cnxwidget.hxx:1284
virtual bool checkCollision(nxgl_coord_t x, nxgl_coord_t y) const
Definition: cnxwidget.cxx:1229
nxgl_mxpixel_t getShineEdgeColor(void) const
Definition: cnxwidget.hxx:738
void closeChild(CNxWidget *widget)
Definition: cnxwidget.cxx:1484
virtual void onEnable(void)
Definition: cnxwidget.hxx:382
void enableDrawing(void)
Definition: cnxwidget.hxx:917
nxgl_coord_t m_lastClickX
Definition: cnxwidget.hxx:196
void getSize(struct nxgl_size_s &size) const
Definition: cnxwidget.hxx:604
bool removeChild(CNxWidget *widget)
Definition: cnxwidget.cxx:1362
void setShadowEdgeColor(nxgl_mxpixel_t color)
Definition: cnxwidget.hxx:961
virtual void onPreRelease(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.hxx:306
CWidgetEventHandlerList * m_widgetEventHandlers
Definition: cnxwidget.hxx:191
CNxWidget * m_focusedChild
Definition: cnxwidget.hxx:203
void insertWidget(CNxWidget *widget)
Definition: cnxwidget.cxx:1321
virtual void onResize(nxgl_coord_t width, nxgl_coord_t height)
Definition: cnxwidget.hxx:401
void addWidget(CNxWidget *widget)
Definition: cnxwidget.cxx:1293
nxgl_mxpixel_t getHighlightColor(void) const
Definition: cnxwidget.hxx:760
bool keyPress(nxwidget_char_t key)
Definition: cnxwidget.cxx:858
void setDraggable(bool isDraggable)
Definition: cnxwidget.hxx:820
nxgl_coord_t getRelativeX(void) const
Definition: cnxwidget.cxx:277
nxgl_coord_t getY(void) const
Definition: cnxwidget.cxx:261
nxgl_coord_t getWidth(void) const
Definition: cnxwidget.hxx:582
void getBorderSize(WidgetBorderSize &borderSize)
Definition: cnxwidget.hxx:638
nxgl_coord_t getX(void) const
Definition: cnxwidget.cxx:245
void removeWidgetEventHandler(CWidgetEventHandler *eventHandler)
nxgl_coord_t getY(void) const
Definition: crect.hxx:170
CWidgetStyle m_style
Definition: cnxwidget.hxx:183
nxgl_mxpixel_t getDisabledTextColor(void) const
Definition: cnxwidget.hxx:771
void setDoubleClickable(bool doubleClickable)
Definition: cnxwidget.hxx:842
virtual void onBlur(void)
Definition: cnxwidget.hxx:374
bool release(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:771
const int size(void) const
Definition: tnxarray.hxx:261
nxgl_mxpixel_t selectedText
void setFocusedWidget(CNxWidget *widget)
Definition: cnxwidget.cxx:1196
virtual void onDragStop(void)
Definition: cnxwidget.hxx:358
TNxArray< CNxWidget * > m_children
Definition: cnxwidget.hxx:204
void moveChildToDeleteQueue(CNxWidget *widget)
Definition: cnxwidget.cxx:1168
bool isDrawingEnabled(void) const
Definition: cnxwidget.cxx:325
void startDragging(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:1542
void setBorderSize(const WidgetBorderSize &borderSize)
Definition: cnxwidget.cxx:1425
void setHighlightColor(nxgl_mxpixel_t color)
Definition: cnxwidget.hxx:972
struct timespec m_lastClickTime
Definition: cnxwidget.hxx:195
nxgl_mxpixel_t getSelectedTextColor(void) const
Definition: cnxwidget.hxx:793
void setBorderless(bool isBorderless)
Definition: cnxwidget.cxx:461
void setBackgroundColor(nxgl_mxpixel_t color)
Definition: cnxwidget.hxx:928
bool isHidden(void) const
Definition: cnxwidget.cxx:354
CNxWidget * m_parent
Definition: cnxwidget.hxx:202
virtual void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.hxx:295
bool hasFocus(void) const
Definition: cnxwidget.hxx:472