Squashed commit of the following:

apps/graphics/twm4nx:  The Icon Manager now adds a Main Menu entry that will de-iconify the Icon Manager or raise to the top of the hieararchy if not iconfified.  This is useful when there are many open windows.

    apps/graphics/twm4nx:  In resize operation, don't let window get narrower than the minimum toolbar width.

    apps/graphics/twm4nx:  Add logic so that the main menu is place at (or near) the position where the background was clicked.

    apps/graphics/twm4nx:  Better integrate menus and iconifiction:  Bringup up a menu is like de-iconifcation, except there is no icon to be erases; taking down a menu is like iconification except that there is no icon to present.

    apps/graphics/nxwidgets:  Add methods to all windows to query if a window is visible or hidden.

    apps/graphics/twm4nx:  Use NxWidgets methods which work in all contexts instead of trying to come up with a way to know if a window is displayed through complex flags.
This commit is contained in:
Gregory Nutt 2019-05-09 13:31:12 -06:00
parent fea0109ab3
commit 06f479c471
20 changed files with 661 additions and 206 deletions

View File

@ -64,6 +64,7 @@
#include "graphics/twm4nx/cfonts.hxx"
#include "graphics/twm4nx/cresize.hxx"
#include "graphics/twm4nx/cmenus.hxx"
#include "graphics/twm4nx/cmainmenu.hxx"
#include "graphics/twm4nx/cwindow.hxx"
#include "graphics/twm4nx/cwindowevent.hxx"
#include "graphics/twm4nx/cwindowfactory.hxx"
@ -168,13 +169,38 @@ bool CIconMgr::initialize(FAR const char *prefix)
return true;
}
/**
* Add Icon Manager menu items to the Main menu. This is really a
* part of the logic that belongs in initialize() but cannot be
* executed in that context because it assumes that the Main Menu
* logic is ready.
*
* @return True on success
*/
bool CIconMgr::addMenuItems(void)
{
// Add the Icon Manager entry to the Main Menu. This provides a quick
// way to de-iconfigy or to bring the Icon Manager to the top in a
// crowded desktop.
FAR CMainMenu *cmain = m_twm4nx->getMainMenu();
if (!cmain->addApplication(this))
{
twmerr("ERROR: Failed to add to the Main Menu\n");
return false;
}
return true;
}
/**
* Add a window to an icon manager
*
* @param win the TWM window structure
*/
bool CIconMgr::add(FAR CWindow *cwin)
bool CIconMgr::addWindow(FAR CWindow *cwin)
{
// Don't add the icon manager to itself
@ -210,7 +236,9 @@ bool CIconMgr::add(FAR CWindow *cwin)
nxgl_coord_t rowHeight = getRowHeight();
// Increase the Icon Manager window size, if necessary
// Increase the height of the Icon Manager window, if necessary
// REVISIT: Should also set an optimal width. Currently just uses
// the defaults set when the window was created!
struct nxgl_size_s windowSize;
if (!m_window->getWindowSize(&windowSize))
@ -223,7 +251,7 @@ bool CIconMgr::add(FAR CWindow *cwin)
if (newHeight != windowSize.h)
{
windowSize.h = rowHeight * m_nWindows;
m_window->setWindowSize(&windowSize); // REVISIT: use resizeFrame()
m_window->setWindowSize(&windowSize); // REVISIT: use resizeFrame()?
}
}
@ -251,24 +279,28 @@ bool CIconMgr::add(FAR CWindow *cwin)
* @param win the TWM window structure
*/
void CIconMgr::remove(FAR struct SWindow *win)
void CIconMgr::removeWindow(FAR CWindow *cwin)
{
FAR struct SWindowEntry *wentry = win->wentry;
if (wentry != NULL)
if (cwin != (FAR CWindow *)0)
{
// Remove the list from the window structure
// Find the entry containing this Window
removeEntry(wentry);
FAR struct SWindowEntry *wentry = findEntry(cwin);
if (wentry != (FAR struct SWindowEntry *)0)
{
// Remove the list from the window structure
// Destroy the window
removeEntry(wentry);
CWindowFactory *factory = m_twm4nx->getWindowFactory();
factory->destroyWindow(wentry->cwin);
// Destroy the window
m_nWindows--;
std::free(wentry);
pack();
CWindowFactory *factory = m_twm4nx->getWindowFactory();
factory->destroyWindow(wentry->cwin);
m_nWindows--;
std::free(wentry);
pack();
}
}
}
@ -470,6 +502,33 @@ bool CIconMgr::event(FAR struct SEventMsg *eventmsg)
switch (eventmsg->eventID)
{
case EVENT_ICONMGR_DEICONIFY: // De-iconify or raise the Icon Manager
{
// Is the Icon manager conified?
if (m_window->isIconified())
{
// Yes.. De-iconify it
if (!m_window->deIconify())
{
twmerr("ERROR: Failed to de-iconify\n");
success = false;
}
}
else
{
// No.. Just bring it to the top of the hierachy
if (!m_window->raiseWindow())
{
twmerr("ERROR: Failed to raise window\n");
success = false;
}
}
}
break;
default:
success = false;
break;
@ -506,18 +565,17 @@ nxgl_coord_t CIconMgr::getRowHeight(void)
bool CIconMgr::createIconManagerWindow(FAR const char *prefix)
{
static FAR const char *rootName = "Icon Manager";
// Create the icon manager name using any prefix provided by the creator
FAR char *allocName = (FAR char *)0;
if (prefix != (FAR const char *)0)
{
std::asprintf(&allocName, "%s %s", prefix, rootName);
m_name.setText(prefix);
m_name.append(" Icon Manager");
}
else
{
m_name.setText("Icon Manager");
}
FAR const char *name = (allocName == (FAR char *)0) ? rootName : allocName;
// Create the icon manager window. Customizations:
//
@ -526,16 +584,16 @@ bool CIconMgr::createIconManagerWindow(FAR const char *prefix)
// WFLAGS_NO_DELETE_BUTTON: The user cannot delete the Icon Manager window
// WFLAGS_NO_RESIZE_BUTTON: The user cannot control the Icon Manager
// window size
// WFLAGS_IS_ICONMGR: Yes, this is the Icon Manager window
// WFLAGS_HIDDEN_WINDOW: The window is created in the hidden state
// WFLAGS_ICONMGR: Yes, this is the Icon Manager window
// WFLAGS_HIDDEN: The window is created in the hidden state
CWindowFactory *factory = m_twm4nx->getWindowFactory();
uint8_t wflags = (WFLAGS_NO_MENU_BUTTON | WFLAGS_NO_DELETE_BUTTON |
WFLAGS_NO_RESIZE_BUTTON | WFLAGS_IS_ICONMGR |
WFLAGS_HIDDEN_WINDOW);
WFLAGS_NO_RESIZE_BUTTON | WFLAGS_ICONMGR |
WFLAGS_HIDDEN);
m_window = factory->createWindow(name, &CONFIG_TWM4NX_ICONMGR_IMAGE,
m_window = factory->createWindow(m_name, &CONFIG_TWM4NX_ICONMGR_IMAGE,
this, wflags);
if (m_window == (FAR CWindow *)0)
@ -544,13 +602,6 @@ bool CIconMgr::createIconManagerWindow(FAR const char *prefix)
return false;
}
// Free any temporary name strings
if (allocName != (FAR char *)0)
{
std::free(allocName);
}
// Adjust the height of the window (and probably the width too?)
// The height of one row is determined (mostly) by the font height
@ -751,6 +802,38 @@ void CIconMgr::removeEntry(FAR struct SWindowEntry *wentry)
}
}
/**
* Find an entry in the icon manager
*
* @param cwin The window to find
* @return The incon manager entry (unless an error occurred)
*/
FAR struct SWindowEntry *CIconMgr::findEntry(FAR CWindow *cwin)
{
// Check each entry
FAR struct SWindowEntry *wentry;
for (wentry = m_head;
wentry != (FAR struct SWindowEntry *)0;
wentry = wentry->flink)
{
// Does this entry carry the window we are looking for?
if (wentry->cwin == cwin)
{
// Yes.. return the reference to this entry
return wentry;
}
}
// No matching entry found
return wentry;
}
/**
* Set active window
*

View File

@ -712,7 +712,7 @@ bool CIconWidget::iconDrag(FAR struct SEventMsg *eventmsg)
if (!moveTo(newpos.x, newpos.y))
{
gerr("ERROR: moveTo() failed\n");
twmerr("ERROR: moveTo() failed\n");
return false;
}

View File

@ -45,11 +45,12 @@
#include <graphics/nxwidgets/cnxstring.hxx>
#include <graphics/twm4nx/twm4nx_widgetevents.hxx>
#include <graphics/twm4nx/twm4nx_config.hxx>
#include <graphics/twm4nx/iapplication.hxx>
#include <graphics/twm4nx/ctwm4nx.hxx>
#include <graphics/twm4nx/cmenus.hxx>
#include <graphics/twm4nx/cmainmenu.hxx>
#include <graphics/twm4nx/twm4nx_widgetevents.hxx>
/////////////////////////////////////////////////////////////////////////////
// Implementation Class Definition
@ -98,14 +99,14 @@ bool CMainMenu::initialize(void)
m_mainMenu = new CMenus(m_twm4nx);
if (m_mainMenu == (FAR CMenus *)0)
{
gerr("ERROR: Failed to create the CMenus instance\n");
twmerr("ERROR: Failed to create the CMenus instance\n");
return false;
}
NXWidgets::CNxString menuName("Main Menu");
if (!m_mainMenu->initialize(menuName))
{
gerr("ERROR: Failed to initialize the CMenus instance\n");
twmerr("ERROR: Failed to initialize the CMenus instance\n");
delete m_mainMenu;
m_mainMenu = (FAR CMenus *)0;
return false;
@ -131,7 +132,7 @@ bool CMainMenu::addApplication(FAR IApplication *app)
if (mmitem == (FAR struct SMainMenuItem *)0)
{
gerr("ERROR: Failed to allocate the main menu entry\n");
twmerr("ERROR: Failed to allocate the main menu entry\n");
return false;
}
@ -141,13 +142,12 @@ bool CMainMenu::addApplication(FAR IApplication *app)
// Add the new menu item to the main menu
FAR NXWidgets::CNxString appName;
app->getName(appName);
FAR NXWidgets::CNxString appName = app->getName();
if (!m_mainMenu->addMenuItem(appName, app->getSubMenu(),
app->getEventHandler(), app->getEvent()))
{
gerr("ERROR: addMenuItem failed\n");
twmerr("ERROR: addMenuItem failed\n");
std::free(mmitem);
return false;
}
@ -181,12 +181,24 @@ bool CMainMenu::event(FAR struct SEventMsg *eventmsg)
if (!m_mainMenu->isVisible())
{
// No.. then make it visible now
// First, we select a position as close to the background click
// as possible
// REVISIT: Need to reset the menu to its initial state
// REVISIT: Need to position the main menu as close as
// possible to the click position in eventmsg.
success = selectMainMenuPosition(eventmsg->pos);
if (!success)
{
twmerr("ERROR: selectMainMenuPosition() failed\n");
}
else
{
// Make the main menu visible
m_mainMenu->show(); // Make the main menu visible
success = m_mainMenu->show();
if (!success)
{
twmerr("ERROR: Failed to show the menu\n");
}
}
}
break;
@ -256,3 +268,107 @@ void CMainMenu::removeEntry(FAR struct SMainMenuItem *mmitem)
mmitem->flink = NULL;
mmitem->blink = NULL;
}
/**
* Select a position for the Main Menu which is as close as possible
* the background click position.
*
* @param clickPos The background click position
*/
bool CMainMenu::selectMainMenuPosition(FAR const struct nxgl_point_s &clickPos)
{
// Get the size of the main menu frame
struct nxgl_size_s frameSize;
m_mainMenu->getFrameSize(&frameSize);
// Get the size of the display
struct nxgl_size_s displaySize;
m_twm4nx->getDisplaySize(&displaySize);
// Determine the best new Y position for the menu.
struct nxgl_point_s framePos;
// Check if the menu does not fit on the display. This is really an error
// condition since menu items are not accessible
//
// REVISIT: Consider using a scrolling text box to handle this case.
if (frameSize.h > displaySize.h)
{
// Just position at the top of the display so that at least the
// toolbar will be visible
framePos.y = 0;
}
// Try to position the menu at the same Y position as the background click
else if (clickPos.y + frameSize.h <= displaySize.h)
{
framePos.y = clickPos.y;
}
// Otherwise, set the Y position so that the entire menu is on the display
// with the bottom of the menu at the bottom of the display.
else
{
framePos.y = displaySize.h - frameSize.h;
}
// Determine the best new Y position for the menu.
// Check if the menu does not fit on the display. This is really unlikely.
if (frameSize.w > displaySize.w)
{
// Just position at the right of the display so that at least the
// toolbar minimize button will be visible
framePos.x = displaySize.w - frameSize.w; // Negative position!
}
// Try to position the menu at the same X position as the background click
// So that it appears to the right of the click position.
else if (clickPos.x + frameSize.w <= displaySize.w)
{
framePos.x = clickPos.x;
}
// Try to position the menu at the same X position as the background click
// So that it appears to the left of the click position.
else if (clickPos.x >= frameSize.w)
{
framePos.x = clickPos.x - frameSize.w;
}
// Otherwise, set the X position so that the entire menu is on the display
// on the left or right of the display. This cases are not possible unless
// the width of the menu is greater than half of the width of the display.
else if (clickPos.x > displaySize.w / 2)
{
// Position at the right of the display
framePos.x = displaySize.w - frameSize.w;
}
else
{
// Position at the left of the display
framePos.x = 0;
}
// And, finally, set the new main menu frame position
twminfo("Click position: (%d,%d) Main menu position: (%d,%d)\n",
clickPos.x, clickPos.y, framePos.x, framePos.y);
return m_mainMenu->setFramePosition(&framePos);
}

