diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-02 14:38:54 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-02 14:38:54 +0000 |
commit | addae64d8c028ffd2c3bb05ec7ebdd1a73720998 (patch) | |
tree | 1b921ee8364e6156ee58ee1b85b34a91a69aa435 /NxWidgets/nxwm | |
parent | 1c9fc6cb19e21749c86389b13196075b97deab73 (diff) | |
download | px4-nuttx-addae64d8c028ffd2c3bb05ec7ebdd1a73720998.tar.gz px4-nuttx-addae64d8c028ffd2c3bb05ec7ebdd1a73720998.tar.bz2 px4-nuttx-addae64d8c028ffd2c3bb05ec7ebdd1a73720998.zip |
NxWM initial displays come up okay
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4687 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/nxwm')
-rw-r--r-- | NxWidgets/nxwm/include/ctaskbar.hxx | 11 | ||||
-rw-r--r-- | NxWidgets/nxwm/include/nxwmconfig.hxx | 28 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/capplicationwindow.cxx | 2 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/ctaskbar.cxx | 145 |
4 files changed, 93 insertions, 93 deletions
diff --git a/NxWidgets/nxwm/include/ctaskbar.hxx b/NxWidgets/nxwm/include/ctaskbar.hxx index f5bef2054..994b918ae 100644 --- a/NxWidgets/nxwm/include/ctaskbar.hxx +++ b/NxWidgets/nxwm/include/ctaskbar.hxx @@ -166,6 +166,14 @@ namespace NxWM bool redrawTaskbarWindow(void); /** + * Redraw the window at the top of the heirarchy. + * + * @return true on success + */ + + bool redrawTopWindow(void); + + /** * (Re-)draw the background window. * * @return true on success @@ -177,10 +185,11 @@ namespace NxWM * Redraw the last application in the list of application maintained by * the task bar. * + * @param app. The new top application to draw * @return true on success */ - bool redrawApplicationWindow(void); + bool redrawApplicationWindow(IApplication *app); /** * Handle a mouse button click event. diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx index cfdd7510e..59ae1e79d 100644 --- a/NxWidgets/nxwm/include/nxwmconfig.hxx +++ b/NxWidgets/nxwm/include/nxwmconfig.hxx @@ -100,13 +100,9 @@ * Color configuration * * CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default: - * MKRGB(160,160,160) + * MKRGB(148,189,215) * CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR - Select background color. - * Default: MKRGB(120,192,192) - * CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR - Normal "foreground" color. Default: - * MKRGB(192,192,192) - * CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR - Selected "foreground" color. - * Default: MKRGB(192,192,192) + * Default: MKRGB(206,227,241) * CONFIG_NXWM_DEFAULT_SHINEEDGECOLOR - Color of the bright edge of a border. * Default: MKRGB(255,255,255) * CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR - Color of the shadowed edge of a border. @@ -122,7 +118,7 @@ */ #ifndef CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR -# define CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR MKRGB(160,160,160) +# define CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR MKRGB(148,189,215) #endif /** @@ -130,23 +126,7 @@ */ #ifndef CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR -# define CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(120,192,192) -#endif - -/** - * Default foreground color - */ - -#ifndef CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR -# define CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR MKRGB(192,192,192) -#endif - -/** - * Default selected foreground color - */ - -#ifndef CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR -# define CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR MKRGB(248,248,248) +# define CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(206,227,241) #endif /** diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx index 8fd578c1a..c11f40090 100644 --- a/NxWidgets/nxwm/src/capplicationwindow.cxx +++ b/NxWidgets/nxwm/src/capplicationwindow.cxx @@ -168,7 +168,7 @@ bool CApplicationWindow::open(void) // Get the CWidgetControl associated with this window NXWidgets::CWidgetControl *control = m_toolbar->getWidgetControl(); - if (control) + if (!control) { return false; } diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx index 1dba90c5a..7630a29b5 100644 --- a/NxWidgets/nxwm/src/ctaskbar.cxx +++ b/NxWidgets/nxwm/src/ctaskbar.cxx @@ -232,9 +232,9 @@ bool CTaskbar::startWindowManager(void) return false; } - // Draw the application window + // Draw the top application window - return redrawApplicationWindow(); + return redrawTopWindow(); } /** @@ -368,27 +368,9 @@ bool CTaskbar::topApplication(IApplication *app) if (!app->isMinimized()) { - // Every application provides a method to obtain its application window - - CApplicationWindow *appWindow = app->getWindow(); - - // Each application window provides a method to get the underlying NX window - - NXWidgets::CNxTkWindow *window = appWindow->getWindow(); - - // Mark the window as the top application - - m_topapp = app; - app->setTopApplication(true); - - // Raise the window to the top of the hierarchy - - window->raise(); - - // And re-draw it + // It is not... Make the application the top application and redraw it - app->redraw(); - return true; + return redrawApplicationWindow(app); } return false; @@ -441,7 +423,7 @@ bool CTaskbar::minimizeApplication(IApplication *app) app->setMinimized(true); // And it certainly is no longer the top application. If it was before - // then redrawApplicationWindow() will pick a new one (rather arbitrarily). + // then redrawTopWindow() will pick a new one (rather arbitrarily). if (app->isTopApplication()) { @@ -453,9 +435,9 @@ bool CTaskbar::minimizeApplication(IApplication *app) window->lower(); - // And re-draw the next non-minimized application + // And re-draw the new top, non-minimized application - return redrawApplicationWindow(); + return redrawTopWindow(); } return false; @@ -708,10 +690,6 @@ bool CTaskbar::createTaskbarWindow(void) m_taskbar->setPosition(&pos); m_taskbar->setSize(&size); - - /* And raise the window to the top of the display */ - - m_taskbar->raise(); return true; } @@ -734,10 +712,6 @@ bool CTaskbar::createBackgroundWindow(void) // Set the geometry to fit in the application window space setApplicationGeometry(static_cast<NXWidgets::INxWindow*>(m_background)); - - /* The background window starts at the top display */ - - m_background->raise(); return true; } @@ -932,6 +906,50 @@ bool CTaskbar::redrawTaskbarWindow(void) } /** + * Redraw the window at the top of the heirarchy. + * + * @return true on success + */ + +bool CTaskbar::redrawTopWindow(void) +{ + // Check if there is already a top application + + IApplication *app = m_topapp; + if (!app) + { + // No.. Search for that last, non-minimized application + + for (int i = m_slots.size() - 1; i >= 0; i--) + { + IApplication *candidate = m_slots.at(i).app; + if (!candidate->isMinimized()) + { + app = candidate; + break; + } + } + } + + // Did we find one? + + if (app) + { + // Yes.. make it the top application window and redraw it + + return redrawApplicationWindow(app); + return true; + } + else + { + // Otherwise, there is no top application. Re-draw the background image. + + m_topapp = (IApplication *)0; + return redrawBackgroundWindow(); + } +} + +/** * (Re-)draw the background window. * * @return true on success @@ -955,11 +973,21 @@ bool CTaskbar::redrawBackgroundWindow(void) return false; } + // Raise the background window to the top of the display + + m_background->raise(); + // Fill the entire window with the background color port->drawFilledRect(0, 0, windowSize.w, windowSize.h, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR); + // Add a border to the task bar to delineate it from the task bar + + port->drawBevelledRect(0, 0, windowSize.w, windowSize.h, + CONFIG_NXWM_DEFAULT_SHINEEDGECOLOR, + CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR); + // Then re-draw the background image on the window m_backImage->enableDrawing(); @@ -971,54 +999,37 @@ bool CTaskbar::redrawBackgroundWindow(void) * Redraw the last application in the list of application maintained by * the task bar. * + * @param app. The new top application to draw * @return true on success */ -bool CTaskbar::redrawApplicationWindow(void) +bool CTaskbar::redrawApplicationWindow(IApplication *app) { - // Check if there is already a top application + // Every application provides a method to obtain its application window - IApplication *app = m_topapp; - if (!app) - { - // No.. Search for that last, non-minimized application + CApplicationWindow *appWindow = app->getWindow(); - for (int i = m_slots.size() - 1; i >= 0; i--) - { - IApplication *candidate = m_slots.at(i).app; - if (!candidate->isMinimized()) - { - app = candidate; - break; - } - } - } + // Each application window provides a method to get the underlying NX window - // Did we find one? + NXWidgets::CNxTkWindow *window = appWindow->getWindow(); - if (app) - { - // Yes.. Then this is the new top application + // Mark the window as the top application - m_topapp = app; - app->setTopApplication(true); + m_topapp = app; + app->setTopApplication(true); - // Disable drawing of the background image. + // Disable drawing of the background image. - m_backImage->disableDrawing(); + m_backImage->disableDrawing(); - // And.. Draw the application + // Raise the window to the top of the hierarchy - app->redraw(); - return true; - } - else - { - // Otherwise, re-draw the background image + window->raise(); - m_topapp = (IApplication *)0; - return redrawBackgroundWindow(); - } + // And re-draw it + + app->redraw(); + return true; } /** |