diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-15 16:40:43 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-15 16:40:43 +0000 |
commit | 91e38a73cd93af894ecaf44476ae8e6313670cb5 (patch) | |
tree | cb7832604175934e7af73bad5da00c0581f4fbef /NxWidgets/libnxwidgets/src | |
parent | df1d64bd97cfc3039c113a258af134da6e6ba742 (diff) | |
download | px4-nuttx-91e38a73cd93af894ecaf44476ae8e6313670cb5.tar.gz px4-nuttx-91e38a73cd93af894ecaf44476ae8e6313670cb5.tar.bz2 px4-nuttx-91e38a73cd93af894ecaf44476ae8e6313670cb5.zip |
NxWidgets: New pre-release event. Action now raised on pre-release. NxWM: Use action event to process icon touches; Fix initialization of image highlighted state.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4740 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/libnxwidgets/src')
-rw-r--r-- | NxWidgets/libnxwidgets/src/cbitmap.cxx | 2 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cbutton.cxx | 15 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cbuttonarray.cxx | 14 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cimage.cxx | 29 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cnxwidget.cxx | 21 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx | 2 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx | 2 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx | 2 |
8 files changed, 70 insertions, 17 deletions
diff --git a/NxWidgets/libnxwidgets/src/cbitmap.cxx b/NxWidgets/libnxwidgets/src/cbitmap.cxx index 875e6daaa..c9c974814 100644 --- a/NxWidgets/libnxwidgets/src/cbitmap.cxx +++ b/NxWidgets/libnxwidgets/src/cbitmap.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> diff --git a/NxWidgets/libnxwidgets/src/cbutton.cxx b/NxWidgets/libnxwidgets/src/cbutton.cxx index 66ad3f2c7..429905759 100644 --- a/NxWidgets/libnxwidgets/src/cbutton.cxx +++ b/NxWidgets/libnxwidgets/src/cbutton.cxx @@ -275,15 +275,26 @@ void CButton::onClick(nxgl_coord_t x, nxgl_coord_t y) } /** - * Raises an action event and redraws the button. + * Raises an action. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. */ -void CButton::onRelease(nxgl_coord_t x, nxgl_coord_t y) +void CButton::onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { m_widgetEventHandlers->raiseActionEvent(); +} + +/** + * Redraws the button. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + +void CButton::onRelease(nxgl_coord_t x, nxgl_coord_t y) +{ redraw(); } diff --git a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx index 263a16ce4..642a0a562 100644 --- a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx +++ b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx @@ -546,16 +546,26 @@ void CButtonArray::onClick(nxgl_coord_t x, nxgl_coord_t y) } /** - * Raises an action event and redraws the button. + * Raises an action. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. */ -void CButtonArray::onRelease(nxgl_coord_t x, nxgl_coord_t y) +void CButtonArray::onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { m_widgetEventHandlers->raiseActionEvent(); +} +/** + * Redraws the button. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + +void CButtonArray::onRelease(nxgl_coord_t x, nxgl_coord_t y) +{ // Redraw only the button that was released m_redrawButton = true; diff --git a/NxWidgets/libnxwidgets/src/cimage.cxx b/NxWidgets/libnxwidgets/src/cimage.cxx index 7d9e0ee4e..30bf7e78b 100644 --- a/NxWidgets/libnxwidgets/src/cimage.cxx +++ b/NxWidgets/libnxwidgets/src/cimage.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -116,12 +116,16 @@ CImage::CImage(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y, { // Save the IBitmap instance - m_bitmap = bitmap; + m_bitmap = bitmap; + + // Not highlighted + + m_highlighted = false; // Position the top/lef corner of the bitmap in the top/left corner of the display - m_origin.x = 0; - m_origin.y = 0; + m_origin.x = 0; + m_origin.y = 0; } /** @@ -385,20 +389,31 @@ void CImage::onClick(nxgl_coord_t x, nxgl_coord_t y) } /** - * Raises an action event and redraws the button. + * Raises an action. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. */ -void CImage::onRelease(nxgl_coord_t x, nxgl_coord_t y) +void CImage::onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { m_widgetEventHandlers->raiseActionEvent(); +} + +/** + * Redraws the image. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + +void CImage::onRelease(nxgl_coord_t x, nxgl_coord_t y) +{ redraw(); } /** - * Redraws the button. + * Redraws the image. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. diff --git a/NxWidgets/libnxwidgets/src/cnxwidget.cxx b/NxWidgets/libnxwidgets/src/cnxwidget.cxx index 66766dca6..ab4a09b4e 100644 --- a/NxWidgets/libnxwidgets/src/cnxwidget.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwidget.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -772,6 +772,17 @@ bool CNxWidget::release(nxgl_coord_t x, nxgl_coord_t y) return false; } + // Notify of the pre-release event. In this event, the widget is still in the + // clicked state. This event is used, for example, by button handlers so + // that the click event is really processed when the button is released + // instead of pressed. The former behavior is needed because the result + // of processing the press may obscure the button and make it impossible + // to receive the release event. + + onPreRelease(x, y); + + // Now mark the widget as NOT clicked and stop draggin actions. + m_flags.clicked = false; stopDragging(x, y); @@ -784,6 +795,9 @@ bool CNxWidget::release(nxgl_coord_t x, nxgl_coord_t y) if (checkCollision(x, y)) { + // Notify of the release event... the widget was NOT dragged outside of + // its original bounding box + onRelease(x, y); // Release occurred within widget; raise release @@ -792,9 +806,12 @@ bool CNxWidget::release(nxgl_coord_t x, nxgl_coord_t y) } else { + // Notify of the release event... the widget WAS dragged outside of + // its original bounding box + onReleaseOutside(x, y); - // Release occurred outside widget; raise release + // Release occurred outside widget; raise release outside event m_widgetEventHandlers->raiseReleaseOutsideEvent(x, y); } diff --git a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx index 4c781e2c9..99f7fdbba 100644 --- a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx +++ b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> diff --git a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx index 5ecd8ab22..286c9c46a 100644 --- a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx +++ b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> diff --git a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx index 68230e17a..91722725a 100644 --- a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx +++ b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> |