mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 01:43:34 +08:00
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: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4740 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -179,7 +179,16 @@ namespace NXWidgets
|
||||
virtual void 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.
|
||||
*/
|
||||
|
||||
virtual void onPreRelease(nxgl_coord_t x, nxgl_coord_t y);
|
||||
|
||||
/**
|
||||
* Redraws the button.
|
||||
*
|
||||
* @param x The x coordinate of the mouse.
|
||||
* @param y The y coordinate of the mouse.
|
||||
|
||||
@@ -133,7 +133,16 @@ namespace NXWidgets
|
||||
virtual void 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.
|
||||
*/
|
||||
|
||||
virtual void onPreRelease(nxgl_coord_t x, nxgl_coord_t y);
|
||||
|
||||
/**
|
||||
* Redraws the button.
|
||||
*
|
||||
* @param x The x coordinate of the mouse.
|
||||
* @param y The y coordinate of the mouse.
|
||||
|
||||
@@ -143,16 +143,25 @@ namespace NXWidgets
|
||||
virtual void 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.
|
||||
*/
|
||||
|
||||
virtual void onPreRelease(nxgl_coord_t x, nxgl_coord_t y);
|
||||
|
||||
/**
|
||||
* Redraws the image.
|
||||
*
|
||||
* @param x The x coordinate of the mouse.
|
||||
* @param y The y coordinate of the mouse.
|
||||
*/
|
||||
|
||||
virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y);
|
||||
|
||||
|
||||
/**
|
||||
* Redraws the button.
|
||||
* Redraws the image.
|
||||
*
|
||||
* @param x The x coordinate of the mouse.
|
||||
* @param y The y coordinate of the mouse.
|
||||
|
||||
@@ -296,9 +296,20 @@ namespace NXWidgets
|
||||
virtual inline void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y) { }
|
||||
|
||||
/**
|
||||
* Called when the widget is released. Override this when
|
||||
* creating new widgets if the widget should exhibit additional
|
||||
* behaviour when it is released.
|
||||
* Called just before the widget is released; the widget will be in the
|
||||
* clicked stated. Override this when creating new widgets if the
|
||||
* widget should exhibit additional behaviour when it is released.
|
||||
*
|
||||
* @param x The x coordinate of the mouse when released.
|
||||
* @param y The y coordinate of the mouse when released.
|
||||
*/
|
||||
|
||||
virtual inline void onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { }
|
||||
|
||||
/**
|
||||
* Called just after the widget is released; the widget will be in the
|
||||
* released stated. Override this when creating new widgets if the
|
||||
* widget should exhibit additional behaviour when it is released.
|
||||
*
|
||||
* @param x The x coordinate of the mouse when released.
|
||||
* @param y The y coordinate of the mouse when released.
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace NXWidgets
|
||||
virtual void handleDoubleClickEvent(const CWidgetEventArgs &e) { }
|
||||
|
||||
/**
|
||||
* Handle a widget action event.
|
||||
* Handle a widget action event. For CImage, this is a mouse button pre-release event.
|
||||
*
|
||||
* @param e The event data.
|
||||
*/
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -275,7 +275,19 @@ 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::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.
|
||||
@@ -283,7 +295,6 @@ void CButton::onClick(nxgl_coord_t x, nxgl_coord_t y)
|
||||
|
||||
void CButton::onRelease(nxgl_coord_t x, nxgl_coord_t y)
|
||||
{
|
||||
m_widgetEventHandlers->raiseActionEvent();
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
@@ -546,7 +546,19 @@ 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::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.
|
||||
@@ -554,8 +566,6 @@ void CButtonArray::onClick(nxgl_coord_t x, nxgl_coord_t y)
|
||||
|
||||
void CButtonArray::onRelease(nxgl_coord_t x, nxgl_coord_t y)
|
||||
{
|
||||
m_widgetEventHandlers->raiseActionEvent();
|
||||
|
||||
// Redraw only the button that was released
|
||||
|
||||
m_redrawButton = true;
|
||||
|
||||
@@ -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,7 +389,19 @@ 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::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.
|
||||
@@ -393,12 +409,11 @@ void CImage::onClick(nxgl_coord_t x, nxgl_coord_t y)
|
||||
|
||||
void CImage::onRelease(nxgl_coord_t x, nxgl_coord_t y)
|
||||
{
|
||||
m_widgetEventHandlers->raiseActionEvent();
|
||||
redraw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraws the button.
|
||||
* Redraws the image.
|
||||
*
|
||||
* @param x The x coordinate of the mouse.
|
||||
* @param y The y coordinate of the mouse.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -96,12 +96,12 @@ namespace NxWM
|
||||
uint8_t m_flags; /**< Window flags */
|
||||
|
||||
/**
|
||||
* Handle a mouse button click event.
|
||||
* Handle a widget action event. For CImage, this is a mouse button pre-release event.
|
||||
*
|
||||
* @param e The event data.
|
||||
*/
|
||||
|
||||
void handleClickEvent(const NXWidgets::CWidgetEventArgs &e);
|
||||
void handleActionEvent(const NXWidgets::CWidgetEventArgs &e);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -110,12 +110,12 @@ namespace NxWM
|
||||
void stopAllApplications(void);
|
||||
|
||||
/**
|
||||
* Handle a mouse button click event.
|
||||
* Handle a widget action event. For CImage, this is a mouse button pre-release event.
|
||||
*
|
||||
* @param e The event data.
|
||||
*/
|
||||
|
||||
void handleClickEvent(const NXWidgets::CWidgetEventArgs &e);
|
||||
void handleActionEvent(const NXWidgets::CWidgetEventArgs &e);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -209,12 +209,12 @@ namespace NxWM
|
||||
void hideApplicationWindow(IApplication *app);
|
||||
|
||||
/**
|
||||
* Handle a mouse button click event.
|
||||
* Handle a widget action event. For CImage, this is a mouse button pre-release event.
|
||||
*
|
||||
* @param e The event data.
|
||||
*/
|
||||
|
||||
void handleClickEvent(const NXWidgets::CWidgetEventArgs &e);
|
||||
void handleActionEvent(const NXWidgets::CWidgetEventArgs &e);
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@@ -498,12 +498,12 @@ void CApplicationWindow::clickStopIcon(int index)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Handle a mouse button click event.
|
||||
* Handle a widget action event. For CImage, this is a mouse button pre-release event.
|
||||
*
|
||||
* @param e The event data.
|
||||
*/
|
||||
|
||||
void CApplicationWindow::handleClickEvent(const NXWidgets::CWidgetEventArgs &e)
|
||||
void CApplicationWindow::handleActionEvent(const NXWidgets::CWidgetEventArgs &e)
|
||||
{
|
||||
// Ignore the event if no callback is registered
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
/********************************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************************/
|
||||
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "cwidgetcontrol.hxx"
|
||||
@@ -443,14 +443,14 @@ void CStartWindow::stopAllApplications(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a mouse button click event.
|
||||
* Handle a widget action event. For CImage, this is a mouse button pre-release event.
|
||||
*
|
||||
* @param e The event data.
|
||||
*/
|
||||
|
||||
void CStartWindow::handleClickEvent(const NXWidgets::CWidgetEventArgs &e)
|
||||
void CStartWindow::handleActionEvent(const NXWidgets::CWidgetEventArgs &e)
|
||||
{
|
||||
// icon was clicked?
|
||||
// Was an ICON clicked?
|
||||
|
||||
for (int i = 0; i < m_slots.size(); i++)
|
||||
{
|
||||
|
||||
@@ -1277,14 +1277,14 @@ void CTaskbar::hideApplicationWindow(IApplication *app)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a mouse button click event.
|
||||
* Handle a widget action event. For CImage, this is a mouse button pre-release event.
|
||||
*
|
||||
* @param e The event data.
|
||||
*/
|
||||
|
||||
void CTaskbar::handleClickEvent(const NXWidgets::CWidgetEventArgs &e)
|
||||
void CTaskbar::handleActionEvent(const NXWidgets::CWidgetEventArgs &e)
|
||||
{
|
||||
// icon was clicked?
|
||||
// Was a n ICON clicked?
|
||||
|
||||
for (int i = 0; i < m_slots.size(); i++)
|
||||
{
|
||||
|
||||
+23
-2
@@ -1,4 +1,4 @@
|
||||
NuttX TODO List (Last updated April 12, 2012)
|
||||
NuttX TODO List (Last updated May 15, 2012)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
||||
@@ -17,7 +17,7 @@ nuttx/
|
||||
(3) USB (drivers/usbdev, drivers/usbhost)
|
||||
(8) Libraries (lib/)
|
||||
(10) File system/Generic drivers (fs/, drivers/)
|
||||
(1) Graphics subystem (graphics/)
|
||||
(4) Graphics subystem (graphics/)
|
||||
(1) Pascal add-on (pcode/)
|
||||
(1) Documentation (Documentation/)
|
||||
(7) Build system / Toolchains
|
||||
@@ -774,6 +774,27 @@ o Graphics subystem (graphics/)
|
||||
in the current structure.
|
||||
Priority: Low.
|
||||
|
||||
Title: RAW WINDOW AUTORAISE
|
||||
Description: Auto-raise only applies to NXTK windows. Shouldn't it also apply
|
||||
to raw windows as well?
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
Title: AUTO-RAISE DISABLED
|
||||
Descption: Auto-raise is currently disabled in NX multi-server mode. The
|
||||
reason is complex:
|
||||
- Most touchscreen controls send touch data a high rates
|
||||
- In multi-server mode, touch events get queued in a message
|
||||
queue.
|
||||
- The logic that receives the messages performs the auto-raise.
|
||||
But it can do stupid things after the first auto-raise as
|
||||
it opperates on the stale data in the message queue.
|
||||
I am thinking that auto-raise ought to be removed from NuttX
|
||||
and moved out into a graphics layer (like NxWM) that knows
|
||||
more about the appropriate context to do the autoraise.
|
||||
Status: Open
|
||||
Proiority: Medium low
|
||||
|
||||
o Pascal Add-On (pcode/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
Reference in New Issue
Block a user