View File

@ -84,12 +84,15 @@
// WFLAGS_NO_MENU_BUTTON: No menu buttons on menus
// WFLAGS_NO_DELETE_BUTTON: Menus cannot be deleted in this manner.
// WFLAGS_NO_RESIZE_BUTTON: Menus cannot be resized
// WFLAGS_HIDDEN_WINDOW: Menu windows are always created in the
// hidden state. When the menu is selected,
// then it should be shown.
// WFLAGS_MENU: Menu windows are always created in the
// hidden and iconifed state. When the menu is
// selected, then it should be de-iconfied to
// be shown.
// WFLAGS_HIDDEN: Redundant
#define MENU_WINDOW_FLAGS (WFLAGS_NO_MENU_BUTTON | WFLAGS_NO_DELETE_BUTTON | \
WFLAGS_NO_RESIZE_BUTTON | WFLAGS_HIDDEN_WINDOW)
WFLAGS_NO_RESIZE_BUTTON | WFLAGS_MENU | \
WFLAGS_HIDDEN)
////////////////////////////////////////////////////////////////////////////
// Class Implementations
@ -117,7 +120,6 @@ CMenus::CMenus(CTwm4Nx *twm4nx)
m_nMenuItems = 0; // No menu items yet
m_menuDepth = 0; // No menus up
m_entryHeight = 0; // Menu entry height
m_visible = false; // Menu not visible
m_menuPull = false; // No pull right entry
// Windows
@ -491,7 +493,7 @@ bool CMenus::createMenuWindow(void)
m_menuWindow = new CWindow(m_twm4nx);
if (m_menuWindow == (FAR CWindow *)0)
{
gerr("ERRR: Failed to instantiate menu window\n");
twmerr("ERRR: Failed to instantiate menu window\n");
return false;
}
@ -508,7 +510,7 @@ bool CMenus::createMenuWindow(void)
(FAR const struct NXWidgets::SRlePaletteBitmap *)0,
(FAR CIconMgr *)0, MENU_WINDOW_FLAGS))
{
gerr("ERRR: Failed to initialize menu window\n");
twmerr("ERRR: Failed to initialize menu window\n");
delete m_menuWindow;
m_menuWindow = (FAR CWindow *)0;
return false;
@ -518,12 +520,12 @@ bool CMenus::createMenuWindow(void)
}
/**
* Calculate the optimal menu window size
* Calculate the optimal menu frame size
*
* @result True is returned on success
* @param frameSize The location to return the calculated frame size
*/
void CMenus::getMenuWindowSize(FAR struct nxgl_size_s &size)
void CMenus::getMenuFrameSize(FAR struct nxgl_size_s &frameSize)
{
CFonts *fonts = m_twm4nx->getFonts();
FAR NXWidgets::CNxFont *menuFont = fonts->getMenuFont();
@ -566,9 +568,7 @@ void CMenus::getMenuWindowSize(FAR struct nxgl_size_s &size)
struct nxgl_size_s displaySize;
m_twm4nx->getDisplaySize(&displaySize);
struct nxgl_size_s frameSize;
menuToFrameSize(&menuSize, &frameSize);
if (frameSize.w > displaySize.w)
{
frameSize.w = displaySize.w;
@ -578,9 +578,18 @@ void CMenus::getMenuWindowSize(FAR struct nxgl_size_s &size)
{
frameSize.h = displaySize.h;
}
}
// Set the new menu window size
/**
* Calculate the optimal menu window size
*
* @param frameSize The location to return the calculated window size
*/
void CMenus::getMenuWindowSize(FAR struct nxgl_size_s &size)
{
struct nxgl_size_s frameSize;
getMenuFrameSize(frameSize);
frameToMenuSize(&frameSize, &size);
}
@ -594,10 +603,10 @@ bool CMenus::setMenuWindowSize(void)
{
// Get the optimal menu window size
struct nxgl_size_s menuSize;
getMenuWindowSize(menuSize);
struct nxgl_size_s frameSize;
getMenuFrameSize(frameSize);
if (!m_menuWindow->setWindowSize(&menuSize))
if (!m_menuWindow->resizeFrame(&frameSize, (FAR const struct nxgl_point_s *)0))
{
twmerr("ERROR: Failed to set window size\n");
return false;

View File

@ -217,7 +217,7 @@ bool CNxTerm::run(void)
if (m_pid >= 0 || m_nxterm != 0)
{
gerr("ERROR: All ready running or connected\n");
twmerr("ERROR: All ready running or connected\n");
return false;
}
@ -227,7 +227,7 @@ bool CNxTerm::run(void)
{
// This might fail if a signal is received while we are waiting.
gerr("ERROR: Failed to get semaphore\n");
twmerr("ERROR: Failed to get semaphore\n");
return false;
}
@ -273,7 +273,7 @@ bool CNxTerm::run(void)
bool result = true;
if (m_pid < 0)
{
gerr("ERROR: Failed to create the NxTerm task\n");
twmerr("ERROR: Failed to create the NxTerm task\n");
result = false;
}
else
@ -304,7 +304,7 @@ bool CNxTerm::run(void)
// sem_timedwait failed OR the NxTerm task reported a
// failure. Stop the application
gerr("ERROR: Failed start the NxTerm task\n");
twmerr("ERROR: Failed start the NxTerm task\n");
stop();
result = false;
}
@ -452,7 +452,7 @@ int CNxTerm::nxterm(int argc, char *argv[])
if (on_exit(exitHandler, g_nxtermvars.console) != 0)
{
gerr("ERROR: on_exit failed\n");
twmerr("ERROR: on_exit failed\n");
goto errout;
}
@ -469,7 +469,7 @@ int CNxTerm::nxterm(int argc, char *argv[])
ret = boardctl(BOARDIOC_NXTERM, (uintptr_t)&nxcreate);
if (ret < 0)
{
gerr("ERROR: boardctl(BOARDIOC_NXTERM) failed: %d\n", errno);
twmerr("ERROR: boardctl(BOARDIOC_NXTERM) failed: %d\n", errno);
goto errout;
}
@ -494,7 +494,7 @@ int CNxTerm::nxterm(int argc, char *argv[])
#endif
if (fd < 0)
{
gerr("ERROR: Failed open the console device\n");
twmerr("ERROR: Failed open the console device\n");
(void)unlink(devname);
goto errout;
}
@ -623,7 +623,7 @@ IApplication *CNxTermFactory::create(void)
CApplicationWindow *window = m_twm4nx->openApplicationWindow();
if (!window)
{
gerr("ERROR: Failed to create CApplicationWindow\n");
twmerr("ERROR: Failed to create CApplicationWindow\n");
return (IApplication *)0;
}
@ -631,7 +631,7 @@ IApplication *CNxTermFactory::create(void)
if (!window->open())
{
gerr("ERROR: Failed to open CApplicationWindow\n");
twmerr("ERROR: Failed to open CApplicationWindow\n");
delete window;
return (IApplication *)0;
}
@ -642,7 +642,7 @@ IApplication *CNxTermFactory::create(void)
CNxTerm *nxterm = new CNxTerm(m_twm4nx, window);
if (!nxterm)
{
gerr("ERROR: Failed to instantiate CNxTerm\n");
twmerr("ERROR: Failed to instantiate CNxTerm\n");
delete window;
return (IApplication *)0;
}

View File

@ -309,6 +309,15 @@ bool CTwm4Nx::run(void)
return false;
}
// Now, complete the initialization of some preceding instances that
// depend on the Main Menu being in place
if (!m_iconmgr->addMenuItems())
{
cleanup();
return false;
}
// Cache a CResize instance for use across the session
m_resize = new CResize(this);

View File

@ -139,6 +139,7 @@ CWindow::CWindow(CTwm4Nx *twm4nx)
m_nxWin = (FAR NXWidgets::CNxTkWindow *)0;
m_toolbar = (FAR NXWidgets::CNxToolbar *)0;
m_minWidth = 1;
m_zoom = ZOOM_NONE;
m_modal = false;
@ -223,6 +224,15 @@ bool CWindow::initialize(FAR const NXWidgets::CNxString &name,
m_name.setText(name);
}
// Get the minimum window size. We need this minimum later for resizing.
// If there is no toolbar, leave the minimum at one pixel as it was set by
// the constructor.
if (WFLAGS_HAVE_TOOLBAR(flags))
{
m_minWidth = minimumToolbarWidth(m_twm4nx, m_name, flags);
}
// Do initial clip to the maximum window size
struct nxgl_size_s maxWindow;
@ -348,38 +358,6 @@ bool CWindow::initialize(FAR const NXWidgets::CNxString &name,
return true;
}
/**
* CWindow Initializer (unlike the constructor, this may fail)
*
* @param name The the name of the window (and its icon)
* @param pos The initialize position of the window
* @param size The initial size of the window
* @param sbitmap The Icon bitmap image. null if no icon.
* @param iconMgr Pointer to icon manager instance
* @param flags Toolbar customizations see WFLAGS_NO_* definition
* @return True if the window was successfully initialize; false on
* any failure,
*/
bool CWindow::initialize(FAR const char *name,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_size_s *size,
FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap,
FAR CIconMgr *iconMgr, uint8_t flags)
{
NXWidgets::CNxString nxname;
if (name == (FAR const char *)0)
{
nxname.setText(GNoName);
}
else
{
nxname.setText(name);
}
return initialize(nxname, pos, size, sbitmap, iconMgr, flags);
}
/**
* Get the raw window size (including toolbar and frame)
*
@ -406,12 +384,12 @@ bool CWindow::getFrameSize(FAR struct nxgl_size_s *framesize)
* Update the window frame after a resize operation (includes the toolbar
* and user window)
*
* @param size The new window frame size
* @param pos The frame location which may also have changed
* @param frameSize The new window frame size
* @param framePos The frame location which may also have changed
*/
bool CWindow::resizeFrame(FAR const struct nxgl_size_s *size,
FAR struct nxgl_point_s *pos)
bool CWindow::resizeFrame(FAR const struct nxgl_size_s *frameSize,
FAR const struct nxgl_point_s *framePos)
{
// Account for toolbar and border
@ -419,25 +397,25 @@ bool CWindow::resizeFrame(FAR const struct nxgl_size_s *size,
delta.w = 2 * CONFIG_NXTK_BORDERWIDTH;
delta.h = m_tbHeight + 2 * CONFIG_NXTK_BORDERWIDTH;
// Don't set the window size smaller than one pixel
// Don't set the window size smaller than the minimum window size
struct nxgl_size_s winsize;
if (size->w <= delta.w)
if (frameSize->w <= m_minWidth + delta.w)
{
winsize.w = 1;
winsize.w = m_minWidth;
}
else
{
winsize.w = size->w - delta.w;
winsize.w = frameSize->w - delta.w;
}
if (size->h <= delta.h)
if (frameSize->h <= delta.h)
{
winsize.h = 1;
}
else
{
winsize.h = size->h - delta.h;
winsize.h = frameSize->h - delta.h;
}
// Set the usable window size
@ -449,13 +427,16 @@ bool CWindow::resizeFrame(FAR const struct nxgl_size_s *size,
return false;
}
// Set the new frame position (in case it changed too)
success = setFramePosition(pos);
if (!success)
if (framePos != (FAR const struct nxgl_point_s *)0)
{
twmerr("ERROR: Failed to setSize()\n");
return false;
// Set the new frame position (in case it changed too)
success = setFramePosition(framePos);
if (!success)
{
twmerr("ERROR: Failed to setFramePosition()\n");
return false;
}
}
// Synchronize with the NX server to make sure that the new geometry is
@ -508,7 +489,13 @@ bool CWindow::setFramePosition(FAR const struct nxgl_point_s *framepos)
return m_nxWin->setPosition(&winpos);
}
void CWindow::iconify(void)
/**
* Minimize (iconify) the window
*
* @return True if the operation was successful
*/
bool CWindow::iconify(void)
{
if (!isIconified())
{
@ -522,6 +509,8 @@ void CWindow::iconify(void)
m_iconified = true;
m_nxWin->hide();
// Menu windows don't have an icon
if (m_iconWidget != (FAR CIconWidget *)0)
{
// Enable and redraw the icon widget and lower the main window
@ -534,9 +523,17 @@ void CWindow::iconify(void)
m_nxWin->synchronize();
}
return true;
}
void CWindow::deIconify(void)
/**
* De-iconify the window
*
* @return True if the operation was successful
*/
bool CWindow::deIconify(void)
{
// De-iconify the window
@ -570,7 +567,7 @@ void CWindow::deIconify(void)
FAR CBackground *backgd = m_twm4nx->getBackground();
if (!backgd->redrawBackgroundWindow(&rect, false))
{
gerr("ERROR: redrawBackgroundWindow() failed\n");
twmerr("ERROR: redrawBackgroundWindow() failed\n");
}
}
@ -578,6 +575,8 @@ void CWindow::deIconify(void)
m_nxWin->synchronize();
}
return true;
}
/**
@ -604,7 +603,7 @@ bool CWindow::event(FAR struct SEventMsg *eventmsg)
case EVENT_WINDOW_DEICONIFY: // De-iconify and raise the main window
{
deIconify();
success = deIconify();
}
break;
@ -627,7 +626,7 @@ bool CWindow::event(FAR struct SEventMsg *eventmsg)
{
// Minimize (iconify) the window
iconify();
success = iconify();
}
break;
@ -723,10 +722,12 @@ bool CWindow::createMainWindow(FAR const nxgl_size_s *winsize,
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, (FAR void *)this);
control->registerDragEventHandler(this, (uintptr_t)1);
// 4. Create the window
// 4. Create the window. Handling provided flags. NOTE: that menu windows
// are always created hidden and in the iconified state (although they
// have no icons)
uint8_t cflags = NXBE_WINDOW_RAMBACKED;
if (WFLAGS_IS_HIDDEN_WINDOW(flags))
if (WFLAGS_IS_HIDDEN(flags) | WFLAGS_IS_MENU(flags))
{
cflags |= NXBE_WINDOW_HIDDEN;
}
@ -760,6 +761,10 @@ bool CWindow::createMainWindow(FAR const nxgl_size_s *winsize,
return false;
}
// Menu windows are always created hidden and in the iconified state
// (although they have no icons)
m_iconified = WFLAGS_IS_MENU(flags);
return true;
}
@ -1542,7 +1547,7 @@ bool CWindow::windowDrag(FAR struct SEventMsg *eventmsg)
struct nxgl_point_s oldPos;
if (!getFramePosition(&oldPos))
{
gerr("ERROR: getFramePosition() failed\n") ;
twmerr("ERROR: getFramePosition() failed\n") ;
return false;
}
@ -1592,7 +1597,7 @@ bool CWindow::windowDrag(FAR struct SEventMsg *eventmsg)
{
if (!setFramePosition(&newPos))
{
gerr("ERROR: setFramePosition failed\n");
twmerr("ERROR: setFramePosition failed\n");
return false;
}

View File

@ -106,11 +106,11 @@ CWindowFactory::~CWindowFactory(void)
*/
FAR CWindow *
CWindowFactory::createWindow(FAR const char *name,
CWindowFactory::createWindow(FAR NXWidgets::CNxString &name,
FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap,
FAR CIconMgr *iconMgr, uint8_t flags)
{
twminfo("name=%p\n", name);
twminfo("flags=%02x\n", flags);
// Allocate a container for the Twm4NX window
@ -118,8 +118,7 @@ FAR CWindow *
(FAR struct SWindow *)std::zalloc(sizeof(struct SWindow));
if (win == (FAR struct SWindow *)0)
{
twmerr("ERROR: Unable to allocate memory to manage window %s\n",
name);
twmerr("ERROR: Unable to allocate memory to manage window\n");
return (FAR CWindow *)0;
}
@ -180,16 +179,20 @@ FAR CWindow *
m_winpos.x += 30;
m_winpos.y += 30;
// Add the window into the Twm4Nx window list
// Add the window into the window list
addWindow(win);
addWindowContainer(win);
// Add the window container to the icon manager
// Add the window to the icon manager if it is a regular window (i.e., if
// it is not the Icon Manager Window and it is not a Menu Window)
CIconMgr *iconmgr = m_twm4nx->getIconMgr();
DEBUGASSERT(iconmgr != (CIconMgr *)0);
if (!WFLAGS_IS_ICONMGR(flags) && !WFLAGS_IS_MENU(flags))
{
CIconMgr *iconmgr = m_twm4nx->getIconMgr();
DEBUGASSERT(iconmgr != (CIconMgr *)0);
(void)iconmgr->add(win->cwin);
(void)iconmgr->addWindow(win->cwin);
}
// Return the contained window
@ -226,9 +229,18 @@ void CWindowFactory::destroyWindow(FAR CWindow *cwin)
{
// Remove the window container from the window list
removeWindow(win);
removeWindowContainer(win);
}
// Remove the window from the Icon Manager
// Add the window to the icon manager
CIconMgr *iconmgr = m_twm4nx->getIconMgr();
DEBUGASSERT(iconmgr != (CIconMgr *)0);
(void)iconmgr->removeWindow(cwin);
// Delete the contained CWindow instance
delete cwin;
@ -297,7 +309,7 @@ bool CWindowFactory::event(FAR struct SEventMsg *eventmsg)
* @param win. The window container to be added to the list.
*/
void CWindowFactory::addWindow(FAR struct SWindow *win)
void CWindowFactory::addWindowContainer(FAR struct SWindow *win)
{
win->blink = (FAR struct SWindow *)0;
win->flink = m_windowHead;
@ -316,7 +328,7 @@ void CWindowFactory::addWindow(FAR struct SWindow *win)
* @param win. The window container to be removed from the list.
*/
void CWindowFactory::removeWindow(FAR struct SWindow *win)
void CWindowFactory::removeWindowContainer(FAR struct SWindow *win)
{
FAR struct SWindow *prev = win->blink;
FAR struct SWindow *next = win->flink;

View File

@ -228,6 +228,19 @@ namespace NXWidgets
return false;
}
/**
* Return true if the window is currently being displayed
*
* @return Always returns true.
*/
inline bool isVisible(void)
{
// The background is always visible (although perhaps obscured)
return true;
}
/**
* Show a hidden window
*

View File

@ -248,6 +248,17 @@ namespace NXWidgets
return nxtk_lower(m_hNxTkWindow) == OK;
}
/**
* Return true if the window is currently being displayed
*
* @return True if the window is visible
*/
inline bool isVisible(void)
{
return !nxtk_ishidden(m_hNxTkWindow);
}
/**
* Show a hidden window
*

View File

@ -222,31 +222,38 @@ namespace NXWidgets
}
/**
* Show a hidden window. The toolbar is a component of the containing,
* Return true if the toolbar is currently being displayed
*
* @return True if the window is visible
*/
inline bool isVisible(void)
{
return !nxtk_ishidden(m_hNxTkWindow);
}
/**
* Show a hidden toolbar. The toolbar is a component of the containing,
* parent, framed window. It cannot be shown separately.
*
* @return Always returns false.
* @return True on success, false on any failure.
*/
inline bool show(void)
{
// The background is always visible (although perhaps obscured)
return false;
return nxtk_setvisibility(m_hNxTkWindow, false) == OK;
}
/**
* Hide a visible window. The toolbar is a component of the containing,
* parent, framed window. It cannot be hidden separately.
*
* @return Always returns false.
* @return True on success, false on any failure.
*/
inline bool hide(void)
{
// The background cannot be hidden
return false;
return nxtk_setvisibility(m_hNxTkWindow, true) == OK;
}
/**

View File

@ -217,6 +217,17 @@ namespace NXWidgets
return nx_lower(m_hNxWindow) == OK;
}
/**
* Return true if the window is currently being displayed
*
* @return True if the window is visible
*/
inline bool isVisible(void)
{
return !nx_ishidden(m_hNxWindow);
}
/**
* Show a hidden window
*

View File

@ -190,6 +190,14 @@ namespace NXWidgets
virtual bool lower(void) = 0;
/**
* Return true if the window is currently being displayed
*
* @return True if the window is visible
*/
virtual bool isVisible(void) = 0;
/**
* Show a hidden window
*

View File

@ -52,7 +52,9 @@
#include <nuttx/nx/nxglib.h>
#include "graphics/twm4nx/cwindow.hxx"
#include "graphics/twm4nx/ctwm4nxevent.hxx"
#include "graphics/twm4nx/cmainmenu.hxx"
#include "graphics/twm4nx/iapplication.hxx"
#include "graphics/twm4nx/twm4nx_widgetevents.hxx"
/////////////////////////////////////////////////////////////////////////////
// Implementation Classes
@ -83,12 +85,15 @@ namespace Twm4Nx
bool down;
};
class CIconMgr : protected NXWidgets::CWidgetEventHandler, public CTwm4NxEvent
class CIconMgr : protected NXWidgets::CWidgetEventHandler,
protected IApplication,
public CTwm4NxEvent
{
private:
FAR CTwm4Nx *m_twm4nx; /**< Cached Twm4Nx session */
mqd_t m_eventq; /**< NxWidget event message queue */
NXWidgets::CNxString m_name; /**< The Icon Manager name */
FAR struct SWindowEntry *m_head; /**< Head of the window list */
FAR struct SWindowEntry *m_tail; /**< Tail of the window list */
FAR struct SWindowEntry *m_active; /**< The active entry */
@ -138,6 +143,15 @@ namespace Twm4Nx
void removeEntry(FAR struct SWindowEntry *wentry);
/**
* Find an entry in the icon manager
*
* @param cwin The window to find
* @return The incon manager entry (unless an error occurred)
*/
FAR struct SWindowEntry *findEntry(FAR CWindow *cwin);
/**
* Set active window
*
@ -161,13 +175,82 @@ namespace Twm4Nx
void freeWEntry(FAR struct SWindowEntry *wentry);
/**
* Handle a widget action event. This will be a button pre-release event.
* Handle a widget action event, overriding the CWidgetEventHandler
* method. This will indicate a button pre-release event.
*
* @param e The event data.
*/
void handleActionEvent(const NXWidgets::CWidgetEventArgs &e);
/**
* Return the name of the application. This is the string that will
* appear in the Main Menu item. This overrides the method from
* IApplication
*
* @param name The name of the application.
*/
inline const NXWidgets::CNxString getName(void)
{
return m_name;
}
/**
* 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. This overrides
* the method from IApplication.
*
* @return This implementation will always return a null value.
*/
inline FAR CMenus *getSubMenu(void)
{
return (FAR CMenus *)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. This function will not be called in this implementation
*
* @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.
*/
inline void start(FAR CTwm4Nx *twm4nx)
{
}
/**
* External applications may provide their own event handler that runs
* when the the menu item is selection. If so, then this method will
* return the instance of CTwm4NxEvent that will handle the event. This
* method always returns NULL in this case.
*
* @return. null is always returned in this impementation.
*/
inline FAR CTwm4NxEvent *getEventHandler(void)
{
return (FAR CTwm4NxEvent *)0;
}
/**
* Get the Twm4Nx event that will be generated when the menu item is
* selected.
*
* @return. This function returns .
*/
inline uint16_t getEvent(void)
{
return EVENT_ICONMGR_DEICONIFY;
}
public:
/**
@ -186,28 +269,40 @@ namespace Twm4Nx
~CIconMgr(void);
/**
* Create and initialize the icon manager window
* Create and initialize the icon manager window.
*
* @param name The prefix for this icon manager name
* @return True on success
*/
bool initialize(FAR const char *prefix);
/**
* Add a window to an the icon manager
* Add Icon Manager menu items to the Main menu. This is really a
* part of the logic that belongs in initialize() but cannot be
* executed in that context because it assumes that the Main Menu
* logic is ready.
*
* @param win the TWM window structure
* @return True on success
*/
bool add(FAR CWindow *win);
bool addMenuItems(void);
/**
* Add a window to an the icon manager
*
* @param cwin the TWM window structure
*/
bool addWindow(FAR CWindow *cwin);
/**
* Remove a window from the icon manager
*
* @param win the TWM window structure
* @param cwin the TWM window structure
*/
void remove(FAR struct SWindow *win);
void removeWindow(FAR CWindow *cwin);
/**
* Hide the icon manager

View File

@ -101,6 +101,16 @@ namespace Twm4Nx
void removeEntry(FAR struct SMainMenuItem *mmitem);
/**
* Select a position for the Main Menu which is as close as possible
* the background click position.
*
* @param clickPos The background click position
* @return True is returned if the position was set correctly
*/
bool selectMainMenuPosition(FAR const struct nxgl_point_s &clickPos);
public:
/**

View File

@ -123,7 +123,6 @@ namespace Twm4Nx
uint16_t m_nMenuItems; /**< Number of items in the menu */
uint8_t m_menuDepth; /**< Number of menus up */
bool m_menuPull; /**< Is there a pull right entry? */
bool m_visible; /**< True: The menu is visible */
char m_info[INFO_LINES][INFO_SIZE];
void identify(FAR CWindow *cwin);
@ -185,10 +184,18 @@ namespace Twm4Nx
bool createMenuWindow(void);
/**
* Calculate the optimal menu frame size
*
* @param frameSize The location to return the calculated frame size
*/
void getMenuFrameSize(FAR struct nxgl_size_s &frameSize);
/**
* Calculate the optimal menu window size
*
* @result True is returned on success
* @param size The location to return the calculated window size
*/
void getMenuWindowSize(FAR struct nxgl_size_s &size);
@ -298,28 +305,62 @@ namespace Twm4Nx
FAR CTwm4NxEvent *handler, uint16_t event);
/**
* Return true if the main menu is currently being displayed
* Return the size of the menu window frame
*
* @param frameSize The location in which to return the current menu
* window frame size.
* @result True is returned on success
*/
bool getFrameSize(FAR struct nxgl_size_s *frameSize)
{
return m_menuWindow->getFrameSize(frameSize);
}
/**
* Set the position of the menu window frame
*
* @param framePos The new menum window frame position
* @result True is returned on success
*/
bool getFramePosition(FAR struct nxgl_point_s *framePos)
{
return m_menuWindow->getFramePosition(framePos);
}
/**
* Set the position of the menu window frame
*
* @param framePos The new menum window frame position
* @result True is returned on success
*/
bool setFramePosition(FAR const struct nxgl_point_s *framePos)
{
return m_menuWindow->setFramePosition(framePos);
}
/**
* Return true if the menu is currently being displayed
*
* @return True if the menu is visible
*/
inline bool isVisible(void)
{
return m_visible;
return !m_menuWindow->isIconified();
}
/**
* Make the menu visible.
*
* @return True if the main menu is shown.
* @return True if the menu is shown.
*/
inline bool show(void)
{
if (!m_visible)
{
m_visible = m_menuWindow->showWindow();
}
return m_visible;
return m_menuWindow->deIconify();
}
/**
@ -330,12 +371,7 @@ namespace Twm4Nx
inline bool hide(void)
{
if (m_visible)
{
m_visible = !m_menuWindow->hideWindow();
}
return !m_visible;
return m_menuWindow->iconify();
}
/**

View File

@ -88,23 +88,26 @@
#define NO_TOOLBAR (NTOOLBAR_BUTTONS + 0)
#define ICONMGR_WINDOW (NTOOLBAR_BUTTONS + 1)
#define HIDDEN_WINDOW (NTOOLBAR_BUTTONS + 2)
#define MENU_WINDOW (NTOOLBAR_BUTTONS + 2)
#define HIDDEN_WINDOW (NTOOLBAR_BUTTONS + 3)
#define WFLAGS_NO_MENU_BUTTON (1 << MENU_BUTTON)
#define WFLAGS_NO_DELETE_BUTTON (1 << DELETE_BUTTON)
#define WFLAGS_NO_RESIZE_BUTTON (1 << RESIZE_BUTTON)
#define WFLAGS_NO_MINIMIZE_BUTTON (1 << MINIMIZE_BUTTON)
#define WFLAGS_NO_TOOLBAR (1 << NO_TOOLBAR)
#define WFLAGS_IS_ICONMGR (1 << ICONMGR_WINDOW)
#define WFLAGS_HIDDEN_WINDOW (1 << HIDDEN_WINDOW)
#define WFLAGS_ICONMGR (1 << ICONMGR_WINDOW)
#define WFLAGS_MENU (1 << MENU_WINDOW)
#define WFLAGS_HIDDEN (1 << HIDDEN_WINDOW)
#define WFLAGS_HAVE_MENU_BUTTON(f) (((f) & WFLAGS_NO_MENU_BUTTON) == 0)
#define WFLAGS_HAVE_DELETE_BUTTON(f) (((f) & WFLAGS_NO_DELETE_BUTTON) == 0)
#define WFLAGS_HAVE_RESIZE_BUTTON(f) (((f) & WFLAGS_NO_RESIZE_BUTTON) == 0)
#define WFLAGS_HAVE_MINIMIZE_BUTTON(f) (((f) & WFLAGS_NO_MINIMIZE_BUTTON) == 0)
#define WFLAGS_HAVE_TOOLBAR(f) (((f) & WFLAGS_NO_TOOLBAR) == 0)
#define WFLAGS_IS_ICONMGR_WINDOW(f) (((f) & WFLAGS_IS_ICONMGR) != 0)
#define WFLAGS_IS_HIDDEN_WINDOW(f) (((f) & WFLAGS_HIDDEN_WINDOW) != 0)
#define WFLAGS_IS_ICONMGR(f) (((f) & WFLAGS_ICONMGR) != 0)
#define WFLAGS_IS_MENU(f) (((f) & WFLAGS_MENU) != 0)
#define WFLAGS_IS_HIDDEN(f) (((f) & WFLAGS_HIDDEN) != 0)
/////////////////////////////////////////////////////////////////////////////
// Implementation Classes
@ -141,6 +144,7 @@ namespace Twm4Nx
NXWidgets::CNxString m_name; /**< Name of the window */
FAR NXWidgets::CNxTkWindow *m_nxWin; /**< The contained NX primary window */
nxgl_coord_t m_minWidth; /**< The minimum width of the window */
uint16_t m_zoom; /**< Window zoom: ZOOM_NONE or EVENT_RESIZE_* */
bool m_modal; /**< Window zoom: ZOOM_NONE or EVENT_RESIZE_* */
@ -403,12 +407,6 @@ namespace Twm4Nx
FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap,
FAR CIconMgr *iconMgr, uint8_t flags);
bool initialize(FAR const char *name,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_size_s *size,
FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap,
FAR CIconMgr *iconMgr, uint8_t flags = 0);
/**
* Synchronize the window with the NX server. This function will delay
* until the the NX server has caught up with all of the queued requests.
@ -446,7 +444,7 @@ namespace Twm4Nx
inline bool isIconMgr(void)
{
return WFLAGS_IS_ICONMGR_WINDOW(m_tbFlags);
return WFLAGS_IS_ICONMGR(m_tbFlags);
}
/**
@ -532,16 +530,32 @@ namespace Twm4Nx
return m_nxWin->lower();
}
/**
* Return true if the window is currently being displayed
*
* @return True if the window is visible
*/
inline bool isWindowVisible(void)
{
return m_nxWin->isVisible();
}
/**
* Show a hidden window
*
* @return True if the operation was successful
*/
inline bool showWindow(void)
{
return m_nxWin->show();
}
/**
* Hide a visible window
*
* @return True if the operation was successful
*/
inline bool hideWindow(void)
@ -601,6 +615,7 @@ namespace Twm4Nx
* Get the raw window size (including toolbar and frame)
*
* @param framesize Location to return the window frame size
* @return True if the operation was successful
*/
bool getFrameSize(FAR struct nxgl_size_s *framesize);
@ -609,17 +624,20 @@ namespace Twm4Nx
* Update the window frame after a resize operation (includes the toolbar
* and user window)
*
* @param size The new window frame size
* @param pos The frame location which may also have changed
* @param frameSize The new window frame size
* @param framePos The frame location which may also have changed (NULL
* may be used to preserve the current position)
* @return True if the operation was successful
*/
bool resizeFrame(FAR const struct nxgl_size_s *framesize,
FAR struct nxgl_point_s *framepos);
bool resizeFrame(FAR const struct nxgl_size_s *frameSize,
FAR const struct nxgl_point_s *framePos);
/**
* Get the raw frame position (accounting for toolbar and frame)
*
* @param framepos Location to return the window frame position
* @return True if the operation was successful
*/
bool getFramePosition(FAR struct nxgl_point_s *framepos);
@ -628,22 +646,31 @@ namespace Twm4Nx
* Set the raw frame position (accounting for toolbar and frame)
*
* @param framepos The new raw window position
* @return True if the operation was successful
*/
bool setFramePosition(FAR const struct nxgl_point_s *framepos);
/* Minimize (iconify) the window */
/**
* Minimize (iconify) the window
*
* @return True if the operation was successful
*/
void iconify(void);
bool iconify(void);
/**
* De-iconify the window
*
* @return True if the operation was successful
*/
void deIconify(void);
bool deIconify(void);
/**
* Is the window iconified?
*
* @return True if the operation was successful
*/
inline bool isIconified(void)
@ -653,6 +680,8 @@ namespace Twm4Nx
/**
* Has the Icon moved?
*
* @return True if the operation was successful
*/
inline bool hasIconMoved(void)

View File

@ -100,7 +100,7 @@ namespace Twm4Nx
* @param win. The window container to be added to the list.
*/
void addWindow(FAR struct SWindow *win);
void addWindowContainer(FAR struct SWindow *win);
/**
* Remove a window container from the window list.
@ -108,7 +108,7 @@ namespace Twm4Nx
* @param win. The window container to be removed from the list.
*/
void removeWindow(FAR struct SWindow *win);
void removeWindowContainer(FAR struct SWindow *win);
/**
* Find the window container that contains the specified window.
@ -147,7 +147,7 @@ namespace Twm4Nx
*/
FAR CWindow *
createWindow(FAR const char *name,
createWindow(FAR NXWidgets::CNxString &name,
FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap,
FAR CIconMgr *iconMgr, uint8_t flags);

View File

@ -83,10 +83,10 @@ namespace Twm4Nx
* Return the name of the application. This is the string that will
* appear in the Main Menu item.
*
* @param name The name of the application.
* @return The name of the application.
*/
virtual void getName(const NXWidgets::CNxString &text) = 0;
virtual const NXWidgets::CNxString getName(void) = 0;
/**
* Return any submenu item associated with the menu entry. If a non-

View File

@ -122,6 +122,8 @@ namespace Twm4Nx
// Recipient == ICONMGR
EVENT_ICONMGR_DEICONIFY = 0x3000, /**< De-iconify or raise the Icon Manager */
// Recipient == MENU
EVENT_MENU_IDENTIFY = 0x4000, /**< Describe the window */
@ -176,10 +178,10 @@ namespace Twm4Nx
};
// Contexts for button press events. These basically identify the sender
// of the event message.
// Contexts for events. These basically identify the source of the event
// message.
enum EButtonContext
enum EEventContext
{
EVENT_CONTEXT_WINDOW = 0,
EVENT_CONTEXT_TOOLBAR,
@ -187,8 +189,7 @@ namespace Twm4Nx
EVENT_CONTEXT_ICON,
EVENT_CONTEXT_FRAME,
EVENT_CONTEXT_ICONMGR,
EVENT_CONTEXT_NAME,
EVENT_CONTEXT_IDENTIFY,
EVENT_CONTEXT_MENU,
NUM_CONTEXTS
};