diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-09 19:31:48 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-09 19:31:48 +0000 |
commit | d97899b6e2c22b4f33f23a8333a03cd323bcd45e (patch) | |
tree | 3275cf363a5ddb67c70108c4712f8903fb0b958c /NxWidgets/nxwm/src | |
parent | 0f72f7085182b9038e0037c3b949458ac3306fdc (diff) | |
download | nuttx-d97899b6e2c22b4f33f23a8333a03cd323bcd45e.tar.gz nuttx-d97899b6e2c22b4f33f23a8333a03cd323bcd45e.tar.bz2 nuttx-d97899b6e2c22b4f33f23a8333a03cd323bcd45e.zip |
NxWidgets: Remove modal loops, Add CWindowEventHandler*. NxWM: Add support for full screen applications
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4716 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/nxwm/src')
-rw-r--r-- | NxWidgets/nxwm/src/capplicationwindow.cxx | 158 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/cfullscreenwindow.cxx | 247 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/cnxconsole.cxx | 8 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/cstartwindow.cxx | 10 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/ctaskbar.cxx | 118 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/glyph_play.cxx | 71 |
6 files changed, 567 insertions, 45 deletions
diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx index 0fb6f387a..ad57ba4b2 100644 --- a/NxWidgets/nxwm/src/capplicationwindow.cxx +++ b/NxWidgets/nxwm/src/capplicationwindow.cxx @@ -62,8 +62,7 @@ /** * CApplicationWindow Constructor * - * @param taskbar. A pointer to the parent task bar instance - * @param window. The window to be used by this application. + * @param taskbar. A pointer to the parent task bar instance. */ CApplicationWindow::CApplicationWindow(NXWidgets::CNxTkWindow *window) @@ -134,7 +133,7 @@ CApplicationWindow::~CApplicationWindow(void) } // We didn't create the window. That was done by the task bar, - // Be we will handle destruction of with window as a courtesy. + // But we will handle destruction of with window as a courtesy. if (m_window) { @@ -314,6 +313,14 @@ bool CApplicationWindow::open(void) m_windowLabel->setTextAlignmentHoriz(NXWidgets::CLabel::TEXT_ALIGNMENT_HORIZ_LEFT); m_windowLabel->setTextAlignmentVert(NXWidgets::CLabel::TEXT_ALIGNMENT_VERT_CENTER); m_windowLabel->setRaisesEvents(false); + + // Get the window control + + NXWidgets::CWidgetControl *windowControl = m_window->getWidgetControl(); + + // Register to receive callbacks on a few select window events + + windowControl->addWindowEventHandler(this); return true; } @@ -381,6 +388,151 @@ void CApplicationWindow::hide(void) } /** + * Recover the contained NXTK window instance + * + * @return. The window used by this application + */ + +NXWidgets::INxWindow *CApplicationWindow::getWindow(void) const +{ + return static_cast<NXWidgets::INxWindow*>(m_window); +} + +/** + * Set the window label + * + * @param appname. The name of the application to place on the window + */ + +void CApplicationWindow::setWindowLabel(NXWidgets::CNxString &appname) +{ + m_windowLabel->setText(appname); +} + +/** + * Register to receive callbacks when toolbar icons are selected + */ + +void CApplicationWindow::registerCallbacks(IApplicationCallback *callback) +{ + m_callback = callback; +} + +/** + * Simulate a mouse click on the minimize icon. This method is only + * used during automated testing of NxWM. + */ + +#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) +void CApplicationWindow::clickMinimizeIcon(int index) +{ + // Get the size and position of the widget + + struct nxgl_size_s imageSize; + m_minimizeImage->getSize(imageSize); + + struct nxgl_point_s imagePos; + m_minimizeImage->getPos(imagePos); + + // And click the image at its center + + m_minimizeImage->click(imagePos.x + (imageSize.w >> 1), imagePos.y + (imageSize.h >> 1)); +} +#endif + +/** + * Simulate a mouse click on the stop applicaiton icon. This method is only + * used during automated testing of NxWM. + */ + +#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) +void CApplicationWindow::clickStopIcon(int index) +{ + // Get the size and position of the widget + + struct nxgl_size_s imageSize; + m_stopImage->getSize(imageSize); + + struct nxgl_point_s imagePos; + m_stopImage->getPos(imagePos); + + // And click the image at its center + + m_stopImage->click(imagePos.x + (imageSize.w >> 1), imagePos.y + (imageSize.h >> 1)); +} +#endif + +/** + * Handle an NX window mouse input event. + * + * @param e The event data. + */ + +#ifdef CONFIG_NX_MOUSE +void CApplicationWindow::handleMouseEvent(void) +{ + // The logic path here is tortuous but flexible: + // + // 1. A listener thread receives mouse input and injects that into NX + // 2. In the multi-user mode, this will send a message to the NX server + // 3. The NX server will determine which window gets the mouse input + // and send a message to the listener. + // 4. The listener will call the NX message dispatcher will will do the + // message callback. + // 5. The callback goes into an instance of NXWidgets::CCallback that is + // part of the CWidget control. + // 6. That callback will update mouse information then raise the + // mouse event, + // 7. Which will finally call this function -- still running deep on the + // stack in the listener thread. + // 8. This function will then call back into the wiget control to process + // the mouse input. + + // Get the CWidgetControl associated with the window + + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); + + // And perform a poll + + control->pollEvents(); +} +#endif + +/** + * Handle a NX window keyboard input event. + */ + +#ifdef CONFIG_NX_KBD +void CApplicationWindow::handleKeyboardEvent(void) +{ + // The logic path here is tortuous but flexible: + // + // 1. A listener thread receives keyboard input and injects that into NX + // 2. In the multi-user mode, this will send a message to the NX server + // 3. The NX server will determine which window gets the keyboard input + // and send a message to the listener. + // 4. The listener will call the NX message dispatcher will will do the + // message callback. + // 5. The callback goes into an instance of NXWidgets::CCallback that is + // part of the CWidget control. + // 6. That callback will update keyboard information then raise the + // keyboard event, + // 7. Which will finally call this function -- still running deep on the + // stack in the listener thread. + // 8. This function will then call back into the wiget control to process + // the keyboard input. + + // Get the CWidgetControl associated with the window + + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); + + // And perform a poll + + control->pollEvents(); +} +#endif + +/** * Handle a mouse button click event. * * @param e The event data. diff --git a/NxWidgets/nxwm/src/cfullscreenwindow.cxx b/NxWidgets/nxwm/src/cfullscreenwindow.cxx new file mode 100644 index 000000000..d4fcf23b2 --- /dev/null +++ b/NxWidgets/nxwm/src/cfullscreenwindow.cxx @@ -0,0 +1,247 @@ +/******************************************************************************************** + * NxWidgets/nxwm/src/cfullscreen.cxx + * + * 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. + * + ********************************************************************************************/ + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include <nuttx/config.h> + +#include <nuttx/nx/nxglib.h> + +#include "nxconfig.hxx" +#include "cwidgetcontrol.hxx" +#include "cgraphicsport.hxx" + +#include "nxwmconfig.hxx" +#include "nxwmglyphs.hxx" +#include "cfullscreenwindow.hxx" + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +/******************************************************************************************** + * CFullScreenWindow Method Implementations + ********************************************************************************************/ + + using namespace NxWM; + +/** + * CFullScreenWindow Constructor + * + * @param window. The raw window to be used by this application. + */ + +CFullScreenWindow::CFullScreenWindow(NXWidgets::CNxWindow *window) +{ + // Save the window for later use + + m_window = window; +} + +/** + * CFullScreenWindow Destructor + */ + +CFullScreenWindow::~CFullScreenWindow(void) +{ + // We didn't create the window. That was done by the task bar, + // But we will handle destruction of with window as a courtesy. + + if (m_window) + { + delete m_window; + } +} + +/** + * Initialize window. Window initialization is separate from + * object instantiation so that failures can be reported. + * + * @return True if the window was successfully initialized. + */ + +bool CFullScreenWindow::open(void) +{ + // Get the window control + + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); + + // Register to receive callbacks on a few select window events + + control->addWindowEventHandler(this); + return true; +} + +/** + * Re-draw the application window + */ + +void CFullScreenWindow::redraw(void) +{ +} + +/** + * The application window is hidden (either it is minimized or it is + * maximized, but not at the top of the hierarchy) + */ + +void CFullScreenWindow::hide(void) +{ +} + +/** + * Recover the contained raw window instance + * + * @return. The window used by this application + */ + +NXWidgets::INxWindow *CFullScreenWindow::getWindow(void) const +{ + return static_cast<NXWidgets::INxWindow*>(m_window); +} + +/** + * Set the window label + * + * @param appname. The name of the application to place on the window + */ + +void CFullScreenWindow::setWindowLabel(NXWidgets::CNxString &appname) +{ +} + +/** + * Register to receive callbacks when toolbar icons are selected + */ + +void CFullScreenWindow::registerCallbacks(IApplicationCallback *callback) +{ +} + +/** + * Simulate a mouse click on the minimize icon. This method is only + * used during automated testing of NxWM. + */ + +#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) +void CFullScreenWindow::clickMinimizeIcon(int index) +{ +} +#endif + +/** + * Simulate a mouse click on the stop applicaiton icon. This method is only + * used during automated testing of NxWM. + */ + +#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) +void CFullScreenWindow::clickStopIcon(int index) +{ +} +#endif + +/** + * Handle an NX window mouse input event. + * + * @param e The event data. + */ + +#ifdef CONFIG_NX_MOUSE +void CFullScreenWindow::handleMouseEvent(void) +{ + // The logic path here is tortuous but flexible: + // + // 1. A listener thread receives mouse input and injects that into NX + // 2. In the multi-user mode, this will send a message to the NX server + // 3. The NX server will determine which window gets the mouse input + // and send a message to the listener. + // 4. The listener will call the NX message dispatcher will will do the + // message callback. + // 5. The callback goes into an instance of NXWidgets::CCallback that is + // part of the CWidget control. + // 6. That callback will update mouse information then raise the + // mouse event, + // 7. Which will finally call this function -- still running deep on the + // stack in the listener thread. + // 8. This function will then call back into the wiget control to process + // the mouse input. + + // Get the CWidgetControl associated with the window + + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); + + // And perform a poll + + control->pollEvents(); +} +#endif + +/** + * Handle a NX window keyboard input event. + */ + +#ifdef CONFIG_NX_KBD +void CFullScreenWindow::handleKeyboardEvent(void) +{ + // The logic path here is tortuous but flexible: + // + // 1. A listener thread receives keyboard input and injects that into NX + // 2. In the multi-user mode, this will send a message to the NX server + // 3. The NX server will determine which window gets the keyboard input + // and send a message to the listener. + // 4. The listener will call the NX message dispatcher will will do the + // message callback. + // 5. The callback goes into an instance of NXWidgets::CCallback that is + // part of the CWidget control. + // 6. That callback will update keyboard information then raise the + // keyboard event, + // 7. Which will finally call this function -- still running deep on the + // stack in the listener thread. + // 8. This function will then call back into the wiget control to process + // the keyboard input. + + // Get the CWidgetControl associated with the window + + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); + + // And perform a poll + + control->pollEvents(); +} +#endif + + diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx index 8898b8bcb..5ee12d36f 100644 --- a/NxWidgets/nxwm/src/cnxconsole.cxx +++ b/NxWidgets/nxwm/src/cnxconsole.cxx @@ -153,9 +153,9 @@ CNxConsole::~CNxConsole(void) * the contained CApplicationWindow instance. */ -CApplicationWindow *CNxConsole::getWindow(void) const +IApplicationWindow *CNxConsole::getWindow(void) const { - return m_window; + return static_cast<IApplicationWindow*>(m_window); } /** @@ -202,7 +202,7 @@ bool CNxConsole::run(void) // Recover the NXTK window instance contained in the application window - NXWidgets::CNxTkWindow *window = m_window->getWindow(); + NXWidgets::INxWindow *window = m_window->getWindow(); // Get the widget control associated with the NXTK window @@ -308,7 +308,7 @@ void CNxConsole::redraw(void) { // Recover the NXTK window instance contained in the application window - NXWidgets::CNxTkWindow *window = m_window->getWindow(); + NXWidgets::INxWindow *window = m_window->getWindow(); // Get the size of the window diff --git a/NxWidgets/nxwm/src/cstartwindow.cxx b/NxWidgets/nxwm/src/cstartwindow.cxx index a29f1f785..8da71b2b5 100644 --- a/NxWidgets/nxwm/src/cstartwindow.cxx +++ b/NxWidgets/nxwm/src/cstartwindow.cxx @@ -101,12 +101,12 @@ CStartWindow::~CStartWindow(void) /** * Each implementation of IApplication must provide a method to recover - * the contained CApplicationWindow instance. + * the contained IApplicationWindow instance. */ -CApplicationWindow *CStartWindow::getWindow(void) const +IApplicationWindow *CStartWindow::getWindow(void) const { - return m_window; + return static_cast<IApplicationWindow*>(m_window); } /** @@ -184,7 +184,7 @@ void CStartWindow::redraw(void) { // Recover the NXTK window instance contained in the application window - NXWidgets::CNxTkWindow *window = m_window->getWindow(); + NXWidgets::INxWindow *window = m_window->getWindow(); // Get the widget control associated with the NXTK window @@ -298,7 +298,7 @@ bool CStartWindow::addApplication(IApplication *app) { // Recover the NXTK window instance contained in the application window - NXWidgets::CNxTkWindow *window = m_window->getWindow(); + NXWidgets::INxWindow *window = m_window->getWindow(); // Get the widget control associated with the NXTK window diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx index 2c6bf660b..34bf53d1a 100644 --- a/NxWidgets/nxwm/src/ctaskbar.cxx +++ b/NxWidgets/nxwm/src/ctaskbar.cxx @@ -45,8 +45,6 @@ #include "cwidgetcontrol.hxx" #include "cnxtkwindow.hxx" -#include "nxwmconfig.hxx" -#include "nxwmglyphs.hxx" #include "ctaskbar.hxx" /******************************************************************************************** @@ -250,13 +248,14 @@ bool CTaskbar::startWindowManager(void) } /** - * Create an application window. Creating a new application in the start - * window requires three steps: + * Create an normal application window. Creating a normal application in the + * start window requires three steps: * * 1. Call CTaskBar::openApplicationWindow to create a window for the application, * 2. Instantiate the application, providing the window to the application's * constructor, - * 3. Then call CStartWindow::addApplication to add the application to the start window. + * 3. Then call CStartWindow::addApplication to add the application to the + * start window. * * When the application is selected from the start window: * @@ -266,7 +265,7 @@ bool CTaskbar::startWindowManager(void) CApplicationWindow *CTaskbar::openApplicationWindow(void) { - // Create a framed window for the application + // Get a framed window for the application NXWidgets::CNxTkWindow *window = openFramedWindow(); if (!window) @@ -276,17 +275,58 @@ CApplicationWindow *CTaskbar::openApplicationWindow(void) // Set size and position of a window in the application area. - setApplicationGeometry(window); + setApplicationGeometry(window, false); // Use this window to instantiate the application window - CApplicationWindow *appwindow = new CApplicationWindow(window); - if (!appwindow) + CApplicationWindow *appWindow = new CApplicationWindow(window); + if (!appWindow) + { + delete window; + } + + return appWindow; +} + +/** + * Create a full screen application window. Creating a new full screen application + * requires three steps: + * + * 1. Call CTaskBar::FullScreenWindow to create a window for the application, + * 2. Instantiate the application, providing the window to the application's + * constructor, + * 3. Then call CStartWindow::addApplication to add the application to the + * start window. + * + * When the application is selected from the start window: + * + * 4. Call CTaskBar::startApplication start the application and bring its window to + * the top. + */ + +CFullScreenWindow *CTaskbar::openFullScreenWindow(void) +{ + // Get a raw window for the application + + NXWidgets::CNxWindow *window = openRawWindow(); + if (!window) + { + return (CFullScreenWindow *)0; + } + + // Set size and position of a window in the application area. + + setApplicationGeometry(window, true); + + // Use this window to instantiate the generia application window + + CFullScreenWindow *appWindow = new CFullScreenWindow(window); + if (!appWindow) { delete window; } - return appwindow; + return appWindow; } /** @@ -561,7 +601,7 @@ NXWidgets::CNxTkWindow *CTaskbar::openFramedWindow(void) NXWidgets::CWidgetControl *widgetControl = new NXWidgets::CWidgetControl((NXWidgets::CWidgetStyle *)NULL); - // Get an (uninitialized) instance of the background window as a class + // Get an (uninitialized) instance of the framed window as a class // that derives from INxWindow. NXWidgets::CNxTkWindow *window = createFramedWindow(widgetControl); @@ -588,11 +628,12 @@ NXWidgets::CNxTkWindow *CTaskbar::openFramedWindow(void) * Set size and position of a window in the application area. * * @param window. The window to be resized and repositioned + * @param fullscreen. True: Use full screen * * @return true on success */ -void CTaskbar::setApplicationGeometry(NXWidgets::INxWindow *window) +void CTaskbar::setApplicationGeometry(NXWidgets::INxWindow *window, bool fullscreen) { // Get the widget control from the task bar window. The physical window geometry // should be the same for all windows. @@ -609,31 +650,44 @@ void CTaskbar::setApplicationGeometry(NXWidgets::INxWindow *window) struct nxgl_point_s pos; struct nxgl_size_s size; + // In fullscreen mode, the application window gets everything + + if (fullscreen) + { + pos.x = 0; + pos.y = 0; + + size.w = rect.getWidth(); + size.h = rect.getHeight(); + } + else + { #if defined(CONFIG_NXWM_TASKBAR_TOP) - pos.x = 0; - pos.y = CONFIG_NXWM_TASKBAR_WIDTH; + pos.x = 0; + pos.y = CONFIG_NXWM_TASKBAR_WIDTH; - size.w = rect.getWidth(); - size.h = rect.getWidth() - CONFIG_NXWM_TASKBAR_WIDTH; + size.w = rect.getWidth(); + size.h = rect.getHeight() - CONFIG_NXWM_TASKBAR_WIDTH; #elif defined(CONFIG_NXWM_TASKBAR_BOTTOM) - pos.x = 0; - pos.y = 0; + pos.x = 0; + pos.y = 0; - size.w = rect.getWidth(); - size.h = rect.getWidth() - CONFIG_NXWM_TASKBAR_WIDTH; + size.w = rect.getWidth(); + size.h = rect.getHeight() - CONFIG_NXWM_TASKBAR_WIDTH; #elif defined(CONFIG_NXWM_TASKBAR_LEFT) - pos.x = CONFIG_NXWM_TASKBAR_WIDTH; - pos.y = 0; + pos.x = CONFIG_NXWM_TASKBAR_WIDTH; + pos.y = 0; - size.w = rect.getWidth() - CONFIG_NXWM_TASKBAR_WIDTH; - size.h = rect.getHeight(); + size.w = rect.getWidth() - CONFIG_NXWM_TASKBAR_WIDTH; + size.h = rect.getHeight(); #else - pos.x = 0; - pos.y = 0; + pos.x = 0; + pos.y = 0; - size.w = rect.getWidth() - CONFIG_NXWM_TASKBAR_WIDTH; - size.h = rect.getHeight(); + size.w = rect.getWidth() - CONFIG_NXWM_TASKBAR_WIDTH; + size.h = rect.getHeight(); #endif + } /* Set the size and position the window. * @@ -730,7 +784,7 @@ bool CTaskbar::createBackgroundWindow(void) // Set the geometry to fit in the application window space - setApplicationGeometry(static_cast<NXWidgets::INxWindow*>(m_background)); + setApplicationGeometry(static_cast<NXWidgets::INxWindow*>(m_background), false); return true; } @@ -1034,11 +1088,11 @@ bool CTaskbar::redrawApplicationWindow(IApplication *app) // Every application provides a method to obtain its application window - CApplicationWindow *appWindow = app->getWindow(); + IApplicationWindow *appWindow = app->getWindow(); // Each application window provides a method to get the underlying NX window - NXWidgets::CNxTkWindow *window = appWindow->getWindow(); + NXWidgets::INxWindow *window = appWindow->getWindow(); // Raise the application window to the top of the hierarchy @@ -1085,7 +1139,7 @@ void CTaskbar::hideApplicationWindow(IApplication *app) // Every application provides a method to obtain its application window - CApplicationWindow *appWindow = app->getWindow(); + IApplicationWindow *appWindow = app->getWindow(); // Hide the application window toolbar diff --git a/NxWidgets/nxwm/src/glyph_play.cxx b/NxWidgets/nxwm/src/glyph_play.cxx index a6970b2e0..1c6ce8cd9 100644 --- a/NxWidgets/nxwm/src/glyph_play.cxx +++ b/NxWidgets/nxwm/src/glyph_play.cxx @@ -60,6 +60,8 @@ #define BITMAP_NCOLUMNS 25 #define BITMAP_NLUTCODES 6 +#define DARK_PLAY_ICON 1 + /******************************************************************************************** * Private Bitmap Data ********************************************************************************************/ @@ -69,6 +71,21 @@ using namespace NxWM; /* RGB24 (8-8-8) Colors */ #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 +# ifdef DARK_PLAY_ICON + +static const uint32_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x00a200, 0x006300, 0x004e00, 0x008100, 0x003600 /* Codes 1-5 */ +}; + +static const uint32_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x00d800, 0x008400, 0x006800, 0x00ac00, 0x004800, /* Codes 1-5 */ +}; + +# else /* DARK_PLAY_ICON */ static const uint32_t g_playNormalLut[BITMAP_NLUTCODES] = { @@ -81,9 +98,26 @@ static const uint32_t g_playBrightlLut[BITMAP_NLUTCODES] = CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ 0x3fe13f, 0x3fa23f, 0x3f8d3f, 0x3fc03f, 0x3f753f /* Codes 1-5 */ }; +# endif /* DARK_PLAY_ICON */ + /* RGB16 (565) Colors (four of the colors in this map are duplicates) */ #elif CONFIG_NXWIDGETS_BPP == 16 +# ifdef DARK_PLAY_ICON + +static const uint16_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x0500, 0x0300, 0x0260, 0x0400, 0x01a0 /* Codes 1-5 */ +}; + +static const uint16_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x06c0, 0x0420, 0x0340, 0x0560, 0x0240, /* Codes 1-5 */ +}; + +# else /* DARK_PLAY_ICON */ static const uint16_t g_playNormalLut[BITMAP_NLUTCODES] = { @@ -97,6 +131,8 @@ static const uint16_t g_playBrightlLut[BITMAP_NLUTCODES] = 0x3f07, 0x3d07, 0x3c67, 0x3e07, 0x3ba7, /* Codes 0-5 */ }; +# endif /* DARK_PLAY_ICON */ + /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used * to lookup an 8-bit value. There is no savings in that! It would be better to just put * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these @@ -109,6 +145,22 @@ static const uint16_t g_playBrightlLut[BITMAP_NLUTCODES] = /* 8-bit Greyscale */ +# ifdef DARK_PLAY_ICON + +static const uint8_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x5f, 0x3a, 0x2d, 0x4b, 0x1f /* Codes 1-5 */ +}; + +static const uint8_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x7e, 0x4d, 0x3d, 0x64, 0x2a /* Codes 1-5 */ +}; + +# else /* DARK_PLAY_ICON */ + static const uint8_t g_playNormalLut[BITMAP_NLUTCODES] = { CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ @@ -121,10 +173,26 @@ static const uint8_t g_playBrightlLut[BITMAP_NLUTCODES] = 0x9e, 0x79, 0x6c, 0x8a, 0x5e /* Codes 1-5 */ }; +# endif /* DARK_PLAY_ICON */ # else /* CONFIG_NXWIDGETS_GREYSCALE */ /* RGB8 (332) Colors */ +# ifdef DARK_PLAY_ICON +static const nxgl_mxpixel_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x14, 0x0c, 0x08, 0x10, 0x04 /* Codes 1-5 */ +}; + +static const nxgl_mxpixel_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x18, 0x10, 0x0c, 0x14, 0x08 /* Codes 1-5 */ +}; + +# else /* DARK_PLAY_ICON */ + static const nxgl_mxpixel_t g_playNormalLut[BITMAP_NLUTCODES] = { CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ @@ -137,7 +205,8 @@ static const nxgl_mxpixel_t g_playBrightlLut[BITMAP_NLUTCODES] = 0x3c, 0x34, 0x30, 0x38, 0x2c /* Codes 0-5 */ }; -# endif +# endif /* DARK_PLAY_ICON */ +# endif /* CONFIG_NXWIDGETS_GREYSCALE */ #else # error "Unsupport pixel format" #endif |