diff --git a/graphics/twm4nx/src/ciconwidget.cxx b/graphics/twm4nx/src/ciconwidget.cxx index cee92f75e..49636e514 100644 --- a/graphics/twm4nx/src/ciconwidget.cxx +++ b/graphics/twm4nx/src/ciconwidget.cxx @@ -181,7 +181,12 @@ bool CIconWidget::initialize(FAR NXWidgets::IBitmap *ibitmap, return false; } + // Configure the image + image->setBorderless(true); + image->disable(); + image->disableDrawing(); + image->setRaisesEvents(true); // Get the position icon text, centering horizontally if the image // width is larger than the text width @@ -208,7 +213,13 @@ bool CIconWidget::initialize(FAR NXWidgets::IBitmap *ibitmap, return false; } + // Configure the icon label + + label->setFont(iconFont); label->setBorderless(true); + label->disable(); + label->disableDrawing(); + label->setRaisesEvents(true); // Add the CImage to to the containing widget @@ -578,16 +589,3 @@ bool CIconWidget::iconUngrab(FAR struct SEventMsg *eventmsg) m_twm4nx->setCursorImage(&CONFIG_TWM4NX_CURSOR_IMAGE); return false; } - -/** - * Draw the area of this widget that falls within the clipping region. - * Called by the redraw() function to draw all visible regions. - * @param port The NXWidgets::CGraphicsPort to draw to. - * @see redraw() - */ - -void CIconWidget::drawContents(NXWidgets::CGraphicsPort *port) -{ - port->drawFilledRect(getX(), getY(), getWidth(), getHeight(), - getBackgroundColor()); -} diff --git a/graphics/twm4nx/src/cwindow.cxx b/graphics/twm4nx/src/cwindow.cxx index 10561f683..5c93ad0a0 100644 --- a/graphics/twm4nx/src/cwindow.cxx +++ b/graphics/twm4nx/src/cwindow.cxx @@ -332,7 +332,15 @@ bool CWindow::initialize(FAR const char *name, return false; } - enableWidgets(); + // Initialize the icon widget + + m_iconWidget->disable(); + m_iconWidget->disableDrawing(); + m_iconWidget->setRaisesEvents(true); + + // Re-enable toolbar widgets + + enableToolbarWidgets(); return true; } @@ -473,11 +481,16 @@ void CWindow::iconify(void) m_modal = false; m_nxWin->modal(false); - // Raise the icon window and lower the main window + // Enable and redraw the icon widget and lower the main window m_iconified = true; m_nxWin->lower(); + m_iconOn = true; + m_iconWidget->enable(); + m_iconWidget->enableDrawing(); + m_iconWidget->redraw(); + m_nxWin->synchronize(); } } @@ -488,11 +501,15 @@ void CWindow::deIconify(void) if (isIconified()) { - // Raise the main window and lower the icon window + // Raise the main window and hide the icon width m_iconified = false; m_nxWin->raise(); + m_iconOn = false; + m_iconWidget->disableDrawing(); + m_iconWidget->disable(); + m_nxWin->synchronize(); } } @@ -769,9 +786,9 @@ bool CWindow::createToolbar(void) bool CWindow::updateToolbarLayout(void) { - // Disable widget drawing and events while we do this + // Disable toolbar widget drawing and events while we do this - disableWidgets(); + disableToolbarWidgets(); // Reposition all right buttons. Change the width of the // toolbar does not effect the left side spacing. @@ -819,15 +836,15 @@ bool CWindow::updateToolbarLayout(void) titleSize.w = m_tbRightX - m_tbLeftX - CONFIG_TWM4NX_FRAME_VSPACING + 1; bool success = m_tbTitle->resize(titleSize.w, titleSize.h); - enableWidgets(); + enableToolbarWidgets(); return success; } /** - * Disable widget drawing and widget events. + * Disable toolbar widget drawing and widget events. */ -bool CWindow::disableWidgets(void) +bool CWindow::disableToolbarWidgets(void) { for (int btindex = 0; btindex < NTOOLBAR_BUTTONS; btindex++) { @@ -845,10 +862,10 @@ bool CWindow::disableWidgets(void) } /** - * Enable widget drawing and widget events. + * Enable toolbar widget drawing and widget events. */ -bool CWindow::enableWidgets(void) +bool CWindow::enableToolbarWidgets(void) { for (int btindex = 0; btindex < NTOOLBAR_BUTTONS; btindex++) { @@ -1434,7 +1451,7 @@ bool CWindow::toolbarUngrab(FAR struct SEventMsg *eventmsg) // Restore the normal cursor image m_twm4nx->setCursorImage(&CONFIG_TWM4NX_CURSOR_IMAGE); - return false; + return true; } /** diff --git a/include/graphics/twm4nx/ciconwidget.hxx b/include/graphics/twm4nx/ciconwidget.hxx index e8a1f782d..7bf3d96f5 100644 --- a/include/graphics/twm4nx/ciconwidget.hxx +++ b/include/graphics/twm4nx/ciconwidget.hxx @@ -187,15 +187,6 @@ namespace Twm4Nx bool iconUngrab(FAR struct SEventMsg *eventmsg); - /** - * Draw the area of this widget that falls within the clipping region. - * Called by the redraw() function to draw all visible regions. - * @param port The NXWidgets::CGraphicsPort to draw to. - * @see redraw() - */ - - void drawContents(NXWidgets::CGraphicsPort* port); - /** * Copy constructor is protected to prevent usage. */ diff --git a/include/graphics/twm4nx/cwindow.hxx b/include/graphics/twm4nx/cwindow.hxx index e2395d11e..b28d6d93c 100644 --- a/include/graphics/twm4nx/cwindow.hxx +++ b/include/graphics/twm4nx/cwindow.hxx @@ -214,16 +214,16 @@ namespace Twm4Nx bool updateToolbarLayout(void); /** - * Disable widget drawing and widget events. + * Disable toolbar widget drawing and widget events. */ - bool disableWidgets(void); + bool disableToolbarWidgets(void); /** - * Enable widget drawing and widget events. + * Enable toolbar widget drawing and widget events. */ - bool enableWidgets(void); + bool enableToolbarWidgets(void); /** * After the toolbar was grabbed, it may be dragged then dropped, or it