diff options
Diffstat (limited to 'NxWidgets/nxwm/include')
-rw-r--r-- | NxWidgets/nxwm/include/capplicationwindow.hxx | 30 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/ccalibration.hxx | 13 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/cfullscreenwindow.hxx | 30 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/cnxconsole.hxx | 21 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/cstartwindow.hxx | 56 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/ctaskbar.hxx | 37 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/cwindowmessenger.hxx (renamed from NxWidgets/nxwm/include/cwindowcontrol.hxx) | 27 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/iapplication.hxx | 29 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/iapplicationwindow.hxx | 41 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/nxwmconfig.hxx | 2 |
10 files changed, 164 insertions, 122 deletions
diff --git a/NxWidgets/nxwm/include/capplicationwindow.hxx b/NxWidgets/nxwm/include/capplicationwindow.hxx index f923f28b4..686150d14 100644 --- a/NxWidgets/nxwm/include/capplicationwindow.hxx +++ b/NxWidgets/nxwm/include/capplicationwindow.hxx @@ -44,6 +44,7 @@ #include "cnxtkwindow.hxx" #include "cnxtoolbar.hxx" +#include "cwidgetcontrol.hxx" #include "cwidgeteventargs.hxx" #include "cwidgeteventhandler.hxx" #include "cimage.hxx" @@ -151,12 +152,19 @@ namespace NxWM NXWidgets::INxWindow *getWindow(void) const; /** - * Recover the contained window control + * Recover the contained widget control * - * @return. The window control used by this application + * @return. The widget control used by this application */ - CWindowControl *getWindowControl(void) const ; + NXWidgets::CWidgetControl *getWidgetControl(void) const; + + /** + * Block further activity on this window in preparation for window + * shutdown. + */ + + void block(void); /** * Set the window label @@ -195,21 +203,25 @@ namespace NxWM } /** - * Simulate a mouse click on the minimize icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the minimize icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - void clickMinimizeIcon(int index); + void clickMinimizePosition(bool click); #endif /** - * Simulate a mouse click on the stop applicaiton icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the stop icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - void clickStopIcon(int index); + void clickStopIcon(bool click); #endif }; } diff --git a/NxWidgets/nxwm/include/ccalibration.hxx b/NxWidgets/nxwm/include/ccalibration.hxx index 55cef6d84..e9b5d400f 100644 --- a/NxWidgets/nxwm/include/ccalibration.hxx +++ b/NxWidgets/nxwm/include/ccalibration.hxx @@ -52,6 +52,7 @@ #include "ctaskbar.hxx" #include "iapplication.hxx" #include "cfullscreenwindow.hxx" +#include "cwindowmessenger.hxx" /**************************************************************************** * Pre-processor Definitions @@ -143,6 +144,7 @@ namespace NxWM * CCalibration state data */ + CWindowMessenger m_messenger; /**< Window event handler/messenger */ CTaskbar *m_taskbar; /**< The taskbar (used to terminate calibration) */ CFullScreenWindow *m_window; /**< The window for the calibration display */ CTouchscreen *m_touchscreen; /**< The touchscreen device */ @@ -290,6 +292,17 @@ namespace NxWM void stop(void); /** + * Destroy the application and free all of its resources. This method + * will initiate blocking of messages from the NX server. The server + * will flush the window message queue and reply with the blocked + * message. When the block message is received by CWindowMessenger, + * it will send the destroy message to the start window task which + * will, finally, safely delete the application. + */ + + void destroy(void); + + /** * The application window is hidden (either it is minimized or it is * maximized, but not at the top of the hierarchy */ diff --git a/NxWidgets/nxwm/include/cfullscreenwindow.hxx b/NxWidgets/nxwm/include/cfullscreenwindow.hxx index 2e3fbd45d..1bab37543 100644 --- a/NxWidgets/nxwm/include/cfullscreenwindow.hxx +++ b/NxWidgets/nxwm/include/cfullscreenwindow.hxx @@ -43,6 +43,7 @@ #include <nuttx/config.h> #include "cnxwindow.hxx" +#include "cwidgetcontrol.hxx" #include "iapplicationwindow.hxx" @@ -115,12 +116,19 @@ namespace NxWM NXWidgets::INxWindow *getWindow(void) const; /** - * Recover the contained window control + * Recover the contained widget control * - * @return. The window control used by this application + * @return. The widget control used by this application */ - CWindowControl *getWindowControl(void) const; + NXWidgets::CWidgetControl *getWidgetControl(void) const; + + /** + * Block further activity on this window in preparation for window + * shutdown. + */ + + void block(void); /** * Set the window label @@ -147,21 +155,25 @@ namespace NxWM void registerCallbacks(IApplicationCallback *callback); /** - * Simulate a mouse click on the minimize icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the minimize icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - void clickMinimizeIcon(int index); + void clickMinimizePosition(bool click); #endif /** - * Simulate a mouse click on the stop applicaiton icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the stop icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - void clickStopIcon(int index); + void clickStopIcon(bool click); #endif }; } diff --git a/NxWidgets/nxwm/include/cnxconsole.hxx b/NxWidgets/nxwm/include/cnxconsole.hxx index b95c86406..bf3606f05 100644 --- a/NxWidgets/nxwm/include/cnxconsole.hxx +++ b/NxWidgets/nxwm/include/cnxconsole.hxx @@ -49,6 +49,7 @@ #include "iapplication.hxx" #include "capplicationwindow.hxx" #include "ctaskbar.hxx" +#include "cwindowmessenger.hxx" /**************************************************************************** * Pre-Processor Definitions @@ -78,10 +79,11 @@ namespace NxWM class CNxConsole : public IApplication, private IApplicationCallback { private: - CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */ - CApplicationWindow *m_window; /**< Reference to the application window */ - NXCONSOLE m_nxcon; /**< NxConsole handle */ - pid_t m_pid; /**< Task ID of the NxConsole thread */ + CWindowMessenger m_messenger; /**< Window event handler/messenger */ + CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */ + CApplicationWindow *m_window; /**< Reference to the application window */ + NXCONSOLE m_nxcon; /**< NxConsole handle */ + pid_t m_pid; /**< Task ID of the NxConsole thread */ /** * This is the NxConsole task. This function first redirects output to the @@ -167,6 +169,17 @@ namespace NxWM void stop(void); /** + * Destroy the application and free all of its resources. This method + * will initiate blocking of messages from the NX server. The server + * will flush the window message queue and reply with the blocked + * message. When the block message is received by CWindowMessenger, + * it will send the destroy message to the start window task which + * will, finally, safely delete the application. + */ + + void destroy(void); + + /** * The application window is hidden (either it is minimized or it is * maximized, but not at the top of the hierarchy */ diff --git a/NxWidgets/nxwm/include/cstartwindow.hxx b/NxWidgets/nxwm/include/cstartwindow.hxx index 8b5fd92d3..3a5325cb7 100644 --- a/NxWidgets/nxwm/include/cstartwindow.hxx +++ b/NxWidgets/nxwm/include/cstartwindow.hxx @@ -48,6 +48,7 @@ #include "iapplication.hxx" #include "capplicationwindow.hxx" +#include "cwindowmessenger.hxx" /**************************************************************************** * Pre-Processor Definitions @@ -115,11 +116,12 @@ namespace NxWM * CStartWindow state data */ - CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */ - CApplicationWindow *m_window; /**< Reference to the application window */ - TNxArray<struct SStartWindowSlot> m_slots; /**< List of apps in the start window */ - struct nxgl_size_s m_iconSize; /**< A box big enough to hold the largest icon */ - pid_t m_taskId; /**< ID of the start window task */ + CWindowMessenger m_messenger; /**< Window event handler/messenger */ + CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */ + CApplicationWindow *m_window; /**< Reference to the application window */ + TNxArray<struct SStartWindowSlot> m_slots; /**< List of apps in the start window */ + struct nxgl_size_s m_iconSize; /**< A box big enough to hold the largest icon */ + pid_t m_taskId; /**< ID of the start window task */ /** * This is the start window task. This function receives window events from @@ -138,8 +140,8 @@ namespace NxWM * 4. NXWidgets::CWidgetControl records the new state data and raises a * window event. * 5. NXWidgets::CWindowEventHandlerList will give the event to - * NxWM::CWindowControl. - * 6. NxWM::CWindowControl will send the a message on a well-known message + * NxWM::CWindowMessenger. + * 6. NxWM::CWindowMessenger will send the a message on a well-known message * queue. * 7. This CStartWindow::startWindow task will receive and process that * message. @@ -236,6 +238,17 @@ namespace NxWM void stop(void); /** + * Destroy the application and free all of its resources. This method + * will initiate blocking of messages from the NX server. The server + * will flush the window message queue and reply with the blocked + * message. When the block message is received by CWindowMessenger, + * it will send the destroy message to the start window task which + * will, finally, safely delete the application. + */ + + void destroy(void); + + /** * The application window is hidden (either it is minimized or it is * maximized, but not at the top of the hierarchy) */ @@ -275,32 +288,15 @@ namespace NxWM bool addApplication(IApplicationFactory *app); /** - * Simulate a mouse click on the icon at index. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the icon at index. This method + * is only available during automated testing of NxWM. + * + * @param index. Selects the icon in the start window + * @param click. True to click and false to release */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - inline void clickIcon(int index) - { - if (index < m_slots.size()) - { - // Get the image widget at this index - - NXWidgets::CImage *image = m_slots.at(index).image; - - // Get the size and position of the widget - - struct nxgl_size_s imageSize; - image->getSize(imageSize); - - struct nxgl_point_s imagePos; - image->getPos(imagePos); - - // And click the image at its center - - image->click(imagePos.x + (imageSize.w >> 1), imagePos.y + (imageSize.h >> 1)); - } - } + void clickIcon(int index, bool click); #endif }; } diff --git a/NxWidgets/nxwm/include/ctaskbar.hxx b/NxWidgets/nxwm/include/ctaskbar.hxx index cf98d10d9..a78fb1739 100644 --- a/NxWidgets/nxwm/include/ctaskbar.hxx +++ b/NxWidgets/nxwm/include/ctaskbar.hxx @@ -110,12 +110,12 @@ namespace NxWM /** * Create a raw window. * - * 1) Create a dumb CWindowControl instance - * 2) Pass the dumb CWindowControl instance to the window constructor - * that inherits from INxWindow. This will "smarten" the CWindowControl + * 1) Create a dumb NXWidgets::CWidgetControl instance + * 2) Pass the dumb NXWidgets::CWidgetControl instance to the window constructor + * that inherits from INxWindow. This will "smarten" the NXWidgets::CWidgetControl * instance with some window knowlede * 3) Call the open() method on the window to display the window. - * 4) After that, the fully smartened CWindowControl instance can + * 4) After that, the fully smartened NXWidgets::CWidgetControl instance can * be used to generate additional widgets by passing it to the * widget constructor */ @@ -398,32 +398,15 @@ namespace NxWM void getDisplaySize(FAR struct nxgl_size_s &size); /** - * Simulate a mouse click on the icon at index. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the icon at index. This method + * is only available during automated testing of NxWM. + * + * @param index. Selects the icon in the start window + * @param click. True to click and false to release */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - inline void clickIcon(int index) - { - if (index < m_slots.size()) - { - // Get the image widget at this index - - NXWidgets::CImage *image = m_slots.at(index).image; - - // Get the size and position of the widget - - struct nxgl_size_s imageSize; - image->getSize(imageSize); - - struct nxgl_point_s imagePos; - image->getPos(imagePos); - - // And click the image at its center - - image->click(imagePos.x + (imageSize.w >> 1), imagePos.y + (imageSize.h >> 1)); - } - } + void clickIcon(int index, bool click); #endif }; } diff --git a/NxWidgets/nxwm/include/cwindowcontrol.hxx b/NxWidgets/nxwm/include/cwindowmessenger.hxx index 91e430c5c..645e750cb 100644 --- a/NxWidgets/nxwm/include/cwindowcontrol.hxx +++ b/NxWidgets/nxwm/include/cwindowmessenger.hxx @@ -1,5 +1,5 @@ /**************************************************************************** - * NxWidgets/nxwm/include/cwindowcontrol.hxx + * NxWidgets/nxwm/include/cwindowmessenger.hxx * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __INCLUDE_CWINDOWCONTROL_HXX -#define __INCLUDE_CWINDOWCONTROL_HXX +#ifndef __INCLUDE_CWINDOWMESSENGER_HXX +#define __INCLUDE_CWINDOWMESSENGER_HXX /**************************************************************************** * Included Files @@ -70,12 +70,11 @@ namespace NxWM class IApplication; /** - * The class CWindowControl integrates the widget control with some special + * The class CWindowMessenger integrates the widget control with some special * handling of mouse and keyboard inputs neesed by NxWM */ - class CWindowControl : public NXWidgets::CWidgetControl, - private NXWidgets::CWindowEventHandler + class CWindowMessenger : public NXWidgets::CWindowEventHandler { private: mqd_t m_mqd; /**< Message queue descriptor used to commincate with the @@ -102,24 +101,20 @@ namespace NxWM public: /** - * Constructor - * - * @param style The default style that all widgets on this display - * should use. If this is not specified, the widget will use the - * values stored in the defaultCWidgetStyle object. + * CWindowMessenger Constructor */ - CWindowControl(FAR const NXWidgets::CWidgetStyle *style = (const NXWidgets::CWidgetStyle *)NULL); + CWindowMessenger(void); /** - * Destructor. + * CWindowMessenger Destructor. */ - ~CWindowControl(void); + ~CWindowMessenger(void); /** * Destroy the application window and everything in it. This is - * handled by CWindowControl (vs just calling the destructors) because + * handled by CWindowMessenger (vs just calling the destructors) because * in the case where an application destroys itself (because of pressing * the stop button), then we need to unwind and get out of the application * logic before destroying all of its objects. @@ -130,4 +125,4 @@ namespace NxWM } #endif // __cplusplus -#endif // __INCLUDE_CWINDOWCONTROL_HXX +#endif // __INCLUDE_CWINDOWMESSENGER_HXX diff --git a/NxWidgets/nxwm/include/iapplication.hxx b/NxWidgets/nxwm/include/iapplication.hxx index 45067d900..28e50e013 100644 --- a/NxWidgets/nxwm/include/iapplication.hxx +++ b/NxWidgets/nxwm/include/iapplication.hxx @@ -45,8 +45,7 @@ #include "cnxstring.hxx" #include "ibitmap.hxx" -#include "cwindowcontrol.hxx" -#include "capplicationwindow.hxx" +#include "iapplicationwindow.hxx" /**************************************************************************** * Pre-Processor Definitions @@ -94,18 +93,6 @@ namespace NxWM virtual IApplicationWindow *getWindow(void) const = 0; /** - * Get the window widget control. - * - * @return The widget control of the underlying window instance. - */ - - virtual inline CWindowControl *getWindowControl(void) const - { - IApplicationWindow *window = getWindow(); - return window->getWindowControl(); - } - - /** * Get the icon associated with the application * * @return An instance if IBitmap that may be used to rend the @@ -132,12 +119,24 @@ namespace NxWM virtual bool run(void) = 0; /** - * Stop the application. + * Stop the application, put all widgets in a deactivated/disabled state + * and wait to see what happens next. */ virtual void stop(void) = 0; /** + * Destroy the application and free all of its resources. This method + * will initiate blocking of messages from the NX server. The server + * will flush the window message queue and reply with the blocked + * message. When the block message is received by CWindowMessenger, + * it will send the destroy message to the start window task which + * will, finally, safely delete the application. + */ + + virtual void destroy(void) = 0; + + /** * The application window is hidden (either it is minimized or it is * maximized, but not at the top of the hierarchy */ diff --git a/NxWidgets/nxwm/include/iapplicationwindow.hxx b/NxWidgets/nxwm/include/iapplicationwindow.hxx index fe8830c2f..ed221797d 100644 --- a/NxWidgets/nxwm/include/iapplicationwindow.hxx +++ b/NxWidgets/nxwm/include/iapplicationwindow.hxx @@ -44,8 +44,7 @@ #include "inxwindow.hxx" #include "cnxstring.hxx" - -#include "cwindowcontrol.hxx" +#include "cwidgetcontrol.hxx" /**************************************************************************** * Pre-Processor Definitions @@ -89,6 +88,15 @@ namespace NxWM { public: /** + * A virtual destructor is required in order to override the IApplicationWindow + * destructor. We do this because if we delete IApplicationWindow, we want the + * destructor of the class that inherits from IApplicationWindow to run, not this + * one. + */ + + virtual ~IApplicationWindow(void) { } + + /** * Initialize window. Window initialization is separate from * object instantiation so that failures can be reported. * @@ -119,12 +127,19 @@ namespace NxWM virtual NXWidgets::INxWindow *getWindow(void) const = 0; /** - * Recover the contained window control + * Recover the contained widget control * - * @return. The window control used by this application + * @return. The widget control used by this application */ - virtual CWindowControl *getWindowControl(void) const = 0; + virtual NXWidgets::CWidgetControl *getWidgetControl(void) const = 0; + + /** + * Block further activity on this window in preparation for window + * shutdown. + */ + + virtual void block(void) = 0; /** * Set the window label @@ -151,21 +166,25 @@ namespace NxWM virtual void registerCallbacks(IApplicationCallback *callback) = 0; /** - * Simulate a mouse click on the minimize icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the minimize icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - virtual void clickMinimizeIcon(int index) = 0; + virtual void clickMinimizePosition(bool click) = 0; #endif /** - * Simulate a mouse click on the stop applicaiton icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the stop icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - virtual void clickStopIcon(int index) = 0; + virtual void clickStopIcon(bool click) = 0; #endif }; } diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx index 3605f8c4f..25a8beb66 100644 --- a/NxWidgets/nxwm/include/nxwmconfig.hxx +++ b/NxWidgets/nxwm/include/nxwmconfig.hxx @@ -264,7 +264,7 @@ * CONFIG_NXWM_STARTWINDOW_HSPACING - Horizontal spacing. Default: 2 rows * CONFIG_NXWM_STARTWINDOW_ICON - The glyph to use as the start window icon * CONFIG_NXWM_STARTWINDOW_MQNAME - The well known name of the message queue - * Used to communicated from CWindowControl tothe start window thread. + * Used to communicated from CWindowMessenger to the start window thread. * Default: "/dev/nxwm" * CONFIG_NXWM_STARTWINDOW_MXMSGS - The maximum number of messages to queue * before blocking. Defualt 32 |