Squashed commit of the following:

apps/graphics/twm4nx: Mostly cosmetic stuff.

    apps/graphics/twm4ndx:  In icon manager, fixing some places where width was used when height was intended.  Fixe uninitialized variable.
This commit is contained in:
Gregory Nutt 2019-05-09 17:54:01 -06:00
parent 06f479c471
commit 71de56bca8
6 changed files with 22 additions and 10 deletions

View File

@ -93,6 +93,7 @@ CIconMgr::CIconMgr(CTwm4Nx *twm4nx, uint8_t ncolumns)
m_tail = (FAR struct SWindowEntry *)0; // Tail of the winow list
m_active = (FAR struct SWindowEntry *)0; // No active window
m_window = (FAR CWindow *)0; // No icon manager Window
m_buttons = (FAR NXWidgets::CButtonArray *)0; // The button array
m_maxColumns = ncolumns; // Max columns per row
m_nrows = 0; // No rows yet
m_ncolumns = 0; // No columns yet
@ -414,7 +415,7 @@ void CIconMgr::pack(void)
// Resize the button array
nxgl_coord_t buttonWidth = newsize.w / m_maxColumns;
nxgl_coord_t buttonHeight = newsize.w / m_nrows;
nxgl_coord_t buttonHeight = newsize.h / m_nrows;
if (!m_buttons->resizeArray(m_maxColumns, m_nrows,
buttonWidth, buttonHeight))
@ -676,7 +677,7 @@ bool CIconMgr::createButtonArray(void)
uint8_t nrows = m_nrows > 0 ? m_nrows : 1;
nxgl_coord_t buttonWidth = windowSize.w / m_maxColumns;
nxgl_coord_t buttonHeight = windowSize.w / nrows;
nxgl_coord_t buttonHeight = windowSize.h / nrows;
// Get the Widget control instance from the Icon Manager window. This
// will force all widget drawing to go to the Icon Manager window.
@ -697,7 +698,7 @@ bool CIconMgr::createButtonArray(void)
buttonWidth, buttonHeight);
if (m_buttons == (FAR NXWidgets::CButtonArray *)0)
{
twmerr("ERROR: Failed to get window size\n");
twmerr("ERROR: Failed to create the button array\n");
return false;
}

View File

@ -358,8 +358,6 @@ bool CMenus::event(FAR struct SEventMsg *eventmsg)
}
break;
case EVENT_MENU_TITLE: // Really an action not an event
case EVENT_MENU_ROOT: // Popup root menu, really an action not an event
default:
success = false;
break;

View File

@ -98,7 +98,7 @@ namespace Twm4Nx
FAR struct SWindowEntry *m_tail; /**< Tail of the window list */
FAR struct SWindowEntry *m_active; /**< The active entry */
FAR struct CWindow *m_window; /**< Parent window */
FAR NXWidgets::CButtonArray *m_buttons; /**< The cotained button array */
FAR NXWidgets::CButtonArray *m_buttons; /**< The contained button array */
uint8_t m_maxColumns; /**< Max columns per row */
uint8_t m_nrows; /**< Number of rows in the button array */
uint8_t m_ncolumns; /**< Number of columns in the button array */
@ -176,7 +176,7 @@ namespace Twm4Nx
/**
* Handle a widget action event, overriding the CWidgetEventHandler
* method. This will indicate a button pre-release event.
* method. This will indicate a button pre-release event.
*
* @param e The event data.
*/

View File

@ -472,6 +472,12 @@ namespace Twm4Nx
* Set the size of the primary window. This is useful only
* for applications that need to control the drawing area.
*
* This method is only usable from windows that have no
* toolbar. The the window has a toolbar, then changing the
* width of the window will mess up the toolbar layout. In
* such cases, the better to use is resizeFrame() which will
* update the toolbar geometry after the resize.
*
* @param size New primary window size
*/

View File

@ -157,6 +157,14 @@
# define CONFIG_TWM4NX_BUTTON_INDENT 1
#endif
#ifndef CONFIG_TWM4NX_MENU_HSPACING
# define CONFIG_TWM4NX_MENU_HSPACING 2
#endif
#ifndef CONFIG_TWM4NX_MENU_VSPACING
# define CONFIG_TWM4NX_MENU_VSPACING 0
#endif
#ifndef CONFIG_TWM4NX_ICONMGR_VSPACING
# define CONFIG_TWM4NX_ICONMGR_VSPACING 2
#endif

View File

@ -130,9 +130,8 @@ namespace Twm4Nx
EVENT_MENU_VERSION = 0x4001, /**< Show the Twm4Nx version */
EVENT_MENU_ICONIFY = 0x4002, /**< Tool bar minimize button pressed */
EVENT_MENU_DEICONIFY = 0x4003, /**< Window icon pressed */
EVENT_MENU_FUNCTION = 0x4004, /**< Perform function on unknown menu */
EVENT_MENU_TITLE = 0x4005, /**< REVISIT: Really an action not an event */
EVENT_MENU_ROOT = 0x4006, /**< REVISIT: Popup root menu */
EVENT_MENU_SUBMENU = 0x4004, /**< Sub-menu selected */
EVENT_MENU_FUNCTION = 0x4005, /**< Perform function on unknown menu */
// Recipient == MAINMENU