graphics/, lib/libnx, include/nutt/nx: Add support for modal windows.

This commit is contained in:
Gregory Nutt
2019-04-05 08:24:46 -06:00
parent cc5c59b8a6
commit 0b3375cb78
22 changed files with 516 additions and 90 deletions
+19 -1
View File
@@ -653,7 +653,7 @@ int nx_raise(NXWINDOW hwnd);
* Lower the specified window to the bottom of the display.
*
* Input Parameters:
* hwnd - the window to be lowered
* hwnd - The window to be lowered
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
@@ -662,6 +662,24 @@ int nx_raise(NXWINDOW hwnd);
int nx_lower(NXWINDOW hwnd);
/****************************************************************************
* Name: nx_modal
*
* Description:
* May be used to either (1) raise a window to the top of the display and
* select modal behavior, or (2) disable modal behavior.
*
* Input Parameters:
* hwnd - The window to be modified
* modal - True: enter modal state; False: leave modal state
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
int nx_modal(NXWINDOW hwnd, bool modal);
/****************************************************************************
* Name: nx_setpixel
*
+14 -4
View File
@@ -67,13 +67,16 @@
/* Window flags and helper macros:
*
* NXBE_WINDOW_BLOCKED - Window input is blocked (internal use only)
* NXBE_WINDOW_FRAMED - Framed (NxTK) Window
* NXBE_WINDOW_RAMBACKED - Window is backed by a framebuffer
* NXBE_WINDOW_MODAL - Window is in a focused, modal state
*/
#define NXBE_WINDOW_BLOCKED (1 << 0) /* The window is blocked and will not
* receive further input. */
#define NXBE_WINDOW_FRAMED (1 << 1) /* Framed (NxTK) Window */
#define NXBE_WINDOW_RAMBACKED (1 << 2) /* Window is backed by a framebuffer */
#define NXBE_WINDOW_BLOCKED (1 << 0) /* Bit 0: The window is blocked and will
* not receive further input. */
#define NXBE_WINDOW_FRAMED (1 << 1) /* Bit 1: Framed (NxTK) Window */
#define NXBE_WINDOW_RAMBACKED (1 << 2) /* Bit 2: Window is backed by a framebuffer */
#define NXBE_WINDOW_MODAL (1 << 3) /* Bit 3: Window is in a focused, modal state */
/* Valid user flags for different window types */
@@ -110,6 +113,13 @@
#define NXBE_CLRRAMBACKED(wnd) \
do { (wnd)->flags &= ~NXBE_WINDOW_RAMBACKED; } while (0)
#define NXBE_ISMODAL(wnd) \
(((wnd)->flags & NXBE_WINDOW_MODAL) != 0)
#define NXBE_SETMODAL(wnd) \
do { (wnd)->flags |= NXBE_WINDOW_MODAL; } while (0)
#define NXBE_CLRMODAL(wnd) \
do { (wnd)->flags &= ~NXBE_WINDOW_MODAL; } while (0)
/****************************************************************************
* Public Types
****************************************************************************/
+13 -1
View File
@@ -147,6 +147,7 @@ enum nxmsg_e
NX_SVRMSG_GETPOSITION, /* Get the current window position and size */
NX_SVRMSG_RAISE, /* Move the window to the top */
NX_SVRMSG_LOWER, /* Move the window to the bottom */
NX_SVRMSG_MODAL, /* Select/de-slect window modal state */
NX_SVRMSG_SETPIXEL, /* Set a single pixel in the window with a color */
NX_SVRMSG_FILL, /* Fill a rectangle in the window with a color */
NX_SVRMSG_GETRECTANGLE, /* Get a rectangular region in the window */
@@ -350,7 +351,18 @@ struct nxsvrmsg_raise_s
struct nxsvrmsg_lower_s
{
uint32_t msgid; /* NX_SVRMSG_LOWER */
FAR struct nxbe_window_s *wnd; /* The window to be lowered */
FAR struct nxbe_window_s *wnd; /* The window to be lowered */
};
/* This message either (1) raises a window to the top of the display and
* selects the modal state, or (2) de-selects the modal state.
*/
struct nxsvrmsg_modal_s
{
uint32_t msgid; /* NX_SVRMSG_MODAL */
FAR struct nxbe_window_s *wnd; /* The window to be modified */
bool modal; /* True: enter modal state; False: leave modal state */
};
/* Set a single pixel in the window with a color */
+18
View File
@@ -328,6 +328,24 @@ int nxtk_raise(NXTKWINDOW hfwnd);
int nxtk_lower(NXTKWINDOW hfwnd);
/****************************************************************************
* Name: nxtk_modal
*
* Description:
* May be used to either (1) raise a window to the top of the display and
* select modal behavior, or (2) disable modal behavior.
*
* Input Parameters:
* hfwnd - The window to be modified
* modal - True: enter modal state; False: leave modal state
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
int nxtk_modal(NXTKWINDOW hfwnd, bool modal);
/****************************************************************************
* Name: nxtk_fillwindow
*