graphics/nxwidgets and inclu/graphics/nxwidgets: Add support for modal windows.
This commit is contained in:
parent
5a693020b8
commit
ef26c25994
graphics/nxwidgets/src
include/graphics/nxwidgets
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/graphics/nxwidgets/src/cbgwindow.cxx
|
||||
*
|
||||
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2015, 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -202,34 +202,6 @@ bool CBgWindow::setSize(FAR const struct nxgl_size_s *pSize)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bring the window to the top of the display. NOTE: The background
|
||||
* window cannot be raised.
|
||||
*
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool CBgWindow::raise(void)
|
||||
{
|
||||
// The background cannot be raised
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower the window to the bottom of the display. NOTE: The background
|
||||
* window is always at the bottom of the window hierarchy.
|
||||
*
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool CBgWindow::lower(void)
|
||||
{
|
||||
// The background cannot be lowered
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an individual pixel in the window with the specified color.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/graphics/nxwidgets/src/cnxtkwindow.cxx
|
||||
*
|
||||
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2015, 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -359,6 +359,21 @@ bool CNxTkWindow::lower(void)
|
||||
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.
|
||||
*
|
||||
* @param enable True: enter modal state; False: leave modal state
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
bool CNxTkWindow::modal(bool enable)
|
||||
{
|
||||
// Select/de-select window modal state
|
||||
|
||||
return nxtk_modal(m_hNxTkWindow, enable) == OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an individual pixel in the window with the specified color.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/graphics/nxwidgets/src/cnxtoolbar.cxx
|
||||
*
|
||||
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2015, 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -177,59 +177,6 @@ bool CNxToolbar::getSize(FAR struct nxgl_size_s *pSize)
|
||||
return m_widgetControl->getWindowSize(pSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position and size of the toolbar. The position of
|
||||
* the toolbar is fixed at the top of the parent framed window.
|
||||
*
|
||||
* @param pPos The new position of the toolbar.
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool CNxToolbar::setPosition(FAR const struct nxgl_point_s *pPos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the size of the selected toolbar. The only variable dimension
|
||||
* is the height of the toolbar, but that cannot be changed once
|
||||
* it is created.
|
||||
*
|
||||
* @param pSize The new size of the toolbar.
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool CNxToolbar::setSize(FAR const struct nxgl_size_s *pSize)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bring the toolbar to the top of the display. The toolbar is
|
||||
* a component of the containing, parent, framed window. It
|
||||
* cannot be raised separately.
|
||||
*
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool CNxToolbar::raise(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower the toolbar to the bottom of the display. The toolbar is
|
||||
* a component of the containing, parent, framed window. It
|
||||
* cannot be raised separately.
|
||||
*
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool CNxToolbar::lower(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an individual pixel in the toolbar with the specified color.
|
||||
*
|
||||
|
@ -215,6 +215,21 @@ bool CNxWindow::lower(void)
|
||||
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.
|
||||
*
|
||||
* @param enable True: enter modal state; False: leave modal state
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
bool CNxWindow::modal(bool enable)
|
||||
{
|
||||
// Select/de-select window modal state
|
||||
|
||||
return nx_modal(m_hNxWindow, enable) == OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an individual pixel in the window with the specified color.
|
||||
*
|
||||
|
@ -204,19 +204,45 @@ namespace NXWidgets
|
||||
* Bring the window to the top of the display. NOTE: The background
|
||||
* window cannot be raised.
|
||||
*
|
||||
* @return True on success, false on any failure.
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool raise(void);
|
||||
inline bool raise(void)
|
||||
{
|
||||
// The background cannot be raised
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower the window to the bottom of the display. NOTE: The background
|
||||
* window is always at the bottom of the window hierarchy.
|
||||
*
|
||||
* @return True on success, false on any failure.
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool lower(void);
|
||||
inline bool lower(void)
|
||||
{
|
||||
// The background cannot be lowered
|
||||
|
||||
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
|
||||
* background cannot be a modal window.
|
||||
*
|
||||
* @param enable True: enter modal state; False: leave modal state
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
inline bool modal(bool enable)
|
||||
{
|
||||
// The background cannot a modal window
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||
/**
|
||||
|
@ -239,6 +239,16 @@ namespace NXWidgets
|
||||
|
||||
bool lower(void);
|
||||
|
||||
/**
|
||||
* May be used to either (1) raise a window to the top of the display and
|
||||
* select modal behavior, or (2) disable modal behavior.
|
||||
*
|
||||
* @param enable True: enter modal state; False: leave modal state
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
bool modal(bool enable);
|
||||
|
||||
/**
|
||||
* Each window implementation also inherits from CCallback. CCallback,
|
||||
* by default, forwards NX keyboard input to the various widgets residing
|
||||
|
@ -176,17 +176,24 @@ namespace NXWidgets
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool setPosition(FAR const struct nxgl_point_s *pPos);
|
||||
inline bool setPosition(FAR const struct nxgl_point_s *pPos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position and size of the toolbar. The position of
|
||||
* the toolbar is fixed at the top of the parent framed window.
|
||||
* Set the size of the selected toolbar. The only variable dimension
|
||||
* is the height of the toolbar, but that cannot be changed once
|
||||
* it is created.
|
||||
*
|
||||
* @param pPos The new position of the toolbar.
|
||||
* @param pSize The new size of the toolbar.
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool setSize(FAR const struct nxgl_size_s *pSize);
|
||||
inline bool setSize(FAR const struct nxgl_size_s *pSize)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bring the toolbar to the top of the display. The toolbar is
|
||||
@ -196,17 +203,38 @@ namespace NXWidgets
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool raise(void);
|
||||
inline bool raise(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower the toolbar to the bottom of the display. The toolbar is
|
||||
* a component of the containing, parent, framed window. It
|
||||
* cannot be lowered separately.
|
||||
* cannot be raised separately.
|
||||
*
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
bool lower(void);
|
||||
inline bool lower(void)
|
||||
{
|
||||
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
|
||||
* a component of the containing, parent, framed window. It cannot
|
||||
* be placed in the modal state separately.
|
||||
*
|
||||
* @param enable True: enter modal state; False: leave modal state
|
||||
* @return Always returns false.
|
||||
*/
|
||||
|
||||
inline bool modal(bool enable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Each window implementation also inherits from CCallback. CCallback,
|
||||
|
@ -212,6 +212,16 @@ namespace NXWidgets
|
||||
|
||||
bool lower(void);
|
||||
|
||||
/**
|
||||
* May be used to either (1) raise a window to the top of the display and
|
||||
* select modal behavior, or (2) disable modal behavior.
|
||||
*
|
||||
* @param enable True: enter modal state; False: leave modal state
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
bool modal(bool enable);
|
||||
|
||||
/**
|
||||
* Each window implementation also inherits from CCallback. CCallback,
|
||||
* by default, forwards NX keyboard input to the various widgets residing
|
||||
|
@ -150,7 +150,8 @@ namespace NXWidgets
|
||||
/**
|
||||
* Get the size of the window (as reported by the NX callback).
|
||||
*
|
||||
* @return The size.
|
||||
* @param pSize The location to return window size.
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
virtual bool getSize(FAR struct nxgl_size_s *pSize) = 0;
|
||||
@ -159,7 +160,7 @@ namespace NXWidgets
|
||||
* Set the position and size of the window.
|
||||
*
|
||||
* @param pPos The new position of the window.
|
||||
* @return True on success, false on failure.
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
virtual bool setPosition(FAR const struct nxgl_point_s *pPos) = 0;
|
||||
@ -168,7 +169,7 @@ namespace NXWidgets
|
||||
* Set the size of the selected window.
|
||||
*
|
||||
* @param pSize The new size of the window.
|
||||
* @return OK on success; ERROR on failure with errno set appropriately.
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
virtual bool setSize(FAR const struct nxgl_size_s *pSize) = 0;
|
||||
@ -176,7 +177,7 @@ namespace NXWidgets
|
||||
/**
|
||||
* Bring the window to the top of the display.
|
||||
*
|
||||
* @return OK on success; ERROR on failure with errno set appropriately.
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
virtual bool raise(void) = 0;
|
||||
@ -184,11 +185,21 @@ namespace NXWidgets
|
||||
/**
|
||||
* Lower the window to the bottom of the display.
|
||||
*
|
||||
* @return OK on success; ERROR on failure with errno set appropriately.
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
virtual bool lower(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.
|
||||
*
|
||||
* @param enable True: enter modal state; False: leave modal state
|
||||
* @return True on success, false on any failure.
|
||||
*/
|
||||
|
||||
virtual bool modal(bool enable) = 0;
|
||||
|
||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||
/**
|
||||
* Each window implementation also inherits from CCallback. CCallback,
|
||||
|
Loading…
x
Reference in New Issue
Block a user