diff --git a/graphics/twm4nx/src/ciconmgr.cxx b/graphics/twm4nx/src/ciconmgr.cxx index 2db260afa..8b22f9f47 100644 --- a/graphics/twm4nx/src/ciconmgr.cxx +++ b/graphics/twm4nx/src/ciconmgr.cxx @@ -87,17 +87,16 @@ using namespace Twm4Nx; CIconMgr::CIconMgr(CTwm4Nx *twm4nx, uint8_t ncolumns) { - m_twm4nx = twm4nx; // Cached the Twm4Nx session - m_eventq = (mqd_t)-1; // No widget message queue yet - m_head = (FAR struct SWindowEntry *)0; // Head of the winow list - 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 - m_nWindows = 0; // No windows yet + m_twm4nx = twm4nx; // Cached the Twm4Nx session + m_eventq = (mqd_t)-1; // No widget message queue yet + m_head = (FAR struct SWindowEntry *)0; // Head of the winow list + 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_nColumns = ncolumns; // Max columns per row + m_nrows = 0; // No rows yet + m_nWindows = 0; // No windows yet } /** @@ -232,6 +231,10 @@ bool CIconMgr::addWindow(FAR CWindow *cwin) insertEntry(wentry, cwin); + // Increment the window count + + m_nWindows++; + // The height of one row of the Icon Manager Window is determined (mostly) // by the font height @@ -251,15 +254,14 @@ bool CIconMgr::addWindow(FAR CWindow *cwin) nxgl_coord_t newHeight = rowHeight * m_nWindows; if (newHeight != windowSize.h) { + // Set the new window height. Since we are not changing the + // width, we don't need to call resizeFrame() + windowSize.h = rowHeight * m_nWindows; - m_window->setWindowSize(&windowSize); // REVISIT: use resizeFrame()? + m_window->setWindowSize(&windowSize); } } - // Increment the window count - - m_nWindows++; - // Pack the windows pack(); @@ -311,145 +313,59 @@ void CIconMgr::removeWindow(FAR CWindow *cwin) void CIconMgr::pack(void) { - struct nxgl_size_s colsize; - colsize.h = getRowHeight(); + // Get the number of rows in the button array after the change - struct nxgl_size_s windowSize; - if (!m_window->getWindowSize(&windowSize)) + uint8_t oldrows = m_nrows == 0 ? 1 : m_nrows; + uint8_t newrows = (m_nWindows + m_nColumns - 1) / m_nColumns; + + // Have the number of rows changed? + + if (oldrows != newrows) { - twmerr("ERROR: Failed to get window size\n"); - return; - } + // Yes.. save the new number of rows - colsize.w = windowSize.w / m_maxColumns; + m_nrows = newrows; - int rowIncr = colsize.h; - int colIncr = colsize.w; + // We have to show at least one row in any case - int row = 0; - int col = m_maxColumns; - int maxcol = 0; - - FAR struct SWindowEntry *wentry; - int i; - - for (i = 0, wentry = m_head; - wentry != (FAR struct SWindowEntry *)0; - i++, wentry = wentry->flink) - { - if (++col >= (int)m_maxColumns) + if (newrows == 0) { - col = 0; - row += 1; + newrows = 1; } - if (col > maxcol) - { - maxcol = col; - } + // Resize the window. It has changed only in height so we not have to + // have to use resizeFrame(). - struct nxgl_point_s newpos; - newpos.x = col * colIncr; - newpos.y = (row - 1) * rowIncr; - - wentry->row = row - 1; - wentry->col = col; - - // If the position or size has not changed, don't touch it - - if (wentry->pos.x != newpos.x || wentry->size.w != colsize.w) - { - if (!wentry->cwin->setWindowSize(&colsize)) - { - return; - } - - wentry->pos.x = newpos.x; - wentry->pos.y = newpos.y; - wentry->size.w = colsize.w; - wentry->size.h = colsize.h; - } - } - - maxcol++; - - // Check if there is a change in the dimension of the button array - - if (m_nrows != row && m_ncolumns != maxcol) - { - // Yes.. remember the new size - - m_nrows = row; - m_ncolumns = maxcol; - - // The height of one row is determined (mostly) by the font height - - windowSize.h = getRowHeight() * m_nWindows; + struct nxgl_size_s windowSize; if (!m_window->getWindowSize(&windowSize)) { - twmerr("ERROR: getWindowSize() failed\n"); + twmerr("ERROR: Failed to get old window size\n"); return; } - if (windowSize.h == 0) + nxgl_coord_t rowHeight = getRowHeight(); + windowSize.h = newrows * rowHeight; + if (!m_window->setWindowSize(&windowSize)) { - windowSize.h = rowIncr; - } - - struct nxgl_size_s newsize; - newsize.w = maxcol * colIncr; - - if (newsize.w == 0) - { - newsize.w = colIncr; - } - - newsize.h = windowSize.h; - - if (!m_window->setWindowSize(&newsize)) - { - twmerr("ERROR: setWindowSize() failed\n"); + twmerr("ERROR: Failed to set new window size\n"); return; } - // Resize the button array + // Redimension the button array - nxgl_coord_t buttonWidth = newsize.w / m_maxColumns; - nxgl_coord_t buttonHeight = newsize.h / m_nrows; + nxgl_coord_t buttonWidth = windowSize.w / m_nColumns; - if (!m_buttons->resizeArray(m_maxColumns, m_nrows, - buttonWidth, buttonHeight)) + if (!m_buttons->resizeArray(m_nColumns, newrows, buttonWidth, + rowHeight)) { twmerr("ERROR: CButtonArray::resizeArray failed\n"); return; } - - // Re-apply all of the button labels - - int rowndx = 0; - int colndx = 0; - - for (FAR struct SWindowEntry *swin = m_head; - swin != (FAR struct SWindowEntry *)0; - swin = swin->flink) - { - // Get the window name as an NWidgets::CNxString - - NXWidgets::CNxString string = swin->cwin->getWindowName(); - - // Apply the window name to the button - - m_buttons->setText(colndx, rowndx, string); - - // Increment the column, rolling over to the next row if necessary - - if (++colndx >= m_maxColumns) - { - colndx = 0; - rowndx++; - } - } } + + // Re-apply all of the button labels + + labelButtons(); } /** @@ -712,7 +628,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 buttonWidth = windowSize.w / m_nColumns; nxgl_coord_t buttonHeight = windowSize.h / nrows; // Get the Widget control instance from the Icon Manager window. This @@ -730,7 +646,7 @@ bool CIconMgr::createButtonArray(void) // The button must be positioned at the upper left of the window m_buttons = new NXWidgets::CButtonArray(control, 0, 0, - m_maxColumns, nrows, + m_nColumns, nrows, buttonWidth, buttonHeight); if (m_buttons == (FAR NXWidgets::CButtonArray *)0) { @@ -758,6 +674,45 @@ bool CIconMgr::createButtonArray(void) return true; } +/** + * Label each button with the window name + */ + +void CIconMgr::labelButtons(void) +{ + FAR struct SWindowEntry *swin = m_head; + uint8_t nrows = (m_nrows == 0) ? 1 : m_nrows; + + for (int rowndx = 0; rowndx < nrows; rowndx++) + { + for (int colndx = 0; colndx < m_nColumns; colndx++) + { + // Check if we should just clear any buttons on the right + + if (swin != (FAR struct SWindowEntry *)0) + { + // Get the window name as an NWidgets::CNxString + + NXWidgets::CNxString string = swin->cwin->getWindowName(); + + // Apply the window name to the button + + m_buttons->setText(colndx, rowndx, string); + + // Advance to the next window + + swin = swin->flink; + } + else + { + // Clear the button text on the right. + + m_buttons->setText(colndx, rowndx, ""); + } + } + } +} + /** * Put an allocated entry into an icon manager * @@ -768,20 +723,25 @@ void CIconMgr::insertEntry(FAR struct SWindowEntry *wentry, FAR CWindow *cwin) { FAR struct SWindowEntry *tmpwin; - bool added; - added = false; + // Handle the case where the the window list is empty + if (m_head == NULL) { m_head = wentry; wentry->blink = NULL; m_tail = wentry; - added = true; + return; } - for (tmpwin = m_head; tmpwin != NULL; tmpwin = tmpwin->flink) + // The list is not empty. Search for the location in name-order where we + // should insert this new entry + + for (tmpwin = m_head; + tmpwin != (FAR struct SWindowEntry *)0; + tmpwin = tmpwin->flink) { - // Insert the new window in name order + // Insert the new window mid-list, in name order NXWidgets::CNxString windowName = cwin->getWindowName(); if (windowName.compareTo( tmpwin->cwin->getWindowName()) > 0) @@ -799,17 +759,15 @@ void CIconMgr::insertEntry(FAR struct SWindowEntry *wentry, wentry->blink->flink = wentry; } - added = true; - break; + return; } } - if (!added) - { - m_tail->flink = wentry; - wentry->blink = m_tail; - m_tail = wentry; - } + // Insert the new entry at the tail of the list + + m_tail->flink = wentry; + wentry->blink = m_tail; + m_tail = wentry; } /** diff --git a/graphics/twm4nx/src/cmenus.cxx b/graphics/twm4nx/src/cmenus.cxx index 4d4262565..fe590ad5d 100644 --- a/graphics/twm4nx/src/cmenus.cxx +++ b/graphics/twm4nx/src/cmenus.cxx @@ -191,7 +191,7 @@ bool CMenus::initialize(FAR NXWidgets::CNxString &name) bool CMenus::addMenuItem(FAR IApplication *item) { - twminfo("Adding: subMenu=%p, event=%04x\n", subMenu, event); + twminfo("Adding menu item\n"); // Allocate a new menu item entry @@ -207,7 +207,6 @@ bool CMenus::addMenuItem(FAR IApplication *item) newitem->flink = NULL; newitem->text = item->getName(); newitem->subMenu = item->getSubMenu(); - newitem->start = item->getStartFunction(); newitem->handler = item->getEventHandler(); newitem->event = item->getEvent(); @@ -812,39 +811,14 @@ void CMenus::handleActionEvent(const NXWidgets::CWidgetEventArgs &e) // getEventHandler() must return a non-NULL instance in this // case. // 2. Sub-menu - // 3. Task start-up - // 4. Event with other recipients + // 3. Event with other recipients - if ((item->event & EVENT_RECIPIENT_MASK) != EVENT_RECIPIENT_APP) + if ((item->event & EVENT_RECIPIENT_MASK) != EVENT_RECIPIENT_APP && + item->subMenu != (FAR CMenus *)0) { - // If there is a subMenu, then bring the sub-menu up - // now. - - if (item->subMenu != (FAR CMenus *)0) - { - msg.eventID = EVENT_MENU_SUBMENU; - msg.obj = (FAR void *)item->subMenu; - msg.handler = (FAR void *)0; - } - - // If there is a start-up function, then execute the - // start-up function - - else if (item->start != (TStartFunction)0) - { - msg.eventID = EVENT_MENU_SUBMENU; - msg.obj = (FAR void *)this; - msg.handler = (FAR void *)item->start; - } - - // Otherwise, this is an internal message with no handler - - else - { - msg.eventID = item->event; - msg.obj = (FAR void *)this; - msg.handler = (FAR void *)0; - } + msg.eventID = EVENT_MENU_SUBMENU; + msg.obj = (FAR void *)item->subMenu; + msg.handler = (FAR void *)0; } // Otherwise, send the event specified for the menu item. The diff --git a/graphics/twm4nx/src/cnxterm.cxx b/graphics/twm4nx/src/cnxterm.cxx index 172dee8b4..de7952b30 100644 --- a/graphics/twm4nx/src/cnxterm.cxx +++ b/graphics/twm4nx/src/cnxterm.cxx @@ -180,10 +180,11 @@ bool CNxTerm::initialize(void) NXWidgets::CNxString name("NuttShell"); + uint8_t wflags = (WFLAGS_NO_MENU_BUTTON | WFLAGS_HIDDEN); + FAR CWindowFactory *factory = m_twm4nx->getWindowFactory(); m_nxtermWindow = factory->createWindow(name, &CONFIG_TWM4NX_NXTERM_ICON, - (FAR CIconMgr *)0, - WFLAGS_NO_MENU_BUTTON); + (FAR CIconMgr *)0, wflags); if (m_nxtermWindow == (FAR CWindow *)0) { twmerr("ERROR: Failed to create CWindow\n"); @@ -207,7 +208,7 @@ bool CNxTerm::initialize(void) return false; } - return true; + return m_nxtermWindow->showWindow(); } /** @@ -539,12 +540,14 @@ void CNxTerm::redraw(void) * construction that may fail. In this implemenation, it will * initialize the NSH library and register an menu item in the * Main Menu. - * - * @param twm4nx. The Twm4Nx session instance */ bool CNxTermFactory::initialize(FAR CTwm4Nx *twm4nx) { + // Save the session instance + + m_twm4nx = twm4nx; + // Initialize the NSH library if (!nshlibInitialize()) @@ -595,17 +598,42 @@ bool CNxTermFactory::nshlibInitialize(void) } /** - * Create and start a new instance of CNxTerm. + * Handle Twm4Nx factory events. This overrides a method from + * CTwm4NXEvent * - * @param twm4nx. The Twm4Nx session instance + * @param eventmsg. The received NxWidget WINDOW event message. + * @return True if the message was properly handled. false is + * return on any failure. */ -bool CNxTermFactory::startFunction(FAR CTwm4Nx *twm4nx) +bool CNxTermFactory::event(FAR struct SEventMsg *eventmsg) +{ + bool success = true; + + switch (eventmsg->eventID) + { + case EVENT_NXTERM_START: // Redraw event (should not happen) + startFunction(); // Create a new NxTerm instance + break; + + default: + success = false; + break; + } + + return success; +} + +/** + * Create and start a new instance of CNxTerm. + */ + +bool CNxTermFactory::startFunction(void) { // Instantiate the Nxterm application, providing only the session session // instance to the constructor - CNxTerm *nxterm = new CNxTerm(twm4nx); + CNxTerm *nxterm = new CNxTerm(m_twm4nx); if (!nxterm) { twmerr("ERROR: Failed to instantiate CNxTerm\n"); diff --git a/graphics/twm4nx/src/cresize.cxx b/graphics/twm4nx/src/cresize.cxx index 55db98a1d..358f772df 100644 --- a/graphics/twm4nx/src/cresize.cxx +++ b/graphics/twm4nx/src/cresize.cxx @@ -649,8 +649,10 @@ void CResize::endResize(FAR CWindow *cwin) struct nxgl_size_s iconMgrSize; iconMgr->getSize(&iconMgrSize); + // REVISIT: The following is nonsense + iconMgrSize.w = (unsigned int) - ((m_dragsize.w * (unsigned long)iconMgr->getDisplayColumns()) / currcol); + ((m_dragsize.w * (unsigned long)iconMgr->getNumberOfColumns()) / currcol); cwin->resizeFrame(&iconMgrSize, &pos); iconMgr->pack(); diff --git a/graphics/twm4nx/src/cwindowevent.cxx b/graphics/twm4nx/src/cwindowevent.cxx index 79a417c10..b67164cc3 100644 --- a/graphics/twm4nx/src/cwindowevent.cxx +++ b/graphics/twm4nx/src/cwindowevent.cxx @@ -165,7 +165,7 @@ CWindowEvent::~CWindowEvent(void) void CWindowEvent::handleRedrawEvent(FAR const nxgl_rect_s *nxRect, bool more) { - twminfo("background=%s\n", m_isBackground ? "YES" : "NO"); + twminfo("Redraw events\n"); // Does the user need redraw events? diff --git a/graphics/twm4nx/src/cwindowfactory.cxx b/graphics/twm4nx/src/cwindowfactory.cxx index 0c63be6d3..0826349e7 100644 --- a/graphics/twm4nx/src/cwindowfactory.cxx +++ b/graphics/twm4nx/src/cwindowfactory.cxx @@ -217,10 +217,12 @@ FAR CWindow * if (!WFLAGS_IS_ICONMGR(flags) && !WFLAGS_IS_MENU(flags)) { - CIconMgr *iconmgr = win->cwin->getIconMgr(); - DEBUGASSERT(iconmgr != (CIconMgr *)0); + if (iconMgr == (FAR CIconMgr *)0) + { + iconMgr = m_twm4nx->getIconMgr(); + } - (void)iconmgr->addWindow(win->cwin); + (void)iconMgr->addWindow(win->cwin); } // Return the contained window diff --git a/include/graphics/twm4nx/ciconmgr.hxx b/include/graphics/twm4nx/ciconmgr.hxx index 6d3dedaa3..d750fe1b8 100644 --- a/include/graphics/twm4nx/ciconmgr.hxx +++ b/include/graphics/twm4nx/ciconmgr.hxx @@ -99,10 +99,9 @@ namespace Twm4Nx FAR struct SWindowEntry *m_active; /**< The active entry */ FAR struct CWindow *m_window; /**< Parent window */ FAR NXWidgets::CButtonArray *m_buttons; /**< The contained button array */ - uint8_t m_maxColumns; /**< Max columns per row */ + uint16_t m_nWindows; /**< The number of windows in the icon mgr. */ + uint8_t m_nColumns; /**< Fixed number of 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 */ - unsigned int m_nWindows; /**< The number of windows in the icon mgr. */ /** * Return the height of one row @@ -126,6 +125,12 @@ namespace Twm4Nx bool createButtonArray(void); + /** + * Label each button with the window name + */ + + void labelButtons(void); + /** * Put an allocated entry into an icon manager * @@ -207,16 +212,6 @@ namespace Twm4Nx return (FAR CMenus *)0; } - /** - * There is no application start-up function. This function will not - * be called in this implementation - */ - - inline TStartFunction getStartFunction(void) - { - return (TStartFunction)0; - } - /** * There is no custom event handler. We use the common event handler. * @@ -309,18 +304,9 @@ namespace Twm4Nx * Get the number of columns */ - inline unsigned int getDisplayColumns(void) - { - return m_maxColumns; - } - - /** - * Get the current column - */ - inline unsigned int getNumberOfColumns(void) { - return m_ncolumns; + return m_nColumns; } /** diff --git a/include/graphics/twm4nx/cmenus.hxx b/include/graphics/twm4nx/cmenus.hxx index 7d3592a3a..24e5a7b1c 100644 --- a/include/graphics/twm4nx/cmenus.hxx +++ b/include/graphics/twm4nx/cmenus.hxx @@ -102,7 +102,6 @@ namespace Twm4Nx FAR struct SMenuItem *blink; /**< Backward link previous menu item */ FAR NXWidgets::CNxString text; /**< The text string for the menu item */ FAR CMenus *subMenu; /**< Menu root of a pull right menu */ - TStartFunction start; /**< Application start-up function */ FAR CTwm4NxEvent *handler; /**< Application event handler */ uint16_t event; /**< Menu selection event */ }; diff --git a/include/graphics/twm4nx/cnxterm.hxx b/include/graphics/twm4nx/cnxterm.hxx index 51bc8d935..27b606b5f 100644 --- a/include/graphics/twm4nx/cnxterm.hxx +++ b/include/graphics/twm4nx/cnxterm.hxx @@ -67,6 +67,10 @@ #define EVENT_NXTERM_CLOSE (EVENT_RECIPIENT_APP | 0x0001) +// Menu Events + +#define EVENT_NXTERM_START (EVENT_RECIPIENT_APP | 0x0002) + ///////////////////////////////////////////////////////////////////////////// // Implementation Classes ///////////////////////////////////////////////////////////////////////////// @@ -151,10 +155,14 @@ namespace Twm4Nx bool run(void); }; - class CNxTermFactory : public IApplication, public IApplicationFactory + class CNxTermFactory : public IApplication, + public IApplicationFactory, + public CTwm4NxEvent { private: + FAR CTwm4Nx *m_twm4nx; /**< Twm4Nx session instance */ + /** * One time NSH initialization. This function must be called exactly * once during the boot-up sequence to initialize the NSH library. @@ -165,12 +173,21 @@ namespace Twm4Nx bool nshlibInitialize(void); /** - * Create and start a new instance of an CNxTerm. + * Handle Twm4Nx factory events. This overrides a method from + * CTwm4NXEvent * - * @param twm4nx. The Twm4Nx session instance + * @param eventmsg. The received NxWidget WINDOW event message. + * @return True if the message was properly handled. false is + * return on any failure. */ - static bool startFunction(CTwm4Nx *twm4n); + bool event(FAR struct SEventMsg *eventmsg); + + /** + * Create and start a new instance of an CNxTerm. + */ + + bool startFunction(void); /** * Return the Main Menu item string. This overrides the method from @@ -196,16 +213,6 @@ namespace Twm4Nx return (FAR CMenus *)0; } - /** - * There is no application start-up function. This function will not - * be called in this implementation - */ - - inline TStartFunction getStartFunction(void) - { - return (TStartFunction)startFunction; - } - /** * There is no custom event handler. We use the common event handler. * @@ -214,7 +221,7 @@ namespace Twm4Nx inline FAR CTwm4NxEvent *getEventHandler(void) { - return (FAR CTwm4NxEvent *)0; + return (FAR CTwm4NxEvent *)this; } /** @@ -226,7 +233,7 @@ namespace Twm4Nx inline uint16_t getEvent(void) { - return EVENT_SYSTEM_NOP; + return EVENT_NXTERM_START; } public: @@ -234,11 +241,12 @@ namespace Twm4Nx /** * CNxTermFactory Constructor * - * @param twm4nx. The twm4nx instance used to terminate calibration + * @param twm4nx. The Twm4Nx session instance */ inline CNxTermFactory(void) { + m_twm4nx = (FAR CTwm4Nx *)0; } /** @@ -255,8 +263,6 @@ namespace Twm4Nx * construction that may fail. In this implemenation, it will * initialize the NSH library and register an menu item in the * Main Menu. - * - * @param twm4nx. The Twm4Nx session instance */ bool initialize(FAR CTwm4Nx *twm4nx); diff --git a/include/graphics/twm4nx/cwindowfactory.hxx b/include/graphics/twm4nx/cwindowfactory.hxx index 2c112c17f..5c193c879 100644 --- a/include/graphics/twm4nx/cwindowfactory.hxx +++ b/include/graphics/twm4nx/cwindowfactory.hxx @@ -115,16 +115,6 @@ namespace Twm4Nx return (FAR CMenus *)0; } - /** - * There is no application start-up function. This function will not - * be called in this implementation - */ - - inline TStartFunction getStartFunction(void) - { - return (TStartFunction)0; - } - /** * There is no custom event handler. We use the common event handler. * diff --git a/include/graphics/twm4nx/iapplication.hxx b/include/graphics/twm4nx/iapplication.hxx index 79b3c342e..dfb153fde 100644 --- a/include/graphics/twm4nx/iapplication.hxx +++ b/include/graphics/twm4nx/iapplication.hxx @@ -59,17 +59,6 @@ namespace Twm4Nx class CMenus; // Forward reference class CTwm4NxEvent; // Forward reference - /** - * Get the start function entry point. - * - * @param twm4nx The Twm4Nx session object. Use with care! The CTwm4Nx - * logic runs on a different thread and some of the methods of the - * class may not be thread safe. - * @return True if the application was started successfully - */ - - typedef CODE bool (*TStartFunction)(FAR CTwm4Nx *twm4nx); - /** * Defines the interface of an application to the Main Menu. "Built-In" * applications are started via CMainMenu. This interface class defines @@ -103,25 +92,20 @@ namespace Twm4Nx /** * Return any submenu item associated with the menu entry. If a non- * null value is returned, then this sub-menu will be brought up when - * the menu entry is selected. Otherwise, the start() method will be - * called. These two behaviors are mutually exlusive. + * the menu entry is selected. * * NOTEs: - * * Both the start() and getSubMenu() methods are ignoredif the event() - * method returns an event with recipient = EVENT_RECIPIENT_APP. In - * that case, the application will be fully responsible for handling - * the menu selection event. - * * Otherwise, the sub-menu or start-up take precedence over + * - The getSubMenu() method is ignored if the event() method returns + * an event with recipient = EVENT_RECIPIENT_APP. In that case, the + * application will be fully responsible for handling the menu + * selection event. Otherwise, the sub-menu takes precedence over * the event. - * * If getSubMenu() returns a non-NULL CMenu instance, then the - * subMenu is used and the start() is not called. * * Precedence: * 1. Event with recipient == EVENT_RECIPIENT_APP. getEventHandler() * must return a non-NULL instance in this case. * 2. Sub-menu - * 3. Task start-up - * 4. Event with other recipients + * 3. Event with other recipients * * @return. A reference to any sub-menu that should be brought up if * the menu item is selected. This must be null if the menu item @@ -130,38 +114,6 @@ namespace Twm4Nx virtual FAR CMenus *getSubMenu(void) = 0; - /** - * This is the application start up function. This function will be - * called when its menu entry has been selected in order to start the - * application unless the behavior of the menu item is to bring up a - * sub-menu. In that case, this start-up function is never called. - * - * The Main Menu runs on the main Twm4Nx thread so this function will, - * typically, create a new thread to host the application. - * - * NOTEs: - * * Both the start() and getSubMenu() methods are ignoredif the event() - * method returns an event with recipient = EVENT_RECIPIENT_APP. In - * that case, the application will be fully responsible for handling - * the menu selection event. - * * Otherwise, the sub-menu or start-up take precedence over - * the event. - * * If getSubMenu() returns a non-NULL CMenu instance, then the - * subMenu is used and the start() is not called. - * - * Precedence: - * 1. Event with recipient == EVENT_RECIPIENT_APP. getEventHandler() - * must return a non-NULL instance in this case. - * 2. Sub-menu - * 3. Task start-up - * 4. Event with other recipients - * - * @return The start-up function entry point. A null value is returned - * if there is no startup function. - */ - - virtual TStartFunction getStartFunction(void) = 0; - /** * External applications may provide their own event handler that runs * when the the menu item is selection. If so, then this method will @@ -190,27 +142,22 @@ namespace Twm4Nx * handling instance. Otherwise, the event will be handled by internal * Twm4Nx logic based on the internal recipient. * - * This method may return EVENT_SYSTEM_NOP if a subMenu or task start-up - * function should be executed. It would be an error if this method - * returned an event with EVENT_RECIPIENT_APP but the - * getEventHandler() method returned null. + * This method may return EVENT_SYSTEM_NOP if a subMenu should be + * used. It would be an error if this method returned an event with + * EVENT_RECIPIENT_APP but the getEventHandler() method returned null. * * NOTEs: - * * Both the start() and getSubMenu() methods are ignoredif the event() - * method returns an event with recipient = EVENT_RECIPIENT_APP. In - * that case, the application will be fully responsible for handling - * the menu selection event. - * * Otherwise, the sub-menu or start-up take precedence over + * - The getSubMenu() method is ignored if the event() method returns + * an event with recipient = EVENT_RECIPIENT_APP. In that case, the + * application will be fully responsible for handling the menu + * selection event. Otherwise, the sub-menu takes precedence over * the event. - * * If getSubMenu() returns a non-NULL CMenu instance, then the - * subMenu is used and the start() is not called. * * Precedence: * 1. Event with recipient == EVENT_RECIPIENT_APP. getEventHandler() * must return a non-NULL instance in this case. * 2. Sub-menu - * 3. Task start-up - * 4. Event with other recipients + * 3. Event with other recipients * * @return. Either, (1) an event with recipient = EVENT_RECIPIENT_APP * that will be generated when menu item is selected, or (2) any other