diff options
Diffstat (limited to 'NxWidgets/nxwm/src/ctaskbar.cxx')
-rw-r--r-- | NxWidgets/nxwm/src/ctaskbar.cxx | 145 |
1 files changed, 78 insertions, 67 deletions
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; } /** |