diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-13 18:28:43 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-13 18:28:43 +0000 |
commit | 21115c210a35c6f320a43d67fdd662639534eb2e (patch) | |
tree | 1cd10fccd4799f0247de8c71d347610bb4a4dee4 /NxWidgets | |
parent | 1aa4a0750b0705fefbb1cd2819dbc30684d25353 (diff) | |
download | nuttx-21115c210a35c6f320a43d67fdd662639534eb2e.tar.gz nuttx-21115c210a35c6f320a43d67fdd662639534eb2e.tar.bz2 nuttx-21115c210a35c6f320a43d67fdd662639534eb2e.zip |
NXWidgets::CImage needs to catch mouse/touchscreen events; All touchscreen drivers need to report the last valid X/Y data when the screen is untouched.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4731 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets')
-rwxr-xr-x | NxWidgets/ChangeLog.txt | 5 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/include/cimage.hxx | 32 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cimage.cxx | 52 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/cstartwindow.hxx | 2 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/cstartwindow.cxx | 2 |
5 files changed, 87 insertions, 6 deletions
diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt index 8dd65d78b..0cb95cc13 100755 --- a/NxWidgets/ChangeLog.txt +++ b/NxWidgets/ChangeLog.txt @@ -66,3 +66,8 @@ never restart the Calibration window. * NxWM::CTaskbar: On a failure to start an application, the application icon CImage was being deleted twice. +* NXWidgets::CImage: Now handles mouse click callbacks. CImage is now really + a button. Probably should separate basic imaging functionality as CImage + and create a new CImageButton. +* NxWM::CStartWindow: Now ignores any close application button presses + (You can't close the start window).
\ No newline at end of file diff --git a/NxWidgets/libnxwidgets/include/cimage.hxx b/NxWidgets/libnxwidgets/include/cimage.hxx index a1c282393..0b7be14f2 100644 --- a/NxWidgets/libnxwidgets/include/cimage.hxx +++ b/NxWidgets/libnxwidgets/include/cimage.hxx @@ -134,6 +134,33 @@ namespace NXWidgets virtual void drawBorder(CGraphicsPort *port); /** + * Redraws the button. + * + * @param x The x coordinate of the click. + * @param y The y coordinate of the click. + */ + + virtual void onClick(nxgl_coord_t x, nxgl_coord_t y); + + /** + * Raises an action event and redraws the button. + * + * @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. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + + virtual void onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y); + + /** * Copy constructor is protected to prevent usage. */ @@ -199,10 +226,7 @@ namespace NXWidgets * @param highlightOn True(1), the image will be highlighted */ - inline void highlight(bool highlightOn) - { - m_highlighted = highlightOn; - } + void highlight(bool highlightOn); }; } diff --git a/NxWidgets/libnxwidgets/src/cimage.cxx b/NxWidgets/libnxwidgets/src/cimage.cxx index 0ca6f571e..7d9e0ee4e 100644 --- a/NxWidgets/libnxwidgets/src/cimage.cxx +++ b/NxWidgets/libnxwidgets/src/cimage.cxx @@ -358,6 +358,58 @@ void CImage::drawBorder(CGraphicsPort *port) } /** + * Control the highlight state. + * + * @param highlightOn True(1), the image will be highlighted + */ + +void CImage::highlight(bool highlightOn) +{ + if (m_highlighted != highlightOn) + { + m_highlighted = highlightOn; + redraw(); + } +} + +/** + * Redraws the button. + * + * @param x The x coordinate of the click. + * @param y The y coordinate of the click. + */ + +void CImage::onClick(nxgl_coord_t x, nxgl_coord_t y) +{ + redraw(); +} + +/** + * Raises an action event and redraws the button. + * + * @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) +{ + m_widgetEventHandlers->raiseActionEvent(); + redraw(); +} + +/** + * Redraws the button. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + +void CImage::onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y) +{ + redraw(); +} + +/** * Set the horizontal position of the bitmap. Zero is the left edge * of the bitmap and values >0 will move the bit map to the right. * This method is useful for horizontal scrolling a large bitmap diff --git a/NxWidgets/nxwm/include/cstartwindow.hxx b/NxWidgets/nxwm/include/cstartwindow.hxx index 5e4fa7564..a04a4f1a5 100644 --- a/NxWidgets/nxwm/include/cstartwindow.hxx +++ b/NxWidgets/nxwm/include/cstartwindow.hxx @@ -92,7 +92,7 @@ namespace NxWM void minimize(void); /** - * Called when the window minimize close is pressed. + * Called when the window close button is pressed. */ void close(void); diff --git a/NxWidgets/nxwm/src/cstartwindow.cxx b/NxWidgets/nxwm/src/cstartwindow.cxx index 8da71b2b5..f907f6718 100644 --- a/NxWidgets/nxwm/src/cstartwindow.cxx +++ b/NxWidgets/nxwm/src/cstartwindow.cxx @@ -356,7 +356,7 @@ void CStartWindow::minimize(void) void CStartWindow::close(void) { - m_taskbar->stopApplication(static_cast<IApplication*>(this)); + // Do nothing... you can't close the start window!!! } /** |