Final refactoring and implementation of delayed window deletion logic. Works worse now, but the changes are important and need to be checked in now
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4747 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
daa19c57c6
commit
ad63005d6a
@ -46,10 +46,13 @@
|
|||||||
|
|
||||||
#include "ctaskbar.hxx"
|
#include "ctaskbar.hxx"
|
||||||
#include "cstartwindow.hxx"
|
#include "cstartwindow.hxx"
|
||||||
#include "ctouchscreen.hxx"
|
|
||||||
#include "ccalibration.hxx"
|
|
||||||
#include "cnxconsole.hxx"
|
#include "cnxconsole.hxx"
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWM_TOUCHSCREEN
|
||||||
|
# include "ctouchscreen.hxx"
|
||||||
|
# include "ccalibration.hxx"
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Pre-processor Definitions
|
// Pre-processor Definitions
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -67,10 +70,19 @@
|
|||||||
#ifdef CONFIG_HAVE_FILENAME
|
#ifdef CONFIG_HAVE_FILENAME
|
||||||
# define showTestStepMemory(msg) \
|
# define showTestStepMemory(msg) \
|
||||||
_showTestStepMemory((FAR const char*)__FILE__, (int)__LINE__, msg)
|
_showTestStepMemory((FAR const char*)__FILE__, (int)__LINE__, msg)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_MEMMONITOR
|
||||||
|
# ifdef CONFIG_HAVE_FILENAME
|
||||||
# define showTestCaseMemory(msg) \
|
# define showTestCaseMemory(msg) \
|
||||||
_showTestCaseMemory((FAR const char*)__FILE__, (int)__LINE__, msg)
|
_showTestCaseMemory((FAR const char*)__FILE__, (int)__LINE__, msg)
|
||||||
# define showTestMemory(msg) \
|
# define showTestMemory(msg) \
|
||||||
_showTestMemory((FAR const char*)__FILE__, (int)__LINE__, msg)
|
_showTestMemory((FAR const char*)__FILE__, (int)__LINE__, msg)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define initMemoryUsage()
|
||||||
|
# define showTestCaseMemory(msg)
|
||||||
|
# define showTestMemory(msg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -85,9 +97,11 @@ struct SNxWmTest
|
|||||||
NxWM::CTouchscreen *touchscreen; // The touchscreen
|
NxWM::CTouchscreen *touchscreen; // The touchscreen
|
||||||
struct NxWM::SCalibrationData calibData; // Calibration data
|
struct NxWM::SCalibrationData calibData; // Calibration data
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_NXWIDGET_MEMMONITOR
|
||||||
unsigned int mmInitial; // Initial memory usage
|
unsigned int mmInitial; // Initial memory usage
|
||||||
unsigned int mmStep; // Memory Usage at beginning of test step
|
unsigned int mmStep; // Memory Usage at beginning of test step
|
||||||
unsigned int mmSubStep; // Memory Usage at beginning of test sub-step
|
unsigned int mmSubStep; // Memory Usage at beginning of test sub-step
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -112,6 +126,7 @@ extern "C" int MAIN_NAME(int argc, char *argv[]);
|
|||||||
// Name: updateMemoryUsage
|
// Name: updateMemoryUsage
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_MEMMONITOR
|
||||||
#ifdef CONFIG_HAVE_FILENAME
|
#ifdef CONFIG_HAVE_FILENAME
|
||||||
static void updateMemoryUsage(unsigned int *previous,
|
static void updateMemoryUsage(unsigned int *previous,
|
||||||
FAR const char *file, int line,
|
FAR const char *file, int line,
|
||||||
@ -145,11 +160,13 @@ static void updateMemoryUsage(unsigned int *previous,
|
|||||||
|
|
||||||
*previous = mmcurrent.uordblks;
|
*previous = mmcurrent.uordblks;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: showTestCaseMemory
|
// Name: showTestCaseMemory
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_MEMMONITOR
|
||||||
#ifdef CONFIG_HAVE_FILENAME
|
#ifdef CONFIG_HAVE_FILENAME
|
||||||
static void _showTestCaseMemory(FAR const char *file, int line, FAR const char *msg)
|
static void _showTestCaseMemory(FAR const char *file, int line, FAR const char *msg)
|
||||||
{
|
{
|
||||||
@ -163,11 +180,13 @@ static void showTestCaseMemory(FAR const char *msg)
|
|||||||
g_nxwmtest.mmSubStep = g_nxwmtest.mmInitial;
|
g_nxwmtest.mmSubStep = g_nxwmtest.mmInitial;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: showTestMemory
|
// Name: showTestMemory
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_MEMMONITOR
|
||||||
#ifdef CONFIG_HAVE_FILENAME
|
#ifdef CONFIG_HAVE_FILENAME
|
||||||
static void _showTestMemory(FAR const char *file, int line, FAR const char *msg)
|
static void _showTestMemory(FAR const char *file, int line, FAR const char *msg)
|
||||||
{
|
{
|
||||||
@ -179,11 +198,13 @@ static void showTestMemory(FAR const char *msg)
|
|||||||
updateMemoryUsage(&g_nxwmtest.mmInitial, msg);
|
updateMemoryUsage(&g_nxwmtest.mmInitial, msg);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: initMemoryUsage
|
// Name: initMemoryUsage
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_MEMMONITOR
|
||||||
static void initMemoryUsage(void)
|
static void initMemoryUsage(void)
|
||||||
{
|
{
|
||||||
struct mallinfo mmcurrent;
|
struct mallinfo mmcurrent;
|
||||||
@ -198,6 +219,7 @@ static void initMemoryUsage(void)
|
|||||||
g_nxwmtest.mmStep = mmcurrent.uordblks;
|
g_nxwmtest.mmStep = mmcurrent.uordblks;
|
||||||
g_nxwmtest.mmSubStep = mmcurrent.uordblks;
|
g_nxwmtest.mmSubStep = mmcurrent.uordblks;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: cleanup
|
// Name: cleanup
|
||||||
@ -361,7 +383,7 @@ static bool startWindowManager(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
showTestCaseMemory("AstartWindowManager: fter starting the window manager");
|
showTestCaseMemory("startWindowManager: After starting the window manager");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,12 +519,16 @@ static bool createNxConsole(void)
|
|||||||
#ifdef CONFIG_HAVE_FILENAME
|
#ifdef CONFIG_HAVE_FILENAME
|
||||||
void _showTestStepMemory(FAR const char *file, int line, FAR const char *msg)
|
void _showTestStepMemory(FAR const char *file, int line, FAR const char *msg)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NXWIDGET_MEMMONITOR
|
||||||
updateMemoryUsage(&g_nxwmtest.mmSubStep, file, line, msg);
|
updateMemoryUsage(&g_nxwmtest.mmSubStep, file, line, msg);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void showTestStepMemory(FAR const char *msg)
|
void showTestStepMemory(FAR const char *msg)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NXWIDGET_MEMMONITOR
|
||||||
updateMemoryUsage(&g_nxwmtest.mmSubStep, msg);
|
updateMemoryUsage(&g_nxwmtest.mmSubStep, msg);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -608,19 +634,23 @@ int MAIN_NAME(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Wait a little bit for the display to stabilize. The simulation pressing of
|
// Wait a little bit for the display to stabilize. Then simulate pressing of
|
||||||
// the 'start window' icon in the task bar
|
// the 'start window' icon in the task bar
|
||||||
|
|
||||||
#ifndef CONFIG_NXWM_TOUCHSCREEN
|
#ifndef CONFIG_NXWM_TOUCHSCREEN
|
||||||
sleep(2);
|
sleep(2);
|
||||||
g_nxwmtest.taskbar->clickIcon(0);
|
g_nxwmtest.taskbar->clickIcon(0, true);
|
||||||
|
usleep(500*1000);
|
||||||
|
g_nxwmtest.taskbar->clickIcon(0, false);
|
||||||
showTestCaseMemory(MAIN_STRING "After clicking the start window icon");
|
showTestCaseMemory(MAIN_STRING "After clicking the start window icon");
|
||||||
|
|
||||||
// Wait bit to see the result of the button press. The press the first icon
|
// Wait bit to see the result of the button press. Then press the first icon
|
||||||
// in the start menu. That should be the NxConsole icon.
|
// in the start menu. That should be the NxConsole icon.
|
||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
g_nxwmtest.startwindow->clickIcon(0);
|
g_nxwmtest.startwindow->clickIcon(0, true);
|
||||||
|
usleep(500*1000);
|
||||||
|
g_nxwmtest.startwindow->clickIcon(0, false);
|
||||||
showTestCaseMemory(MAIN_STRING "After clicking the NxConsole icon");
|
showTestCaseMemory(MAIN_STRING "After clicking the NxConsole icon");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -102,6 +102,15 @@ namespace NXWidgets
|
|||||||
class IBitmap
|
class IBitmap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A virtual destructor is required in order to override the IBitmap
|
||||||
|
* destructor. We do this because if we delete IBitmap, we want the
|
||||||
|
* destructor of the class that inherits from IBitmap to run, not this
|
||||||
|
* one.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual ~IBitmap(void) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bitmap's color format.
|
* Get the bitmap's color format.
|
||||||
*
|
*
|
||||||
|
@ -102,6 +102,14 @@ namespace NXWidgets
|
|||||||
class IListBox
|
class IListBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A virtual destructor is required in order to override the IListBox
|
||||||
|
* destructor. We do this because if we delete IListBox, we want the
|
||||||
|
* destructor of the class that inherits from IListBox to run, not this
|
||||||
|
* one.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual ~IListBox(void) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new option to the widget using default colors.
|
* Add a new option to the widget using default colors.
|
||||||
|
@ -103,6 +103,15 @@ namespace NXWidgets
|
|||||||
class IListDataEventHandler
|
class IListDataEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A virtual destructor is required in order to override the IListDataEventHandler
|
||||||
|
* destructor. We do this because if we delete IListDataEventHandler, we want the
|
||||||
|
* destructor of the class that inherits from IListDataEventHandler to run, not this
|
||||||
|
* one.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual ~IListDataEventHandler(void) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle data changes.
|
* Handle data changes.
|
||||||
*
|
*
|
||||||
|
@ -79,6 +79,14 @@ namespace NXWidgets
|
|||||||
class INxWindow
|
class INxWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A virtual destructor is required in order to override the INxWindow
|
||||||
|
* destructor. We do this because if we delete INxWindow, we want the
|
||||||
|
* destructor of the class that inherits from INxWindow to run, not this
|
||||||
|
* one.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual ~INxWindow(void) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new window. Window creation is separate from
|
* Creates a new window. Window creation is separate from
|
||||||
|
@ -102,6 +102,15 @@ namespace NXWidgets
|
|||||||
class IScrollable
|
class IScrollable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A virtual destructor is required in order to override the IScrollable
|
||||||
|
* destructor. We do this because if we delete IScrollable, we want the
|
||||||
|
* destructor of the class that inherits from IScrollable to run, not this
|
||||||
|
* one.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual ~IScrollable(void) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the x coordinate of the virtual canvas.
|
* Gets the x coordinate of the virtual canvas.
|
||||||
*
|
*
|
||||||
|
@ -99,6 +99,14 @@ namespace NXWidgets
|
|||||||
class ISlider
|
class ISlider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A virtual destructor is required in order to override the ISlider
|
||||||
|
* destructor. We do this because if we delete ISlider, we want the
|
||||||
|
* destructor of the class that inherits from ISlider to run, not this
|
||||||
|
* one.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual ~ISlider(void) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the smallest value that the slider can represent.
|
* Get the smallest value that the slider can represent.
|
||||||
|
@ -115,6 +115,14 @@ namespace NXWidgets
|
|||||||
class ITextBox
|
class ITextBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A virtual destructor is required in order to override the ITextBox
|
||||||
|
* destructor. We do this because if we delete ITextBox, we want the
|
||||||
|
* destructor of the class that inherits from ITextBox to run, not this
|
||||||
|
* one.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual ~ITextBox(void) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the cursor display mode.
|
* Sets the cursor display mode.
|
||||||
|
@ -41,10 +41,16 @@ NXWIDGETDIR := $(NXWMDIR)/../libnxwidgets
|
|||||||
|
|
||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS =
|
CSRCS =
|
||||||
|
|
||||||
|
|
||||||
# Window Manager
|
# Window Manager
|
||||||
CXXSRCS = capplicationwindow.cxx ccalibration.cxx cfullscreenwindow.cxx
|
CXXSRCS = capplicationwindow.cxx cfullscreenwindow.cxx cnxconsole.cxx
|
||||||
CXXSRCS += cnxconsole.cxx cstartwindow.cxx ctaskbar.cxx ctouchscreen.cxx
|
CXXSRCS += cstartwindow.cxx ctaskbar.cxx cwindowmessenger.cxx
|
||||||
CXXSRCS += cwindowcontrol.cxx
|
|
||||||
|
ifeq ($(CONFIG_NXWM_TOUCHSCREEN),y)
|
||||||
|
CXXSRCS += ccalibration.cxx ctouchscreen.cxx
|
||||||
|
endif
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
CXXSRCS += glyph_calibration.cxx glyph_cmd.cxx glyph_minimize.cxx glyph_nsh.cxx
|
CXXSRCS += glyph_calibration.cxx glyph_cmd.cxx glyph_minimize.cxx glyph_nsh.cxx
|
||||||
CXXSRCS += glyph_play.cxx glyph_start.cxx glyph_stop.cxx
|
CXXSRCS += glyph_play.cxx glyph_start.cxx glyph_stop.cxx
|
||||||
|
Binary file not shown.
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include "cnxtkwindow.hxx"
|
#include "cnxtkwindow.hxx"
|
||||||
#include "cnxtoolbar.hxx"
|
#include "cnxtoolbar.hxx"
|
||||||
|
#include "cwidgetcontrol.hxx"
|
||||||
#include "cwidgeteventargs.hxx"
|
#include "cwidgeteventargs.hxx"
|
||||||
#include "cwidgeteventhandler.hxx"
|
#include "cwidgeteventhandler.hxx"
|
||||||
#include "cimage.hxx"
|
#include "cimage.hxx"
|
||||||
@ -151,12 +152,19 @@ namespace NxWM
|
|||||||
NXWidgets::INxWindow *getWindow(void) const;
|
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
|
* Set the window label
|
||||||
@ -195,21 +203,25 @@ namespace NxWM
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the minimize icon. This inline method is only
|
* Simulate a mouse click or release on the minimize icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
void clickMinimizeIcon(int index);
|
void clickMinimizePosition(bool click);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the stop applicaiton icon. This inline method is only
|
* Simulate a mouse click or release on the stop icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
void clickStopIcon(int index);
|
void clickStopIcon(bool click);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include "ctaskbar.hxx"
|
#include "ctaskbar.hxx"
|
||||||
#include "iapplication.hxx"
|
#include "iapplication.hxx"
|
||||||
#include "cfullscreenwindow.hxx"
|
#include "cfullscreenwindow.hxx"
|
||||||
|
#include "cwindowmessenger.hxx"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@ -143,6 +144,7 @@ namespace NxWM
|
|||||||
* CCalibration state data
|
* CCalibration state data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
CWindowMessenger m_messenger; /**< Window event handler/messenger */
|
||||||
CTaskbar *m_taskbar; /**< The taskbar (used to terminate calibration) */
|
CTaskbar *m_taskbar; /**< The taskbar (used to terminate calibration) */
|
||||||
CFullScreenWindow *m_window; /**< The window for the calibration display */
|
CFullScreenWindow *m_window; /**< The window for the calibration display */
|
||||||
CTouchscreen *m_touchscreen; /**< The touchscreen device */
|
CTouchscreen *m_touchscreen; /**< The touchscreen device */
|
||||||
@ -289,6 +291,17 @@ namespace NxWM
|
|||||||
|
|
||||||
void stop(void);
|
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
|
* The application window is hidden (either it is minimized or it is
|
||||||
* maximized, but not at the top of the hierarchy
|
* maximized, but not at the top of the hierarchy
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include "cnxwindow.hxx"
|
#include "cnxwindow.hxx"
|
||||||
|
#include "cwidgetcontrol.hxx"
|
||||||
|
|
||||||
#include "iapplicationwindow.hxx"
|
#include "iapplicationwindow.hxx"
|
||||||
|
|
||||||
@ -115,12 +116,19 @@ namespace NxWM
|
|||||||
NXWidgets::INxWindow *getWindow(void) const;
|
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
|
* Set the window label
|
||||||
@ -147,21 +155,25 @@ namespace NxWM
|
|||||||
void registerCallbacks(IApplicationCallback *callback);
|
void registerCallbacks(IApplicationCallback *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the minimize icon. This inline method is only
|
* Simulate a mouse click or release on the minimize icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
void clickMinimizeIcon(int index);
|
void clickMinimizePosition(bool click);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the stop applicaiton icon. This inline method is only
|
* Simulate a mouse click or release on the stop icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
void clickStopIcon(int index);
|
void clickStopIcon(bool click);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include "iapplication.hxx"
|
#include "iapplication.hxx"
|
||||||
#include "capplicationwindow.hxx"
|
#include "capplicationwindow.hxx"
|
||||||
#include "ctaskbar.hxx"
|
#include "ctaskbar.hxx"
|
||||||
|
#include "cwindowmessenger.hxx"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
@ -78,6 +79,7 @@ namespace NxWM
|
|||||||
class CNxConsole : public IApplication, private IApplicationCallback
|
class CNxConsole : public IApplication, private IApplicationCallback
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
CWindowMessenger m_messenger; /**< Window event handler/messenger */
|
||||||
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
||||||
CApplicationWindow *m_window; /**< Reference to the application window */
|
CApplicationWindow *m_window; /**< Reference to the application window */
|
||||||
NXCONSOLE m_nxcon; /**< NxConsole handle */
|
NXCONSOLE m_nxcon; /**< NxConsole handle */
|
||||||
@ -166,6 +168,17 @@ namespace NxWM
|
|||||||
|
|
||||||
void stop(void);
|
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
|
* The application window is hidden (either it is minimized or it is
|
||||||
* maximized, but not at the top of the hierarchy
|
* maximized, but not at the top of the hierarchy
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
#include "iapplication.hxx"
|
#include "iapplication.hxx"
|
||||||
#include "capplicationwindow.hxx"
|
#include "capplicationwindow.hxx"
|
||||||
|
#include "cwindowmessenger.hxx"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
@ -115,6 +116,7 @@ namespace NxWM
|
|||||||
* CStartWindow state data
|
* CStartWindow state data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
CWindowMessenger m_messenger; /**< Window event handler/messenger */
|
||||||
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
||||||
CApplicationWindow *m_window; /**< Reference to the application window */
|
CApplicationWindow *m_window; /**< Reference to the application window */
|
||||||
TNxArray<struct SStartWindowSlot> m_slots; /**< List of apps in the start window */
|
TNxArray<struct SStartWindowSlot> m_slots; /**< List of apps in the start window */
|
||||||
@ -138,8 +140,8 @@ namespace NxWM
|
|||||||
* 4. NXWidgets::CWidgetControl records the new state data and raises a
|
* 4. NXWidgets::CWidgetControl records the new state data and raises a
|
||||||
* window event.
|
* window event.
|
||||||
* 5. NXWidgets::CWindowEventHandlerList will give the event to
|
* 5. NXWidgets::CWindowEventHandlerList will give the event to
|
||||||
* NxWM::CWindowControl.
|
* NxWM::CWindowMessenger.
|
||||||
* 6. NxWM::CWindowControl will send the a message on a well-known message
|
* 6. NxWM::CWindowMessenger will send the a message on a well-known message
|
||||||
* queue.
|
* queue.
|
||||||
* 7. This CStartWindow::startWindow task will receive and process that
|
* 7. This CStartWindow::startWindow task will receive and process that
|
||||||
* message.
|
* message.
|
||||||
@ -235,6 +237,17 @@ namespace NxWM
|
|||||||
|
|
||||||
void stop(void);
|
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
|
* The application window is hidden (either it is minimized or it is
|
||||||
* maximized, but not at the top of the hierarchy)
|
* maximized, but not at the top of the hierarchy)
|
||||||
@ -275,32 +288,15 @@ namespace NxWM
|
|||||||
bool addApplication(IApplicationFactory *app);
|
bool addApplication(IApplicationFactory *app);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the icon at index. This inline method is only
|
* Simulate a mouse click or release on the icon at index. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
inline void clickIcon(int index)
|
void clickIcon(int index, bool click);
|
||||||
{
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -110,12 +110,12 @@ namespace NxWM
|
|||||||
/**
|
/**
|
||||||
* Create a raw window.
|
* Create a raw window.
|
||||||
*
|
*
|
||||||
* 1) Create a dumb CWindowControl instance
|
* 1) Create a dumb NXWidgets::CWidgetControl instance
|
||||||
* 2) Pass the dumb CWindowControl instance to the window constructor
|
* 2) Pass the dumb NXWidgets::CWidgetControl instance to the window constructor
|
||||||
* that inherits from INxWindow. This will "smarten" the CWindowControl
|
* that inherits from INxWindow. This will "smarten" the NXWidgets::CWidgetControl
|
||||||
* instance with some window knowlede
|
* instance with some window knowlede
|
||||||
* 3) Call the open() method on the window to display the window.
|
* 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
|
* be used to generate additional widgets by passing it to the
|
||||||
* widget constructor
|
* widget constructor
|
||||||
*/
|
*/
|
||||||
@ -398,32 +398,15 @@ namespace NxWM
|
|||||||
void getDisplaySize(FAR struct nxgl_size_s &size);
|
void getDisplaySize(FAR struct nxgl_size_s &size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the icon at index. This inline method is only
|
* Simulate a mouse click or release on the icon at index. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
inline void clickIcon(int index)
|
void clickIcon(int index, bool click);
|
||||||
{
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* NxWidgets/nxwm/include/cwindowcontrol.hxx
|
* NxWidgets/nxwm/include/cwindowmessenger.hxx
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -33,8 +33,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __INCLUDE_CWINDOWCONTROL_HXX
|
#ifndef __INCLUDE_CWINDOWMESSENGER_HXX
|
||||||
#define __INCLUDE_CWINDOWCONTROL_HXX
|
#define __INCLUDE_CWINDOWMESSENGER_HXX
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
@ -70,12 +70,11 @@ namespace NxWM
|
|||||||
class IApplication;
|
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
|
* handling of mouse and keyboard inputs neesed by NxWM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CWindowControl : public NXWidgets::CWidgetControl,
|
class CWindowMessenger : public NXWidgets::CWindowEventHandler
|
||||||
private NXWidgets::CWindowEventHandler
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
mqd_t m_mqd; /**< Message queue descriptor used to commincate with the
|
mqd_t m_mqd; /**< Message queue descriptor used to commincate with the
|
||||||
@ -102,24 +101,20 @@ namespace NxWM
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* CWindowMessenger 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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
|
* 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
|
* 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
|
* the stop button), then we need to unwind and get out of the application
|
||||||
* logic before destroying all of its objects.
|
* logic before destroying all of its objects.
|
||||||
@ -130,4 +125,4 @@ namespace NxWM
|
|||||||
}
|
}
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // __INCLUDE_CWINDOWCONTROL_HXX
|
#endif // __INCLUDE_CWINDOWMESSENGER_HXX
|
@ -45,8 +45,7 @@
|
|||||||
#include "cnxstring.hxx"
|
#include "cnxstring.hxx"
|
||||||
#include "ibitmap.hxx"
|
#include "ibitmap.hxx"
|
||||||
|
|
||||||
#include "cwindowcontrol.hxx"
|
#include "iapplicationwindow.hxx"
|
||||||
#include "capplicationwindow.hxx"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
@ -93,18 +92,6 @@ namespace NxWM
|
|||||||
|
|
||||||
virtual IApplicationWindow *getWindow(void) const = 0;
|
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
|
* Get the icon associated with the application
|
||||||
*
|
*
|
||||||
@ -132,11 +119,23 @@ namespace NxWM
|
|||||||
virtual bool run(void) = 0;
|
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;
|
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
|
* The application window is hidden (either it is minimized or it is
|
||||||
* maximized, but not at the top of the hierarchy
|
* maximized, but not at the top of the hierarchy
|
||||||
|
@ -44,8 +44,7 @@
|
|||||||
|
|
||||||
#include "inxwindow.hxx"
|
#include "inxwindow.hxx"
|
||||||
#include "cnxstring.hxx"
|
#include "cnxstring.hxx"
|
||||||
|
#include "cwidgetcontrol.hxx"
|
||||||
#include "cwindowcontrol.hxx"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
@ -88,6 +87,15 @@ namespace NxWM
|
|||||||
class IApplicationWindow
|
class IApplicationWindow
|
||||||
{
|
{
|
||||||
public:
|
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
|
* Initialize window. Window initialization is separate from
|
||||||
* object instantiation so that failures can be reported.
|
* object instantiation so that failures can be reported.
|
||||||
@ -119,12 +127,19 @@ namespace NxWM
|
|||||||
virtual NXWidgets::INxWindow *getWindow(void) const = 0;
|
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
|
* Set the window label
|
||||||
@ -151,21 +166,25 @@ namespace NxWM
|
|||||||
virtual void registerCallbacks(IApplicationCallback *callback) = 0;
|
virtual void registerCallbacks(IApplicationCallback *callback) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the minimize icon. This inline method is only
|
* Simulate a mouse click or release on the minimize icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
virtual void clickMinimizeIcon(int index) = 0;
|
virtual void clickMinimizePosition(bool click) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the stop applicaiton icon. This inline method is only
|
* Simulate a mouse click or release on the stop icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
virtual void clickStopIcon(int index) = 0;
|
virtual void clickStopIcon(bool click) = 0;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@
|
|||||||
* CONFIG_NXWM_STARTWINDOW_HSPACING - Horizontal spacing. Default: 2 rows
|
* 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_ICON - The glyph to use as the start window icon
|
||||||
* CONFIG_NXWM_STARTWINDOW_MQNAME - The well known name of the message queue
|
* 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"
|
* Default: "/dev/nxwm"
|
||||||
* CONFIG_NXWM_STARTWINDOW_MXMSGS - The maximum number of messages to queue
|
* CONFIG_NXWM_STARTWINDOW_MXMSGS - The maximum number of messages to queue
|
||||||
* before blocking. Defualt 32
|
* before blocking. Defualt 32
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
|
|
||||||
#include "nxwmconfig.hxx"
|
#include "nxwmconfig.hxx"
|
||||||
#include "nxwmglyphs.hxx"
|
#include "nxwmglyphs.hxx"
|
||||||
#include "cwindowcontrol.hxx"
|
|
||||||
#include "capplicationwindow.hxx"
|
#include "capplicationwindow.hxx"
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
@ -153,9 +152,9 @@ CApplicationWindow::~CApplicationWindow(void)
|
|||||||
|
|
||||||
bool CApplicationWindow::open(void)
|
bool CApplicationWindow::open(void)
|
||||||
{
|
{
|
||||||
// Create one of our special window controls for the tool bar
|
// Create a widget control for the tool bar
|
||||||
|
|
||||||
CWindowControl *control = new CWindowControl();
|
NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl();
|
||||||
if (!control)
|
if (!control)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -414,15 +413,31 @@ NXWidgets::INxWindow *CApplicationWindow::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 *CApplicationWindow::getWindowControl(void) const
|
NXWidgets::CWidgetControl *CApplicationWindow::getWidgetControl(void) const
|
||||||
{
|
{
|
||||||
|
return m_window->getWidgetControl();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block further activity on this window in preparation for window
|
||||||
|
* shutdown.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void CApplicationWindow::block(void)
|
||||||
|
{
|
||||||
|
// Get the widget control from the NXWidgets::CNxWindow instance
|
||||||
|
|
||||||
NXWidgets::CWidgetControl *control = m_window->getWidgetControl();
|
NXWidgets::CWidgetControl *control = m_window->getWidgetControl();
|
||||||
return static_cast<CWindowControl*>(control);
|
|
||||||
|
// And then block further reporting activity on the underlying
|
||||||
|
// NX framed window
|
||||||
|
|
||||||
|
nxtk_block(control->getWindowHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -459,12 +474,14 @@ void CApplicationWindow::registerCallbacks(IApplicationCallback *callback)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the minimize icon. This method is only
|
* Simulate a mouse click or release on the minimize icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
void CApplicationWindow::clickMinimizeIcon(int index)
|
void CApplicationWindow::clickMinimizePosition(bool click)
|
||||||
{
|
{
|
||||||
// Get the size and position of the widget
|
// Get the size and position of the widget
|
||||||
|
|
||||||
@ -474,20 +491,30 @@ void CApplicationWindow::clickMinimizeIcon(int index)
|
|||||||
struct nxgl_point_s imagePos;
|
struct nxgl_point_s imagePos;
|
||||||
m_minimizeImage->getPos(imagePos);
|
m_minimizeImage->getPos(imagePos);
|
||||||
|
|
||||||
// And click the image at its center
|
// And click or release the image at its center
|
||||||
|
|
||||||
|
if (click)
|
||||||
|
{
|
||||||
m_minimizeImage->click(imagePos.x + (imageSize.w >> 1),
|
m_minimizeImage->click(imagePos.x + (imageSize.w >> 1),
|
||||||
imagePos.y + (imageSize.h >> 1));
|
imagePos.y + (imageSize.h >> 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_minimizeImage->release(imagePos.x + (imageSize.w >> 1),
|
||||||
|
imagePos.y + (imageSize.h >> 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the stop applicaiton icon. This method is only
|
* Simulate a mouse click or release on the stop icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
void CApplicationWindow::clickStopIcon(int index)
|
void CApplicationWindow::clickStopIcon(bool click)
|
||||||
{
|
{
|
||||||
// The stop icon will not be available for "persistent" applications
|
// The stop icon will not be available for "persistent" applications
|
||||||
|
|
||||||
@ -501,11 +528,19 @@ void CApplicationWindow::clickStopIcon(int index)
|
|||||||
struct nxgl_point_s imagePos;
|
struct nxgl_point_s imagePos;
|
||||||
m_stopImage->getPos(imagePos);
|
m_stopImage->getPos(imagePos);
|
||||||
|
|
||||||
// And click the image at its center
|
// And click or release the image at its center
|
||||||
|
|
||||||
|
if (click)
|
||||||
|
{
|
||||||
m_stopImage->click(imagePos.x + (imageSize.w >> 1),
|
m_stopImage->click(imagePos.x + (imageSize.w >> 1),
|
||||||
imagePos.y + (imageSize.h >> 1));
|
imagePos.y + (imageSize.h >> 1));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_stopImage->release(imagePos.x + (imageSize.w >> 1),
|
||||||
|
imagePos.y + (imageSize.h >> 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -99,6 +99,11 @@ CCalibration::CCalibration(CTaskbar *taskbar, CFullScreenWindow *window,
|
|||||||
m_calthread = CALTHREAD_NOTRUNNING;
|
m_calthread = CALTHREAD_NOTRUNNING;
|
||||||
m_calphase = CALPHASE_NOT_STARTED;
|
m_calphase = CALPHASE_NOT_STARTED;
|
||||||
m_touched = false;
|
m_touched = false;
|
||||||
|
|
||||||
|
// Add our messenger as the window callback
|
||||||
|
|
||||||
|
NXWidgets::CWidgetControl *control = window->getWidgetControl();
|
||||||
|
control->addWindowEventHandler(&m_messenger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,6 +117,11 @@ CCalibration::~CCalibration(void)
|
|||||||
|
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
|
// Remove ourself from the window callback
|
||||||
|
|
||||||
|
NXWidgets::CWidgetControl *control = m_window->getWidgetControl();
|
||||||
|
control->removeWindowEventHandler(&m_messenger);
|
||||||
|
|
||||||
// Although we did not create the window, the rule is that I have to dispose
|
// Although we did not create the window, the rule is that I have to dispose
|
||||||
// of it
|
// of it
|
||||||
|
|
||||||
@ -199,6 +209,26 @@ void CCalibration::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 CCalibration::destroy(void)
|
||||||
|
{
|
||||||
|
// Block any further window messages
|
||||||
|
|
||||||
|
m_window->block();
|
||||||
|
|
||||||
|
// Make sure that the application is stopped
|
||||||
|
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The application window is hidden (either it is minimized or it is
|
* The application window is hidden (either it is minimized or it is
|
||||||
* maximized, but it is not at the top of the hierarchy)
|
* maximized, but it is not at the top of the hierarchy)
|
||||||
|
@ -128,15 +128,31 @@ NXWidgets::INxWindow *CFullScreenWindow::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 *CFullScreenWindow::getWindowControl(void) const
|
NXWidgets::CWidgetControl *CFullScreenWindow::getWidgetControl(void) const
|
||||||
{
|
{
|
||||||
|
return m_window->getWidgetControl();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block further activity on this window in preparation for window
|
||||||
|
* shutdown.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void CFullScreenWindow::block(void)
|
||||||
|
{
|
||||||
|
// Get the widget control from the NXWidgets::CNxWindow instance
|
||||||
|
|
||||||
NXWidgets::CWidgetControl *control = m_window->getWidgetControl();
|
NXWidgets::CWidgetControl *control = m_window->getWidgetControl();
|
||||||
return static_cast<CWindowControl*>(control);
|
|
||||||
|
// And then block further reporting activity on the underlying
|
||||||
|
// NX raw window
|
||||||
|
|
||||||
|
nx_block(control->getWindowHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,23 +187,27 @@ void CFullScreenWindow::registerCallbacks(IApplicationCallback *callback)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the minimize icon. This method is only
|
* Simulate a mouse click or release on the minimize icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
void CFullScreenWindow::clickMinimizeIcon(int index)
|
void CFullScreenWindow::clickMinimizePosition(bool click)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a mouse click on the stop applicaiton icon. This method is only
|
* Simulate a mouse click or release on the stop icon. This method
|
||||||
* used during automated testing of NxWM.
|
* 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)
|
#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
|
||||||
void CFullScreenWindow::clickStopIcon(int index)
|
void CFullScreenWindow::clickStopIcon(bool click)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,9 +129,14 @@ CNxConsole::CNxConsole(CTaskbar *taskbar, CApplicationWindow *window)
|
|||||||
NXWidgets::CNxString myName = getName();
|
NXWidgets::CNxString myName = getName();
|
||||||
window->setWindowLabel(myName);
|
window->setWindowLabel(myName);
|
||||||
|
|
||||||
// Add our callbacks to the application window
|
// Add our callbacks with the application window
|
||||||
|
|
||||||
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
||||||
|
|
||||||
|
// Add our messenger as the window callback
|
||||||
|
|
||||||
|
NXWidgets::CWidgetControl *control = window->getWidgetControl();
|
||||||
|
control->addWindowEventHandler(&m_messenger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,13 +152,15 @@ CNxConsole::~CNxConsole(void)
|
|||||||
|
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
|
// Remove ourself from the window callback
|
||||||
|
|
||||||
|
NXWidgets::CWidgetControl *control = m_window->getWidgetControl();
|
||||||
|
control->removeWindowEventHandler(&m_messenger);
|
||||||
|
|
||||||
// Although we didn't create it, we are responsible for deleting the
|
// Although we didn't create it, we are responsible for deleting the
|
||||||
// application window
|
// application window
|
||||||
|
|
||||||
if (m_window)
|
|
||||||
{
|
|
||||||
delete m_window;
|
delete m_window;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -321,6 +328,26 @@ void CNxConsole::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 CNxConsole::destroy(void)
|
||||||
|
{
|
||||||
|
// Block any further window messages
|
||||||
|
|
||||||
|
m_window->block();
|
||||||
|
|
||||||
|
// Make sure that the application is stopped
|
||||||
|
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The application window is hidden (either it is minimized or it is
|
* The application window is hidden (either it is minimized or it is
|
||||||
* maximized, but not at the top of the hierarchy
|
* maximized, but not at the top of the hierarchy
|
||||||
|
@ -99,6 +99,11 @@ CStartWindow::CStartWindow(CTaskbar *taskbar, CApplicationWindow *window)
|
|||||||
// Add our callbacks to the application window
|
// Add our callbacks to the application window
|
||||||
|
|
||||||
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
||||||
|
|
||||||
|
// Add our messenger as the window callback
|
||||||
|
|
||||||
|
NXWidgets::CWidgetControl *control = window->getWidgetControl();
|
||||||
|
control->addWindowEventHandler(&m_messenger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,13 +117,15 @@ CStartWindow::~CStartWindow(void)
|
|||||||
|
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
|
// Remove ourself from the window callback
|
||||||
|
|
||||||
|
NXWidgets::CWidgetControl *control = m_window->getWidgetControl();
|
||||||
|
control->removeWindowEventHandler(&m_messenger);
|
||||||
|
|
||||||
// Although we didn't create it, we are responsible for deleting the
|
// Although we didn't create it, we are responsible for deleting the
|
||||||
// application window
|
// application window
|
||||||
|
|
||||||
if (m_window)
|
|
||||||
{
|
|
||||||
delete m_window;
|
delete m_window;
|
||||||
}
|
|
||||||
|
|
||||||
// Then stop and delete all applications
|
// Then stop and delete all applications
|
||||||
|
|
||||||
@ -211,6 +218,28 @@ void CStartWindow::stop(void)
|
|||||||
task_delete(pid);
|
task_delete(pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 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 CStartWindow::destroy(void)
|
||||||
|
{
|
||||||
|
// What are we doing? This should never happen because the start
|
||||||
|
// window task is persistent!
|
||||||
|
|
||||||
|
// Block any further window messages
|
||||||
|
|
||||||
|
m_window->block();
|
||||||
|
|
||||||
|
// Make sure that the application is stopped
|
||||||
|
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The application window is hidden (either it is minimized or it is
|
* The application window is hidden (either it is minimized or it is
|
||||||
@ -404,6 +433,47 @@ bool CStartWindow::addApplication(IApplicationFactory *app)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
void CStartWindow::clickIcon(int index, bool click)
|
||||||
|
{
|
||||||
|
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 or release the image at its center
|
||||||
|
|
||||||
|
if (click)
|
||||||
|
{
|
||||||
|
image->click(imagePos.x + (imageSize.w >> 1),
|
||||||
|
imagePos.y + (imageSize.h >> 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image->release(imagePos.x + (imageSize.w >> 1),
|
||||||
|
imagePos.y + (imageSize.h >> 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the window minimize button is pressed.
|
* Called when the window minimize button is pressed.
|
||||||
*/
|
*/
|
||||||
@ -523,11 +593,11 @@ void CStartWindow::handleActionEvent(const NXWidgets::CWidgetEventArgs &e)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If we cannot start the app. Destroy the
|
// If we cannot start the app. Destroy the instance we
|
||||||
// instance we created and see what happens next.
|
// created and see what happens next. Could be interesting.
|
||||||
|
|
||||||
CWindowControl *control = app->getWindowControl();
|
app->stop();
|
||||||
control->destroy(app);
|
app->destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,8 +618,8 @@ void CStartWindow::handleActionEvent(const NXWidgets::CWidgetEventArgs &e)
|
|||||||
* 4. NXWidgets::CWidgetControl records the new state data and raises a
|
* 4. NXWidgets::CWidgetControl records the new state data and raises a
|
||||||
* window event.
|
* window event.
|
||||||
* 5. NXWidgets::CWindowEventHandlerList will give the event to
|
* 5. NXWidgets::CWindowEventHandlerList will give the event to
|
||||||
* NxWM::CWindowControl.
|
* NxWM::CWindowMessenger.
|
||||||
* 6. NxWM::CWindowControl will send the a message on a well-known message
|
* 6. NxWM::CWindowMessenger will send the a message on a well-known message
|
||||||
* queue.
|
* queue.
|
||||||
* 7. This CStartWindow::startWindow task will receive and process that
|
* 7. This CStartWindow::startWindow task will receive and process that
|
||||||
* message.
|
* message.
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include "cwidgetcontrol.hxx"
|
#include "cwidgetcontrol.hxx"
|
||||||
#include "cnxtkwindow.hxx"
|
#include "cnxtkwindow.hxx"
|
||||||
|
|
||||||
#include "cwindowcontrol.hxx"
|
|
||||||
#include "ctaskbar.hxx"
|
#include "ctaskbar.hxx"
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
@ -81,6 +80,9 @@ CTaskbar::CTaskbar(void)
|
|||||||
|
|
||||||
CTaskbar::~CTaskbar(void)
|
CTaskbar::~CTaskbar(void)
|
||||||
{
|
{
|
||||||
|
// The disconnect,putting the instance back in the state that it
|
||||||
|
// was before it was constructed.
|
||||||
|
|
||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +109,8 @@ bool CTaskbar::connect(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnect from the server
|
* Disconnect from the server. This method restores the taskbar to the
|
||||||
|
* same state that it was in when it was constructed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CTaskbar::disconnect(void)
|
void CTaskbar::disconnect(void)
|
||||||
@ -141,6 +144,7 @@ void CTaskbar::disconnect(void)
|
|||||||
// Then delete the task bar window
|
// Then delete the task bar window
|
||||||
|
|
||||||
delete m_taskbar;
|
delete m_taskbar;
|
||||||
|
m_taskbar = (NXWidgets::CNxWindow *)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_background)
|
if (m_background)
|
||||||
@ -157,8 +161,22 @@ void CTaskbar::disconnect(void)
|
|||||||
// Then delete the background
|
// Then delete the background
|
||||||
|
|
||||||
delete m_background;
|
delete m_background;
|
||||||
|
m_background = (NXWidgets::CNxWindow *)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete the background image
|
||||||
|
|
||||||
|
if (m_backImage)
|
||||||
|
{
|
||||||
|
delete m_backImage;
|
||||||
|
m_backImage = (NXWidgets::CImage *)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset other variables
|
||||||
|
|
||||||
|
m_topApp = (IApplication *)0;
|
||||||
|
m_started = false;
|
||||||
|
|
||||||
// And disconnect from the server
|
// And disconnect from the server
|
||||||
|
|
||||||
CNxServer::disconnect();
|
CNxServer::disconnect();
|
||||||
@ -279,7 +297,9 @@ bool CTaskbar::startWindowManager(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide all appliations except for the top application
|
// Hide all applications except for the top application. NOTE:
|
||||||
|
// topIndex may still be -1, meaning that there is no application
|
||||||
|
// and that all applications should be hidden.
|
||||||
|
|
||||||
if (i != topIndex)
|
if (i != topIndex)
|
||||||
{
|
{
|
||||||
@ -303,6 +323,17 @@ bool CTaskbar::startWindowManager(void)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is no top appliation (i.e., no applications or all applications
|
||||||
|
// are minimized), then draw the background image
|
||||||
|
|
||||||
|
if (!m_topApp)
|
||||||
|
{
|
||||||
|
if (!redrawBackgroundWindow())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Draw the taskbar. It will be draw at a higher level than the application.
|
// Draw the taskbar. It will be draw at a higher level than the application.
|
||||||
|
|
||||||
return redrawTaskbarWindow();
|
return redrawTaskbarWindow();
|
||||||
@ -633,10 +664,10 @@ bool CTaskbar::stopApplication(IApplication *app)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy the application
|
// Destroy the application (actually, this just sets up the application for
|
||||||
|
// later destruction.
|
||||||
|
|
||||||
CWindowControl *control = app->getWindowControl();
|
app->destroy();
|
||||||
control->destroy(app);
|
|
||||||
|
|
||||||
// Re-draw the new top, non-minimized application
|
// Re-draw the new top, non-minimized application
|
||||||
|
|
||||||
@ -673,6 +704,47 @@ void CTaskbar::getDisplaySize(FAR struct nxgl_size_s &size)
|
|||||||
rect.getSize(size);
|
rect.getSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
void CTaskbar::clickIcon(int index, bool click)
|
||||||
|
{
|
||||||
|
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 or release the image at its center
|
||||||
|
|
||||||
|
if (click)
|
||||||
|
{
|
||||||
|
image->click(imagePos.x + (imageSize.w >> 1),
|
||||||
|
imagePos.y + (imageSize.h >> 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image->release(imagePos.x + (imageSize.w >> 1),
|
||||||
|
imagePos.y + (imageSize.h >> 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a raw window.
|
* Create a raw window.
|
||||||
*
|
*
|
||||||
@ -690,7 +762,7 @@ NXWidgets::CNxWindow *CTaskbar::openRawWindow(void)
|
|||||||
{
|
{
|
||||||
// Initialize the widget control using the default style
|
// Initialize the widget control using the default style
|
||||||
|
|
||||||
CWindowControl *control = new CWindowControl((NXWidgets::CWidgetStyle *)NULL);
|
NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl((NXWidgets::CWidgetStyle *)NULL);
|
||||||
|
|
||||||
// Get an (uninitialized) instance of the background window as a class
|
// Get an (uninitialized) instance of the background window as a class
|
||||||
// that derives from INxWindow.
|
// that derives from INxWindow.
|
||||||
@ -727,7 +799,7 @@ NXWidgets::CNxTkWindow *CTaskbar::openFramedWindow(void)
|
|||||||
{
|
{
|
||||||
// Initialize the widget control using the default style
|
// Initialize the widget control using the default style
|
||||||
|
|
||||||
CWindowControl *control = new CWindowControl((NXWidgets::CWidgetStyle *)NULL);
|
NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl((NXWidgets::CWidgetStyle *)NULL);
|
||||||
|
|
||||||
// Get an (uninitialized) instance of the framed window as a class
|
// Get an (uninitialized) instance of the framed window as a class
|
||||||
// that derives from INxWindow.
|
// that derives from INxWindow.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
* NxWidgets/nxwm/src/cwindowcontrol.cxx
|
* NxWidgets/nxwm/src/cwindowmessenger.cxx
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -46,28 +46,23 @@
|
|||||||
|
|
||||||
#include "nxwmconfig.hxx"
|
#include "nxwmconfig.hxx"
|
||||||
#include "cstartwindow.hxx"
|
#include "cstartwindow.hxx"
|
||||||
#include "cwindowcontrol.hxx"
|
#include "cwindowmessenger.hxx"
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
* CWindowControl Method Implementations
|
* CWindowMessenger Method Implementations
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
using namespace NxWM;
|
using namespace NxWM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* CWindowMessenger 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CWindowControl::CWindowControl(FAR const NXWidgets::CWidgetStyle *style)
|
CWindowMessenger::CWindowMessenger(void)
|
||||||
: NXWidgets::CWidgetControl(style)
|
|
||||||
{
|
{
|
||||||
// Open a message queue to communicate with the start window task. We need to create
|
// Open a message queue to communicate with the start window task. We need to create
|
||||||
// the message queue if it does not exist.
|
// the message queue if it does not exist.
|
||||||
@ -82,36 +77,28 @@ CWindowControl::CWindowControl(FAR const NXWidgets::CWidgetStyle *style)
|
|||||||
{
|
{
|
||||||
gdbg("ERROR: mq_open(%s) failed: %d\n", g_startWindowMqName, errno);
|
gdbg("ERROR: mq_open(%s) failed: %d\n", g_startWindowMqName, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add ourself as the window callback
|
|
||||||
|
|
||||||
addWindowEventHandler(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* CWindowMessenger Destructor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CWindowControl::~CWindowControl(void)
|
CWindowMessenger::~CWindowMessenger(void)
|
||||||
{
|
{
|
||||||
// Close the message queue
|
// Close the message queue
|
||||||
|
|
||||||
(void)mq_close(m_mqd);
|
(void)mq_close(m_mqd);
|
||||||
|
|
||||||
// Remove ourself from the window callback
|
|
||||||
|
|
||||||
removeWindowEventHandler(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy the application window and everything in it. This is
|
* 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
|
* 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
|
* the stop button), then we need to unwind and get out of the application
|
||||||
* logic before destroying all of its objects.
|
* logic before destroying all of its objects.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CWindowControl::destroy(IApplication *app)
|
void CWindowMessenger::destroy(IApplication *app)
|
||||||
{
|
{
|
||||||
// Send a message to destroy the window isntance at a later time
|
// Send a message to destroy the window isntance at a later time
|
||||||
|
|
||||||
@ -135,7 +122,7 @@ void CWindowControl::destroy(IApplication *app)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_MOUSE
|
#ifdef CONFIG_NX_MOUSE
|
||||||
void CWindowControl::handleMouseEvent(void)
|
void CWindowMessenger::handleMouseEvent(void)
|
||||||
{
|
{
|
||||||
// The logic path here is tortuous but flexible:
|
// The logic path here is tortuous but flexible:
|
||||||
//
|
//
|
||||||
@ -157,8 +144,8 @@ void CWindowControl::handleMouseEvent(void)
|
|||||||
// 7. NXWidgets::CWidgetControl records the new state data and raises a
|
// 7. NXWidgets::CWidgetControl records the new state data and raises a
|
||||||
// window event.
|
// window event.
|
||||||
// 8. NXWidgets::CWindowEventHandlerList will give the event to this method
|
// 8. NXWidgets::CWindowEventHandlerList will give the event to this method
|
||||||
// NxWM::CWindowControl.
|
// NxWM::CWindowMessenger.
|
||||||
// 9. This NxWM::CWindowControl method will send the a message on a well-
|
// 9. This NxWM::CWindowMessenger method will send the a message on a well-
|
||||||
// known message queue.
|
// known message queue.
|
||||||
// 10. This CStartWindow::startWindow task will receive and process that
|
// 10. This CStartWindow::startWindow task will receive and process that
|
||||||
// message by calling CWidgetControl::pollEvents()
|
// message by calling CWidgetControl::pollEvents()
|
||||||
@ -181,7 +168,7 @@ void CWindowControl::handleMouseEvent(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_KBD
|
#ifdef CONFIG_NX_KBD
|
||||||
void CWindowControl::handleKeyboardEvent(void)
|
void CWindowMessenger::handleKeyboardEvent(void)
|
||||||
{
|
{
|
||||||
// The logic path here is tortuous but flexible:
|
// The logic path here is tortuous but flexible:
|
||||||
//
|
//
|
||||||
@ -203,8 +190,8 @@ void CWindowControl::handleKeyboardEvent(void)
|
|||||||
// 7. NXWidgets::CWidgetControl records the new state data and raises a
|
// 7. NXWidgets::CWidgetControl records the new state data and raises a
|
||||||
// window event.
|
// window event.
|
||||||
// 8. NXWidgets::CWindowEventHandlerList will give the event to this method
|
// 8. NXWidgets::CWindowEventHandlerList will give the event to this method
|
||||||
// NxWM::CWindowControl.
|
// NxWM::CWindowMessenger.
|
||||||
// 9. This NxWM::CWindowControl method will send the a message on a well-
|
// 9. This NxWM::CWindowMessenger method will send the a message on a well-
|
||||||
// known message queue.
|
// known message queue.
|
||||||
// 10. This CStartWindow::startWindow task will receive and process that
|
// 10. This CStartWindow::startWindow task will receive and process that
|
||||||
// message by calling CWidgetControl::pollEvents()
|
// message by calling CWidgetControl::pollEvents()
|
Loading…
x
Reference in New Issue
Block a user