diff options
Diffstat (limited to 'NxWidgets/nxwm/src/capplicationwindow.cxx')
-rw-r--r-- | NxWidgets/nxwm/src/capplicationwindow.cxx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx index c11f40090..8395c93ab 100644 --- a/NxWidgets/nxwm/src/capplicationwindow.cxx +++ b/NxWidgets/nxwm/src/capplicationwindow.cxx @@ -41,6 +41,10 @@ #include <nuttx/nx/nxglib.h> +#include "nxconfig.hxx" +#include "cwidgetcontrol.hxx" +#include "cgraphicsport.hxx" + #include "nxwmconfig.hxx" #include "nxwmglyphs.hxx" #include "capplicationwindow.hxx" @@ -224,6 +228,7 @@ bool CApplicationWindow::open(void) // Configure 'this' to receive mouse click inputs from the image + m_stopImage->setBorderless(true); m_stopImage->addWidgetEventHandler(this); // Create MINIMIZE application bitmap container @@ -272,6 +277,7 @@ bool CApplicationWindow::open(void) // Configure 'this' to receive mouse click inputs from the image + m_minimizeImage->setBorderless(true); m_minimizeImage->addWidgetEventHandler(this); // The rest of the toolbar will hold the left-justified application label @@ -312,6 +318,69 @@ bool CApplicationWindow::open(void) } /** + * Re-draw the application window + */ + +void CApplicationWindow::redraw(void) +{ + // Get the widget control from the task bar + + NXWidgets::CWidgetControl *control = m_toolbar->getWidgetControl(); + + // Get the graphics port for drawing on the background window + + NXWidgets::CGraphicsPort *port = control->getGraphicsPort(); + + // Get the size of the window + + struct nxgl_size_s windowSize; + if (!m_toolbar->getSize(&windowSize)) + { + return; + } + + // Fill the entire tool bar with the non-shadowed border color + + port->drawFilledRect(0, 0, windowSize.w, windowSize.h, + CONFIG_NXTK_BORDERCOLOR1); + + // Then draw the images + + m_stopImage->enableDrawing(); + m_stopImage->redraw(); + m_stopImage->setRaisesEvents(true); + + m_minimizeImage->enableDrawing(); + m_minimizeImage->redraw(); + m_minimizeImage->setRaisesEvents(true); + + // And draw the window label + + m_windowLabel->enableDrawing(); + m_windowLabel->redraw(); +} + +/** + * The application window is hidden (either it is minimized or it is + * maximized, but not at the top of the hierarchy) + */ + +void CApplicationWindow::hide(void) +{ + // Disable the images + + m_stopImage->disableDrawing(); + m_stopImage->setRaisesEvents(false); + + m_minimizeImage->disableDrawing(); + m_minimizeImage->setRaisesEvents(false); + + // Disable the window label + + m_windowLabel->disableDrawing(); +} + +/** * Handle a mouse button click event. * * @param e The event data. |