apps/graphics/twm4nx: Add logic to hide the window when it is iconified and restore the window when it is de-iconfied. Iconification works, de-iconification does not.

This commit is contained in:
Gregory Nutt 2019-05-05 15:23:50 -06:00
parent 1e4dfd7193
commit 1879949cdc
10 changed files with 157 additions and 60 deletions

View File

@ -332,32 +332,6 @@ bool CNxTkWindow::setSize(FAR const struct nxgl_size_s *size)
return nxtk_setsize(m_hNxTkWindow, size) == OK;
}
/**
* Bring the window to the top of the display.
*
* @return True on success, false on any failure.
*/
bool CNxTkWindow::raise(void)
{
// Raise the window to the top of the display
return nxtk_raise(m_hNxTkWindow) == OK;
}
/**
* Lower the window to the bottom of the display.
*
* @return True on success, false on any failure.
*/
bool CNxTkWindow::lower(void)
{
// Lower the window to the bottom of the display
return nxtk_lower(m_hNxTkWindow) == OK;
}
/**
* May be used to either (1) raise a window to the top of the display and
* select modal behavior, or (2) disable modal behavior.

View File

@ -193,32 +193,6 @@ bool CNxWindow::setSize(FAR const struct nxgl_size_s *pSize)
return nx_setsize(m_hNxWindow, pSize) == OK;
}
/**
* Bring the window to the top of the display.
*
* @return True on success, false on any failure.
*/
bool CNxWindow::raise(void)
{
// Raise the window to the top of the display
return nx_raise(m_hNxWindow) == OK;
}
/**
* Lower the window to the bottom of the display.
*
* @return True on success, false on any failure.
*/
bool CNxWindow::lower(void)
{
// Lower the window to the bottom of the display
return nx_lower(m_hNxWindow) == OK;
}
/**
* May be used to either (1) raise a window to the top of the display and
* select modal behavior, or (2) disable modal behavior.

View File

@ -513,6 +513,7 @@ int CInput::scaleTouchData(FAR const struct touch_point_s &raw,
twminfo("raw: (%6.2f, %6.2f) scaled: (%6.2f, %6.2f) (%d, %d)\n",
raw.x, raw.y, scaledX, scaledY, scaled.x, scaled.y);
return OK;
#else
// Get the fixed precision, scaled X and Y values
@ -559,6 +560,7 @@ int CInput::scaleTouchData(FAR const struct touch_point_s &raw,
twminfo("raw: (%d, %d) scaled: (%d, %d)\n",
raw.x, raw.y, scaled.x, scaled.y);
return OK;
#endif
}
#endif

View File

@ -481,10 +481,12 @@ void CWindow::iconify(void)
m_modal = false;
m_nxWin->modal(false);
// Enable and redraw the icon widget and lower the main window
// Hide the main window
m_iconified = true;
m_nxWin->lower();
m_nxWin->hide();
// Enable and redraw the icon widget and lower the main window
m_iconOn = true;
m_iconWidget->enable();
@ -501,10 +503,12 @@ void CWindow::deIconify(void)
if (isIconified())
{
// Raise the main window and hide the icon width
// Raise and the main window
m_iconified = false;
m_nxWin->raise();
m_nxWin->show();
// Hide the icon widget
m_iconOn = false;
m_iconWidget->disableDrawing();

View File

@ -228,6 +228,32 @@ namespace NXWidgets
return false;
}
/**
* Show a hidden window
*
* @return Always returns false.
*/
inline bool show(void)
{
// The background is always visible (although perhaps obscured)
return false;
}
/**
* Hide a visible window
*
* @return Always returns false.
*/
inline bool hide(void)
{
// The background cannot be hidden
return false;
}
/**
* May be used to either (1) raise a window to the top of the display and
* select modal behavior, or (2) disable modal behavior. NOTE: The

View File

@ -232,7 +232,10 @@ namespace NXWidgets
* @return True on success, false on any failure.
*/
bool raise(void);
inline bool raise(void)
{
return nxtk_raise(m_hNxTkWindow) == OK;
}
/**
* Lower the window to the bottom of the display.
@ -240,7 +243,32 @@ namespace NXWidgets
* @return True on success, false on any failure.
*/
bool lower(void);
inline bool lower(void)
{
return nxtk_lower(m_hNxTkWindow) == OK;
}
/**
* Show a hidden window
*
* @return True on success, false on any failure.
*/
inline bool show(void)
{
return nxtk_setvisibility(m_hNxTkWindow, false) == OK;
}
/**
* Hide a visible window
*
* @return True on success, false on any failure.
*/
inline bool hide(void)
{
return nxtk_setvisibility(m_hNxTkWindow, true) == OK;
}
/**
* May be used to either (1) raise a window to the top of the display and

View File

@ -221,6 +221,34 @@ namespace NXWidgets
return false;
}
/**
* Show a hidden window. The toolbar is a component of the containing,
* parent, framed window. It cannot be shown separately.
*
* @return Always returns false.
*/
inline bool show(void)
{
// The background is always visible (although perhaps obscured)
return false;
}
/**
* Hide a visible window. The toolbar is a component of the containing,
* parent, framed window. It cannot be hidden separately.
*
* @return Always returns false.
*/
inline bool hide(void)
{
// The background cannot be hidden
return false;
}
/**
* May be used to either (1) raise a window to the top of the display and
* select modal behavior, or (2) disable modal behavior. The toolbar is

View File

@ -201,7 +201,10 @@ namespace NXWidgets
* @return True on success, false on any failure.
*/
bool raise(void);
inline bool raise(void)
{
return nx_raise(m_hNxWindow) == OK;
}
/**
* Lower the window to the bottom of the display.
@ -209,7 +212,32 @@ namespace NXWidgets
* @return True on success, false on any failure.
*/
bool lower(void);
inline bool lower(void)
{
return nx_lower(m_hNxWindow) == OK;
}
/**
* Show a hidden window
*
* @return True on success, false on any failure.
*/
inline bool show(void)
{
return nx_setvisibility(m_hNxWindow, false) == OK;
}
/**
* Hide a visible window
*
* @return True on success, false on any failure.
*/
inline bool hide(void)
{
return nx_setvisibility(m_hNxWindow, true) == OK;
}
/**
* May be used to either (1) raise a window to the top of the display and

View File

@ -190,6 +190,22 @@ namespace NXWidgets
virtual bool lower(void) = 0;
/**
* Show a hidden window
*
* @return True on success, false on any failure.
*/
virtual bool show(void) = 0;
/**
* Hide a visible window
*
* @return True on success, false on any failure.
*/
virtual bool hide(void) = 0;
/**
* May be used to either (1) raise a window to the top of the display and
* select modal behavior, or (2) disable modal behavior.

View File

@ -469,6 +469,23 @@ namespace Twm4Nx
return m_nxWin->lower();
}
/**
* Show a hidden window
*/
inline bool showWindow(void)
{
return m_nxWin->show();
}
/**
* Hide a visible window
*/
inline bool hideWindow(void)
{
return m_nxWin->hide();
}
/**
* Convert the position of a primary window to the position of
* the containing frame.