summaryrefslogtreecommitdiff
path: root/NxWidgets/nxwm/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-09 19:31:48 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-09 19:31:48 +0000
commitd97899b6e2c22b4f33f23a8333a03cd323bcd45e (patch)
tree3275cf363a5ddb67c70108c4712f8903fb0b958c /NxWidgets/nxwm/include
parent0f72f7085182b9038e0037c3b949458ac3306fdc (diff)
downloadnuttx-d97899b6e2c22b4f33f23a8333a03cd323bcd45e.tar.gz
nuttx-d97899b6e2c22b4f33f23a8333a03cd323bcd45e.tar.bz2
nuttx-d97899b6e2c22b4f33f23a8333a03cd323bcd45e.zip
NxWidgets: Remove modal loops, Add CWindowEventHandler*. NxWM: Add support for full screen applications
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4716 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/nxwm/include')
-rw-r--r--NxWidgets/nxwm/include/capplicationwindow.hxx95
-rw-r--r--NxWidgets/nxwm/include/cfullscreenwindow.hxx172
-rw-r--r--NxWidgets/nxwm/include/cnxconsole.hxx2
-rw-r--r--NxWidgets/nxwm/include/cstartwindow.hxx2
-rw-r--r--NxWidgets/nxwm/include/ctaskbar.hxx30
-rw-r--r--NxWidgets/nxwm/include/iapplication.hxx2
-rw-r--r--NxWidgets/nxwm/include/iapplicationwindow.hxx160
-rw-r--r--NxWidgets/nxwm/include/nxwmconfig.hxx1
8 files changed, 394 insertions, 70 deletions
diff --git a/NxWidgets/nxwm/include/capplicationwindow.hxx b/NxWidgets/nxwm/include/capplicationwindow.hxx
index 924389709..e8ce53740 100644
--- a/NxWidgets/nxwm/include/capplicationwindow.hxx
+++ b/NxWidgets/nxwm/include/capplicationwindow.hxx
@@ -49,6 +49,9 @@
#include "cimage.hxx"
#include "clabel.hxx"
#include "crlepalettebitmap.hxx"
+#include "cwindoweventhandler.hxx"
+
+#include "iapplicationwindow.hxx"
/****************************************************************************
* Pre-Processor Definitions
@@ -63,33 +66,14 @@
namespace NxWM
{
/**
- * This callback class is used by the application to get notification of toolbar
- * related events.
- */
-
- class IApplicationCallback
- {
- public:
- /**
- * Called when the window minimize button is pressed.
- */
-
- virtual void minimize(void) = 0;
-
- /**
- * Called when the window minimize close is pressed.
- */
-
- virtual void close(void) = 0;
- };
-
- /**
* This class represents that application window. This class contains that the
* framed window and its toolbar. It manages callbacks from the toolbar minimize
* and close buttions and passes these to the application via callbacks.
*/
- class CApplicationWindow : private NXWidgets::CWidgetEventHandler
+ class CApplicationWindow : public IApplicationWindow,
+ private NXWidgets::CWidgetEventHandler,
+ private NXWidgets::CWindowEventHandler
{
protected:
NXWidgets::CNxTkWindow *m_window; /**< The framed window used by the application */
@@ -103,6 +87,24 @@ namespace NxWM
IApplicationCallback *m_callback; /**< Toolbar action callbacks */
/**
+ * Handle an NX window mouse input event.
+ *
+ * @param e The event data.
+ */
+
+#ifdef CONFIG_NX_MOUSE
+ void handleMouseEvent(void);
+#endif
+
+ /**
+ * Handle a NX window keyboard input event.
+ */
+
+#ifdef CONFIG_NX_KBD
+ void handleKeyboardEvent(void);
+#endif
+
+ /**
* Handle a mouse button click event.
*
* @param e The event data.
@@ -154,10 +156,7 @@ namespace NxWM
* @return. The window used by this application
*/
- inline NXWidgets::CNxTkWindow *getWindow(void) const
- {
- return m_window;
- }
+ NXWidgets::INxWindow *getWindow(void) const;
/**
* Set the window label
@@ -165,40 +164,21 @@ namespace NxWM
* @param appname. The name of the application to place on the window
*/
- inline void setWindowLabel(NXWidgets::CNxString &appname)
- {
- m_windowLabel->setText(appname);
- }
+ void setWindowLabel(NXWidgets::CNxString &appname);
/**
* Register to receive callbacks when toolbar icons are selected
*/
- void registerCallbacks(IApplicationCallback *callback)
- {
- m_callback = callback;
- }
+ void registerCallbacks(IApplicationCallback *callback);
/**
* Simulate a mouse click on the minimize icon. This inline method is only
* used during automated testing of NxWM.
*/
-#ifdef CONFIG_NXWM_UNITTEST
- inline void clickMinimizeIcon(int index)
- {
- // Get the size and position of the widget
-
- struct nxgl_size_s imageSize;
- m_minimizeImage->getSize(imageSize);
-
- struct nxgl_point_s imagePos;
- m_minimizeImage->getPos(imagePos);
-
- // And click the image at its center
-
- m_minimizeImage->click(imagePos.x + (imageSize.w >> 1), imagePos.y + (imageSize.h >> 1));
- }
+#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
+ void clickMinimizeIcon(int index);
#endif
/**
@@ -206,21 +186,8 @@ namespace NxWM
* used during automated testing of NxWM.
*/
-#ifdef CONFIG_NXWM_UNITTEST
- inline void clickStopIcon(int index)
- {
- // Get the size and position of the widget
-
- struct nxgl_size_s imageSize;
- m_stopImage->getSize(imageSize);
-
- struct nxgl_point_s imagePos;
- m_stopImage->getPos(imagePos);
-
- // And click the image at its center
-
- m_stopImage->click(imagePos.x + (imageSize.w >> 1), imagePos.y + (imageSize.h >> 1));
- }
+#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
+ void clickStopIcon(int index);
#endif
};
}
diff --git a/NxWidgets/nxwm/include/cfullscreenwindow.hxx b/NxWidgets/nxwm/include/cfullscreenwindow.hxx
new file mode 100644
index 000000000..41425bf4c
--- /dev/null
+++ b/NxWidgets/nxwm/include/cfullscreenwindow.hxx
@@ -0,0 +1,172 @@
+/****************************************************************************
+ * NxWidgets/nxwm/include/cfullscreenwindow.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_CFULLSCREENWINDOW_NXX
+#define __INCLUDE_CFULLSCREENWINDOW_NXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "cnxwindow.hxx"
+
+#include "iapplicationwindow.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Implementation Classes
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NxWM
+{
+ /**
+ * This class represents a generic window. This bland window is used,
+ * for example, to support full screen displays.
+ */
+
+ class CFullScreenWindow : public IApplicationWindow,
+ private NXWidgets::CWindowEventHandler
+ {
+ protected:
+ NXWidgets::CNxWindow *m_window; /**< The generic window used by the application */
+
+ /**
+ * Handle an NX window mouse input event.
+ *
+ * @param e The event data.
+ */
+
+#ifdef CONFIG_NX_MOUSE
+ void handleMouseEvent(void);
+#endif
+
+ /**
+ * Handle a NX window keyboard input event.
+ */
+
+#ifdef CONFIG_NX_KBD
+ void handleKeyboardEvent(void);
+#endif
+
+ public:
+
+ /**
+ * CFullScreenWindow Constructor
+ *
+ * @param window. The raw window to be used by this full screen application.
+ */
+
+ CFullScreenWindow(NXWidgets::CNxWindow *window);
+
+ /**
+ * CFullScreenWindow Destructor
+ */
+
+ ~CFullScreenWindow(void);
+
+ /**
+ * Initialize window. Window initialization is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the window was successfully initialized.
+ */
+
+ bool open(void);
+
+ /**
+ * Re-draw the application window
+ */
+
+ void redraw(void);
+
+ /**
+ * The application window is hidden (either it is minimized or it is
+ * maximized, but not at the top of the hierarchy)
+ */
+
+ void hide(void);
+
+ /**
+ * Recover the contained NXTK window instance
+ *
+ * @return. The window used by this application
+ */
+
+ NXWidgets::INxWindow *getWindow(void) const;
+
+ /**
+ * Set the window label
+ *
+ * @param appname. The name of the application to place on the window
+ */
+
+ void setWindowLabel(NXWidgets::CNxString &appname);
+
+ /**
+ * Register to receive callbacks when toolbar icons are selected
+ */
+
+ void registerCallbacks(IApplicationCallback *callback);
+
+ /**
+ * Simulate a mouse click on the minimize icon. This inline method is only
+ * used during automated testing of NxWM.
+ */
+
+#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
+ void clickMinimizeIcon(int index);
+#endif
+
+ /**
+ * Simulate a mouse click on the stop applicaiton icon. This inline method is only
+ * used during automated testing of NxWM.
+ */
+
+#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
+ void clickStopIcon(int index);
+#endif
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_CFULLSCREENWINDOW_NXX
diff --git a/NxWidgets/nxwm/include/cnxconsole.hxx b/NxWidgets/nxwm/include/cnxconsole.hxx
index 7754276a7..7682e6620 100644
--- a/NxWidgets/nxwm/include/cnxconsole.hxx
+++ b/NxWidgets/nxwm/include/cnxconsole.hxx
@@ -125,7 +125,7 @@ namespace NxWM
* the contained CApplicationWindow instance.
*/
- CApplicationWindow *getWindow(void) const;
+ IApplicationWindow *getWindow(void) const;
/**
* Get the icon associated with the application
diff --git a/NxWidgets/nxwm/include/cstartwindow.hxx b/NxWidgets/nxwm/include/cstartwindow.hxx
index 924cc7d05..12f15566b 100644
--- a/NxWidgets/nxwm/include/cstartwindow.hxx
+++ b/NxWidgets/nxwm/include/cstartwindow.hxx
@@ -138,7 +138,7 @@ namespace NxWM
* the contained CApplicationWindow instance.
*/
- CApplicationWindow *getWindow(void) const;
+ IApplicationWindow *getWindow(void) const;
/**
* Get the icon associated with the application
diff --git a/NxWidgets/nxwm/include/ctaskbar.hxx b/NxWidgets/nxwm/include/ctaskbar.hxx
index 4e12fdb2c..7043ef3a1 100644
--- a/NxWidgets/nxwm/include/ctaskbar.hxx
+++ b/NxWidgets/nxwm/include/ctaskbar.hxx
@@ -49,6 +49,11 @@
#include "cwidgeteventhandler.hxx"
#include "cwidgeteventargs.hxx"
+#include "nxwmconfig.hxx"
+#include "nxwmglyphs.hxx"
+
+#include "capplicationwindow.hxx"
+#include "cfullscreenwindow.hxx"
#include "iapplication.hxx"
/****************************************************************************
@@ -130,9 +135,10 @@ namespace NxWM
* Set size and position of a window in the application area.
*
* @param window. The window to be resized and repositioned
+ * @param fullscreen. True: Use full screen
*/
- void setApplicationGeometry(NXWidgets::INxWindow *window);
+ void setApplicationGeometry(NXWidgets::INxWindow *window, bool fullscreen);
/**
* Create the task bar window.
@@ -281,8 +287,8 @@ namespace NxWM
bool startWindowManager(void);
/**
- * Create an application window. Creating a new application in the start
- * window requires three steps:
+ * Create an normal application window. Creating a normal application in the
+ * start window requires three steps:
*
* 1. Call CTaskBar::openApplicationWindow to create a window for the application,
* 2. Instantiate the application, providing the window to the application's
@@ -299,6 +305,24 @@ namespace NxWM
CApplicationWindow *openApplicationWindow(void);
/**
+ * Create a full screen application window. Creating a new full screen application
+ * requires three steps:
+ *
+ * 1. Call CTaskBar::FullScreenWindow to create a window for the application,
+ * 2. Instantiate the application, providing the window to the application's
+ * constructor,
+ * 3. Then call CStartWindow::addApplication to add the application to the
+ * start window.
+ *
+ * When the application is selected from the start window:
+ *
+ * 4. Call CTaskBar::startApplication start the application and bring its window to
+ * the top.
+ */
+
+ CFullScreenWindow *openFullScreenWindow(void);
+
+ /**
* Start an application and add its icon to the taskbar. The applications's
* window is brought to the top. Creating a new application in the start
* window requires three steps:
diff --git a/NxWidgets/nxwm/include/iapplication.hxx b/NxWidgets/nxwm/include/iapplication.hxx
index be9a96fe5..e92e1908e 100644
--- a/NxWidgets/nxwm/include/iapplication.hxx
+++ b/NxWidgets/nxwm/include/iapplication.hxx
@@ -78,7 +78,7 @@ namespace NxWM
* the contained CApplicationWindow instance.
*/
- virtual CApplicationWindow *getWindow(void) const = 0;
+ virtual IApplicationWindow *getWindow(void) const = 0;
/**
* Get the icon associated with the application
diff --git a/NxWidgets/nxwm/include/iapplicationwindow.hxx b/NxWidgets/nxwm/include/iapplicationwindow.hxx
new file mode 100644
index 000000000..115998775
--- /dev/null
+++ b/NxWidgets/nxwm/include/iapplicationwindow.hxx
@@ -0,0 +1,160 @@
+/****************************************************************************
+ * NxWidgets/nxwm/include/iapplicationwindow.hxx
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
+ * me be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_IAPPLICATIONWINDOW_NXX
+#define __INCLUDE_IAPPLICATIONWINDOW_NXX
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "cnxtkwindow.hxx"
+#include "cnxtoolbar.hxx"
+#include "cwidgeteventargs.hxx"
+#include "cwidgeteventhandler.hxx"
+#include "cimage.hxx"
+#include "clabel.hxx"
+#include "crlepalettebitmap.hxx"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Abstract Base Class
+ ****************************************************************************/
+
+#if defined(__cplusplus)
+
+namespace NxWM
+{
+ /**
+ * This callback class is used by the application to get notification of toolbar
+ * related events.
+ */
+
+ class IApplicationCallback
+ {
+ public:
+ /**
+ * Called when the window minimize button is pressed.
+ */
+
+ virtual void minimize(void) = 0;
+
+ /**
+ * Called when the window minimize close is pressed.
+ */
+
+ virtual void close(void) = 0;
+ };
+
+ /**
+ * This class represents the general application window. The actual window
+ * may be a contained, framed window or and unframed, fullscreen window.
+ */
+
+ class IApplicationWindow
+ {
+ public:
+ /**
+ * Initialize window. Window initialization is separate from
+ * object instantiation so that failures can be reported.
+ *
+ * @return True if the window was successfully initialized.
+ */
+
+ virtual bool open(void) = 0;
+
+ /**
+ * Re-draw the application window
+ */
+
+ virtual void redraw(void) = 0;
+
+ /**
+ * The application window is hidden (either it is minimized or it is
+ * maximized, but not at the top of the hierarchy)
+ */
+
+ virtual void hide(void) = 0;
+
+ /**
+ * Recover the contained window instance
+ *
+ * @return. The window used by this application
+ */
+
+ virtual NXWidgets::INxWindow *getWindow(void) const = 0;
+
+ /**
+ * Set the window label
+ *
+ * @param appname. The name of the application to place on the window
+ */
+
+ virtual void setWindowLabel(NXWidgets::CNxString &appname) = 0;
+
+ /**
+ * Register to receive callbacks when toolbar icons are selected
+ */
+
+ 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.
+ */
+
+#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
+ virtual void clickMinimizeIcon(int index) = 0;
+#endif
+
+ /**
+ * Simulate a mouse click on the stop applicaiton icon. This inline method is only
+ * used during automated testing of NxWM.
+ */
+
+#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
+ virtual void clickStopIcon(int index) = 0;
+#endif
+ };
+}
+
+#endif // __cplusplus
+
+#endif // __INCLUDE_IAPPLICATIONWINDOW_NXX
diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx
index 57566b2d4..15d0cdad7 100644
--- a/NxWidgets/nxwm/include/nxwmconfig.hxx
+++ b/NxWidgets/nxwm/include/nxwmconfig.hxx
@@ -61,6 +61,7 @@
*
* CONFIG_NXWM_DEFAULT_FONTID - the NxWM default font ID. Default:
* NXFONT_DEFAULT
+ * CONFIG_NXWM_TOUCHSCREEN - Define to build in touchscreen support.
*/
#ifndef CONFIG_HAVE_CXX