summaryrefslogtreecommitdiffstats
path: root/NxWidgets
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-04-29 22:10:52 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-04-29 22:10:52 +0000
commited308544c15bba1cb75e168c04d8c1b60fe293fc (patch)
tree4a7abb3a751f790f2ac18f842ee27f32c5941818 /NxWidgets
parent94b12bbdf0d81df64bac82ff1bc544664ccf4262 (diff)
NxWM update
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4676 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'NxWidgets')
-rw-r--r--NxWidgets/libnxwidgets/Makefile13
-rw-r--r--NxWidgets/nxwm/Makefile121
-rw-r--r--NxWidgets/nxwm/include/capplicationwindow.hxx49
-rw-r--r--NxWidgets/nxwm/include/cnxbackimage.hxx4
-rw-r--r--NxWidgets/nxwm/include/cnxtaskbar.hxx17
-rw-r--r--NxWidgets/nxwm/include/nxwmconfig.hxx13
-rw-r--r--NxWidgets/nxwm/include/nxwmglyphs.hxx14
-rw-r--r--NxWidgets/nxwm/src/capplicationwindow.cxx141
-rw-r--r--NxWidgets/nxwm/src/cnxtaskbar.cxx33
9 files changed, 290 insertions, 115 deletions
diff --git a/NxWidgets/libnxwidgets/Makefile b/NxWidgets/libnxwidgets/Makefile
index e3ff57339d..9a52087ed0 100644
--- a/NxWidgets/libnxwidgets/Makefile
+++ b/NxWidgets/libnxwidgets/Makefile
@@ -36,8 +36,7 @@
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
-NXWDIR := ${shell pwd | sed -e 's/ /\\ /g'}
-
+NXWIDGETDIR := ${shell pwd | sed -e 's/ /\\ /g'}
ASRCS =
CSRCS =
@@ -76,8 +75,12 @@ OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
BIN = libnxwidgets$(LIBEXT)
-CFLAGS += -I include
-CXXFLAGS += -I include
+ifeq ($(WINTOOL),y)
+INCDIROPT = -w
+endif
+
+CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(NXWIDGETDIR)/include}
+CXXFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(NXWIDGETDIR)/include}
DEPPATH = --dep-path src
VPATH = src
@@ -97,7 +100,7 @@ check_nuttx:
@( \
if [ -z "$(TOPDIR)" ]; then \
echo "The path to the nuttx directory must be provided on the command line."; \
- echo "Usage: make -C $(NXWDIR) TOPDIR=\"<nuttx directory>\""; \
+ echo "Usage: make -C $(NXWIDGETDIR) TOPDIR=\"<nuttx directory>\""; \
exit 1; \
fi; \
if [ ! -d "$(TOPDIR)" ]; then \
diff --git a/NxWidgets/nxwm/Makefile b/NxWidgets/nxwm/Makefile
new file mode 100644
index 0000000000..5197d03d6c
--- /dev/null
+++ b/NxWidgets/nxwm/Makefile
@@ -0,0 +1,121 @@
+#################################################################################
+# NxWidgets/nxwm/Makefile
+#
+# 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.
+#
+#################################################################################
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+
+NXWMDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+NXWIDGETDIR := $(NXWMDIR)/../libnxwidgets
+
+ASRCS =
+CSRCS =
+# Window Manager
+CXXSRCS = capplicationwindow.cxx cnxconsole.cxx cnxtaskbar.cxx
+# Images
+CXXSRCS += glyph_minimize.cxx glyph_nsh.cxx glyph_start.cxx glyph_stop.cxx
+
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+
+BIN = libnxwm$(LIBEXT)
+
+ifeq ($(WINTOOL),y)
+INCDIROPT = -w
+endif
+
+CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(NXWMDIR)/include}
+CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(NXWIDGETDIR)/include}
+CXXFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(NXWMDIR)/include}
+CXXFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(NXWIDGETDIR)/include}
+
+DEPPATH = --dep-path src
+VPATH = src
+
+all: $(BIN)
+.PHONY = check_nuttx depend clean distclean export
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+$(CXXOBJS): %$(OBJEXT): %.cxx
+ $(call COMPILEXX, $<, $@)
+
+check_nuttx:
+ @( \
+ if [ -z "$(TOPDIR)" ]; then \
+ echo "The path to the nuttx directory must be provided on the command line."; \
+ echo "Usage: make -C $(NXWMDIR) TOPDIR=\"<nuttx directory>\""; \
+ exit 1; \
+ fi; \
+ if [ ! -d "$(TOPDIR)" ]; then \
+ echo "The nuttx directory (TOPDIR) does not exist: $(TOPDIR)"; \
+ exit 1; \
+ fi; \
+ if [ ! -f "$(TOPDIR)/.config" ]; then \
+ echo "The nuttx directory (TOPDIR) has not been configured"; \
+ echo "Please configure NuttX and try again"; \
+ exit 1; \
+ fi; \
+ )
+
+$(BIN): check_nuttx $(OBJS)
+ @( for obj in $(OBJS) ; do \
+ $(call ARCHIVE, $@, $${obj}); \
+ done ; )
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(DEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ @rm -f $(BIN) *.a *.o *~ .*.sw*
+ $(call CLEAN)
+
+distclean: clean
+ @rm -f Make.dep .depend
+
+export: $(BIN)
+ zip -r nxwidgets-export.zip include $(BIN) COPYING
+
+-include Make.dep
diff --git a/NxWidgets/nxwm/include/capplicationwindow.hxx b/NxWidgets/nxwm/include/capplicationwindow.hxx
index 607538e126..984f03b467 100644
--- a/NxWidgets/nxwm/include/capplicationwindow.hxx
+++ b/NxWidgets/nxwm/include/capplicationwindow.hxx
@@ -43,6 +43,12 @@
#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
@@ -56,8 +62,6 @@
namespace NxWM
{
- class CNxtkWindow;
-
/**
* This callback class is used by the application to get notification of toolbar
* related events.
@@ -85,44 +89,43 @@ namespace NxWM
* and close buttions and passes these to the application via callbacks.
*/
- class CApplicationWindow : public INxApplication
+ class CApplicationWindow : private NXWidgets::CWidgetEventHandler
{
protected:
- NxWidgets::CNxTkWindow *m_window; /**< The framed window used by the application */
- NxWidgets::CNxToolbar *m_toolbar; /**< The toolbar */
- NxWidgets::CImage *m_minimizeImage; /**< The minimize icon */
- NxWidgets::CImage *m_stopImage; /**< The close icon */
- NxWidgets::CLabel *m_windowLabel; /**< The window title */
- NxWidgets::CRlePaletteBitmap *m_minimizeBitmap; /**< The minimize icon bitmap */
- NxWidgets::CRlePaletteBitmap *m_stopBitmap; /**< The stop icon bitmap */
- NxWidgets::CRlePaletteBitmap *m_minimizeBitmap; /**< The minimize icon bitmap */
- NxWidgets::CNxFont *m_windowFont; /**< The font used to rend the window label */
+ NXWidgets::CNxTkWindow *m_window; /**< The framed window used by the application */
+ NXWidgets::CNxToolbar *m_toolbar; /**< The toolbar */
+ NXWidgets::CImage *m_minimizeImage; /**< The minimize icon */
+ NXWidgets::CImage *m_stopImage; /**< The close icon */
+ NXWidgets::CLabel *m_windowLabel; /**< The window title */
+ NXWidgets::CRlePaletteBitmap *m_minimizeBitmap; /**< The minimize icon bitmap */
+ NXWidgets::CRlePaletteBitmap *m_stopBitmap; /**< The stop icon bitmap */
+ NXWidgets::CNxFont *m_windowFont; /**< The font used to rend the window label */
IApplicationCallback *m_callback; /**< Toolbar action callbacks */
/**
- * Configure the standard application toolbar
+ * Handle a mouse button click event.
*
- * @return True if the toolcar was successfully initialized.
+ * @param e The event data.
*/
-
- bool configureToolbar(void);
+
+ void handleClickEvent(const NXWidgets::CWidgetEventArgs &e);
/**
- * CNxApplicationWindow Destructor
+ * CApplicationWindow Destructor
*/
- ~CNxApplicationWindow(void);
+ ~CApplicationWindow(void);
public:
/**
- * CNxApplicationWindow Constructor
+ * CApplicationWindow Constructor
*
* @param taskbar. A pointer to the parent task bar instance
* @param window. The window to be used by this application.
*/
- CNxApplicationWindow(NxWidgets::CNxTkWindow *window);
+ CApplicationWindow(NXWidgets::CNxTkWindow *window);
/**
* Initialize window. Window initialization is separate from
@@ -139,7 +142,7 @@ namespace NxWM
* @return. The window used by this application
*/
- inline NxWidgets::CNxTkWindow *getWindow(void) const
+ inline NXWidgets::CNxTkWindow *getWindow(void) const
{
return m_window;
}
@@ -150,7 +153,7 @@ namespace NxWM
* @param appname. The name of the application to place on the window
*/
- inline void setWindowLabel(NxWidgets::CNxString &appname)
+ inline void setWindowLabel(NXWidgets::CNxString &appname)
{
m_windowLabel->setText(appname);
}
@@ -161,7 +164,7 @@ namespace NxWM
void registerCallbacks(IApplicationCallback *callback)
{
- m_callback = callback
+ m_callback = callback;
}
};
}
diff --git a/NxWidgets/nxwm/include/cnxbackimage.hxx b/NxWidgets/nxwm/include/cnxbackimage.hxx
index 903a4880d4..cc56e65199 100644
--- a/NxWidgets/nxwm/include/cnxbackimage.hxx
+++ b/NxWidgets/nxwm/include/cnxbackimage.hxx
@@ -64,10 +64,10 @@ namespace NxWM
* This class describes the NX windo manager's background image.
*/
- class CNxBackImage : public NxWidgets::CImage
+ class CNxBackImage : public NXWidgets::CImage
{
private:
- NxWidgets::CWidgetControl *m_widgetControl; // The controlling widget for the window
+ NXWidgets::CWidgetControl *m_widgetControl; // The controlling widget for the window
public:
/**
diff --git a/NxWidgets/nxwm/include/cnxtaskbar.hxx b/NxWidgets/nxwm/include/cnxtaskbar.hxx
index 5f1a815270..3809e17ff9 100644
--- a/NxWidgets/nxwm/include/cnxtaskbar.hxx
+++ b/NxWidgets/nxwm/include/cnxtaskbar.hxx
@@ -60,11 +60,11 @@ namespace NxWM
* This class describes the NX window manager's task bar
*/
- class CNxTaskBar : public NxWidgets::CNxServer
+ class CNxTaskBar : public NXWidgets::CNxServer, private NXWidgets::CWidgetEventHandler
{
private:
- NxWidgets:INxWindow *m_taskbar; /**< The toolbar window */
- NxWidgets:INxWindow *m_background; /**< The background window */
+ NXWidgets:INxWindow *m_taskbar; /**< The toolbar window */
+ NXWidgets:INxWindow *m_background; /**< The background window */
INxApplication *m_start; /**< The start window */
/**
@@ -110,7 +110,7 @@ namespace NxWM
* @param window. The window to be resized and repositioned
*/
- void setApplicationGeometry(NxWidgets::INxWindow *window);
+ void setApplicationGeometry(NXWidgets::INxWindow *window);
/**
* Create the toolbar window.
@@ -128,6 +128,15 @@ namespace NxWM
bool createBackgroundWindow(void);
+
+ /**
+ * Handle a mouse button click event.
+ *
+ * @param e The event data.
+ */
+
+ void handleClickEvent(const CWidgetEventArgs &e);
+
/**
* CNxTaskBar Destructor
*/
diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx
index 1400d41a44..dc6c2acf28 100644
--- a/NxWidgets/nxwm/include/nxwmconfig.hxx
+++ b/NxWidgets/nxwm/include/nxwmconfig.hxx
@@ -33,8 +33,8 @@
*
****************************************************************************/
-#ifndef __INCLUDE_NXWM_CONFIG_HXX
-#define __INCLUDE_NXWM_CONFIG_HXX
+#ifndef __INCLUDE_NXWMCONFIG_HXX
+#define __INCLUDE_NXWMCONFIG_HXX
/****************************************************************************
* Included Files
@@ -43,6 +43,7 @@
#include <nuttx/config.h>
#include "nxconfig.hxx"
+#include "crlepalettebitmap.hxx"
/****************************************************************************
* Pre-Processor Definitions
@@ -141,6 +142,12 @@
# define CONFIG_NXWM_TASKBAR_TOP 1
#endif
+/* Tool Bar Configuration ***************************************************/
+
+#ifndef CONFIG_NXWM_TOOLBAR_HEIGHT
+# define CONFIG_NXWM_TOOLBAR_HEIGHT CONFIG_NXWM_TASKBAR_WIDTH
+#endif
+
/* Colors *******************************************************************/
-#endif // __INCLUDE_NXWM_CONFIG_HXX
+#endif // __INCLUDE_NXWMCONFIG_HXX
diff --git a/NxWidgets/nxwm/include/nxwmglyphs.hxx b/NxWidgets/nxwm/include/nxwmglyphs.hxx
index a311155b0f..bacd358911 100644
--- a/NxWidgets/nxwm/include/nxwmglyphs.hxx
+++ b/NxWidgets/nxwm/include/nxwmglyphs.hxx
@@ -33,8 +33,8 @@
*
****************************************************************************/
-#ifndef __INCLUDE_NXWM_CONFIG_HXX
-#define __INCLUDE_NXWM_CONFIG_HXX
+#ifndef __INCLUDE_NXWMGLYPHS_HXX
+#define __INCLUDE_NXWMGLYPHS_HXX
/****************************************************************************
* Included Files
@@ -56,11 +56,11 @@
namespace NxWM
{
- extern const struct NxWidgets::SRlePaletteBitmap g_nshBitmap;
- extern const struct NxWidgets::SRlePaletteBitmap g_minimizeBitmap;
- extern const struct NxWidgets::SRlePaletteBitmap g_startBitmap;
- extern const struct NxWidgets::SRlePaletteBitmap g_stopBitmap;
+ extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap;
+ extern const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap;
+ extern const struct NXWidgets::SRlePaletteBitmap g_startBitmap;
+ extern const struct NXWidgets::SRlePaletteBitmap g_stopBitmap;
}
#endif // __cplusplus
-#endif // __INCLUDE_NXWM_CONFIG_HXX
+#endif // __INCLUDE_NXWMGLYPHS_HXX
diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx
index 6ffb1dd532..a753cec3e5 100644
--- a/NxWidgets/nxwm/src/capplicationwindow.cxx
+++ b/NxWidgets/nxwm/src/capplicationwindow.cxx
@@ -39,28 +39,30 @@
#include <nuttx/config.h>
+#include <nuttx/nx/nxglib.h>
+
#include "nxwmconfig.hxx"
#include "nxwmglyphs.hxx"
-#include "cappliationwinow.hxx"
+#include "capplicationwindow.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
/********************************************************************************************
- * CNxApplicationWindow Method Implementations
+ * CApplicationWindow Method Implementations
********************************************************************************************/
using namespace NxWM;
/**
- * CNxApplicationWindow Constructor
+ * CApplicationWindow Constructor
*
* @param taskbar. A pointer to the parent task bar instance
* @param window. The window to be used by this application.
*/
-CNxApplicationWindow::CNxApplicationWindow(NxWidgets::CNxTkWindow *window);
+CApplicationWindow::CApplicationWindow(NXWidgets::CNxTkWindow *window)
{
// Save the window for later use
@@ -68,16 +70,16 @@ CNxApplicationWindow::CNxApplicationWindow(NxWidgets::CNxTkWindow *window);
// These will be created with the open method is called
- m_toolbar = (NxWidgets::CNxToolbar *)0;
+ m_toolbar = (NXWidgets::CNxToolbar *)0;
- m_minimizeImage = (NxWidgets::CImage *)0;
- m_stopImage = (NxWidgets::CImage *)0;
- m_windowLabel = (NxWidgets::CLabel *)0;
+ m_minimizeImage = (NXWidgets::CImage *)0;
+ m_stopImage = (NXWidgets::CImage *)0;
+ m_windowLabel = (NXWidgets::CLabel *)0;
- m_minimizeBitmap = (NxWidgets::CRlePaletteBitmap *)0;
- m_stopBitmap = (NxWidgets::CRlePaletteBitmap *)0;
+ m_minimizeBitmap = (NXWidgets::CRlePaletteBitmap *)0;
+ m_stopBitmap = (NXWidgets::CRlePaletteBitmap *)0;
- m_windowFont = (NxWidgets::CNxFont *)0;
+ m_windowFont = (NXWidgets::CNxFont *)0;
// This will be initialized when the registerCallbacks() method is called
@@ -85,10 +87,10 @@ CNxApplicationWindow::CNxApplicationWindow(NxWidgets::CNxTkWindow *window);
}
/**
- * CNxApplicationWindow Destructor
+ * CApplicationWindow Destructor
*/
-CNxApplicationWindow::~CNxApplicationWindow(void)
+CApplicationWindow::~CApplicationWindow(void)
{
// Free the resources that we are responsible for
@@ -143,29 +145,11 @@ CNxApplicationWindow::~CNxApplicationWindow(void)
* @return True if the window was successfully initialized.
*/
-bool CNxApplicationWindow::open(void)
-{
- /* Configure the toolbar */
-
- if (!configureToolbar())
- {
- return false;
- }
-
- return true;
-}
-
-/**
- * Configure the standard application toolbar
- *
- * @return True if the toolcar was successfully initialized.
- */
-
-bool configureToolbar(void)
+bool CApplicationWindow::open(void)
{
// Open the toolbar
- m_toolbar = m_window->openToolbar();
+ m_toolbar = m_window->openToolbar(CONFIG_NXWM_TOOLBAR_HEIGHT);
if (!m_toolbar)
{
// We failed to open the toolbar
@@ -183,7 +167,7 @@ bool configureToolbar(void)
// Get the CWidgetControl associated with this window
- NxWidgets::CWidgetControl *control = m_toolbar->getWidgetControl();
+ NXWidgets::CWidgetControl *control = m_toolbar->getWidgetControl();
if (control)
{
return false;
@@ -191,7 +175,7 @@ bool configureToolbar(void)
// Create STOP bitmap container
- m_stopBitmap = new NxWidgets::CRlePaletteBitmap(&g_stopBitmap);
+ m_stopBitmap = new NXWidgets::CRlePaletteBitmap(&g_stopBitmap);
if (!m_stopBitmap)
{
return false;
@@ -199,8 +183,8 @@ bool configureToolbar(void)
// Create the STOP application icon at the right of the toolbar
- nxgl_point_t iconPos;
- nxgl_size_t iconSize;
+ struct nxgl_point_s iconPos;
+ struct nxgl_size_s iconSize;
// Get the height and width of the stop bitmap
@@ -218,7 +202,7 @@ bool configureToolbar(void)
// Pick an X/Y position such that the image will position at the right of
// the toolbar and centered vertically.
- iconPos.x = windowSize.w - iconsize.w;
+ iconPos.x = windowSize.w - iconSize.w;
if (iconSize.h >= windowSize.h)
{
@@ -231,15 +215,20 @@ bool configureToolbar(void)
// Now we have enough information to create the image
- m_stopImage = new CImage(control, iconPos.x, iconPos.y, iconSize.w, iconSize.h, m_stopBitmap);
+ m_stopImage = new NXWidgets::CImage(control, iconPos.x, iconPos.y, iconSize.w,
+ iconSize.h, m_stopBitmap);
if (!m_stopImage)
{
return false;
}
+ // Configure 'this' to receive mouse click inputs from the image
+
+ m_stopImage->addWidgetEventHandler(this);
+
// Create MINIMIZE application bitmap container
- m_minimizeBitmap = new NxWidgets::CRlePaletteBitmap(&g_minimizeBitmap);
+ m_minimizeBitmap = new NXWidgets::CRlePaletteBitmap(&g_minimizeBitmap);
if (!m_minimizeBitmap)
{
return false;
@@ -261,7 +250,7 @@ bool configureToolbar(void)
// Pick an X/Y position such that the image will position at the right of
// the toolbar and centered vertically.
- iconPos.x -= iconsize.w;
+ iconPos.x -= iconSize.w;
if (iconSize.h >= windowSize.h)
{
@@ -274,42 +263,40 @@ bool configureToolbar(void)
// Now we have enough information to create the image
- m_minimizeImage = new CImage(control, iconPos.x, iconPos.y, iconSize.w, iconSize.h, m_minimizeBitmap);
+ m_minimizeImage = new NXWidgets::CImage(control, iconPos.x, iconPos.y, iconSize.w,
+ iconSize.h, m_minimizeBitmap);
if (!m_minimizeImage)
{
return false;
}
+ // Configure 'this' to receive mouse click inputs from the image
+
+ m_minimizeImage->addWidgetEventHandler(this);
+
// The rest of the toolbar will hold the left-justified application label
// Create the default font instance
- m_windowFont = new CNxFont(CONFIG_NXWM_DEFAULT_FONTID,
- CONFIG_NXWM_DEFAULT_FONTCOLOR,
- CONFIG_NXWM_TRANSPARENT_COLOR);
+ m_windowFont = new NXWidgets::CNxFont(CONFIG_NXWM_DEFAULT_FONTID,
+ CONFIG_NXWM_DEFAULT_FONTCOLOR,
+ CONFIG_NXWM_TRANSPARENT_COLOR);
if (!m_windowFont)
{
return false;
}
- // Get the width of the display
-
- struct nxgl_size_s windowSize;
- if (!m_bgWindow->getSize(&windowSize))
- {
- printf("CLabelTest::createGraphics: Failed to get window size\n");
- return (CLabel *)NULL;
- }
// Get the height and width of the text display area
- size.w = pos.x
- size.h = windowSize.h;
+ iconSize.w = iconPos.x;
+ iconSize.h = windowSize.h;
- pos.x = 0;
- pos.y = 0;
+ iconPos.x = 0;
+ iconPos.y = 0;
// Now we have enough information to create the label
- m_windowLabel = new CLabel(control, pos.x, pos.y, size.w, size.h, "");
+ m_windowLabel = new NXWidgets::CLabel(control, iconPos.x, iconPos.y,
+ iconSize.w, iconSize.h, "");
if (!m_windowLabel)
{
return false;
@@ -317,10 +304,42 @@ bool configureToolbar(void)
// Configure the label
- m_windowLabel->setBorderLess(true);
- m_windowLabel->setTextAlignmentHoriz(NxWidgets::TEXT_ALIGNMENT_HORIZ_LEFT);
- m_windowLabel->setTextAlignmentVert(NxWidgets::TEXT_ALIGNMENT_VERT_CENTER);
+ m_windowLabel->setBorderless(true);
+ m_windowLabel->setTextAlignmentHoriz(NXWidgets::CLabel::TEXT_ALIGNMENT_HORIZ_LEFT);
+ m_windowLabel->setTextAlignmentVert(NXWidgets::CLabel::TEXT_ALIGNMENT_VERT_CENTER);
+ m_windowLabel->setRaisesEvents(false);
return true;
}
+/**
+ * Handle a mouse button click event.
+ *
+ * @param e The event data.
+ */
+
+void CApplicationWindow::handleClickEvent(const NXWidgets::CWidgetEventArgs &e)
+{
+ // Ignore the event if no callback is registered
+
+ if (m_callback)
+ {
+ // Check the stop application image
+
+ if (m_stopImage->isClicked())
+ {
+ // Notify the controlling logic that the application should be stopped
+
+ m_callback->close();
+ }
+
+ // Check the minimize image (only if the stop application image is not pressed)
+
+ else if (m_minimizeImage->isClicked())
+ {
+ // Notify the controlling logic that the application should be miminsed
+
+ m_callback->minimize();
+ }
+ }
+}
diff --git a/NxWidgets/nxwm/src/cnxtaskbar.cxx b/NxWidgets/nxwm/src/cnxtaskbar.cxx
index b230c67855..6b93bc793e 100644
--- a/NxWidgets/nxwm/src/cnxtaskbar.cxx
+++ b/NxWidgets/nxwm/src/cnxtaskbar.cxx
@@ -202,7 +202,7 @@ void CNxTaskBar::disconnect(void)
// Close the windows
- NxWidgets::CWidgetControl *control;
+ NXWidgets::CWidgetControl *control;
if (m_taskbar)
{
// Delete the contained widget control. We are responsible for it
@@ -273,12 +273,12 @@ NXWidgets::CNxWindow *CNxTaskBar::openRawWindow(void)
{
// Initialize the widget control using the default style
- NxWidgets::CWidgetControl *widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+ NXWidgets::CWidgetControl *widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
- NxWidgets::CNxWindow window = createRawWindow(widgetControl);
+ NXWidgets::CNxWindow window = createRawWindow(widgetControl);
if (!window)
{
message("CNxwm::createGraphics: Failed to create background window\n");
@@ -312,12 +312,12 @@ NXWidgets::CNxTkWindow *CNxTaskBar::openFramedWindow(void)
{
// Initialize the widget control using the default style
- NxWidgets::CWidgetControl *widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
+ NXWidgets::CWidgetControl *widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
- NxWidgets:CNxTkWindow window = createRawWindow(widgetControl);
+ NXWidgets:CNxTkWindow window = createRawWindow(widgetControl);
if (!window)
{
message("CNxwm::createGraphics: Failed to create background window\n");
@@ -347,12 +347,12 @@ NXWidgets::CNxTkWindow *CNxTaskBar::openFramedWindow(void)
* @return true on success
*/
-bool CNxTaskBar::setApplicationGeometry(NxWidgets::INxWindow *window)
+bool CNxTaskBar::setApplicationGeometry(NXWidgets::INxWindow *window)
{
// Get the widget control from the toolbar window. The physical window geometry
// should be the same for all windows.
- NxWidgets::CWidgetControl *control = m_taskbar->getWidgetControl();
+ NXWidgets::CWidgetControl *control = m_taskbar->getWidgetControl();
// Now position and size the application. This will depend on the position and
// orientation of the toolbar.
@@ -415,7 +415,7 @@ bool CNxTaskBar::createToolbarWindow(void)
// Get the contained widget control
- NxWidgets::CWidgetControl *control = m_taskbar->getWidgetControl();
+ NXWidgets::CWidgetControl *control = m_taskbar->getWidgetControl();
// Get the size of the window from the widget control
@@ -490,7 +490,7 @@ bool CNxTaskBar::createBackgroundWindow(void)
// Set the geometry to fit in the application window space
- setApplicationGeometry(static_cast<NxWidgets::INxWidget>(m_background));
+ setApplicationGeometry(static_cast<NXWidgets::INxWidget>(m_background));
/* And lower the background window to the bottom of the display */
@@ -518,7 +518,7 @@ bool CNxTaskBar::createStartWindow(void)
// Set the geometry to fit in the application window space
- setApplicationGeometry(static_cast<NxWidgets::INxWidget>(m_start));
+ setApplicationGeometry(static_cast<NXWidgets::INxWidget>(m_start));
/* And lower the background window to the top of the display */
@@ -530,3 +530,16 @@ bool CNxTaskBar::createStartWindow(void)
// m_start
return true;
}
+
+/**
+ * Handle a mouse button click event.
+ *
+ * @param e The event data.
+ */
+
+void CNxApplicationWindow::handleClickEvent(const NXWidgets::CWidgetEventArgs &e)
+{
+#warning "Missing logic"
+}
+
+