Menu and Popup

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search

Written for CEGUI 0.5


Works with versions 0.5.x (obsolete)

Written for CEGUI 0.6


Works with versions 0.6.x (obsolete)

Introduction

This code demonstrates the usage of a menu as well as popup menus, created from the Layout Editor.

Please discuss this snippet within the Menu and Submenus thread.

This message board post demonstrates the creation of a menu via code rather than loaded from a .layout file.

Menu

The Menubar widget creates a menu bar, an horizontal bar containing top-level popup menus. Traditionally menu bars are displayed just below the title bar however the Cegui menubar is not bound by this limitation; it could be placed at the bottom of a FrameWindow, or even outside of a FrameWindow.

The configureMenu() function recursively traverses a menu hierarchy and registers three events: EventMouseEnters, EventMouseLeaves, and EventClicked.

The most important event triggered by a menu is the selection of a menu item. This is accomplished by subscribing to the MenuItem::EventClicked event. This code is within the onMenuItemClicked() function.

Another noteworthy event is PopupMenu::EventPopupOpened, allowing you to modify the menuitems that are displayed, such as potentially (not presented here) enabling/disabling items or changing the displayed text. This is an approach to have menus query the application to determin the state of the menu items that will be presented to the user; for example disabling a "paste" menuitem when there is nothing to paste.

The demo subscribes to the MenuItem::EventMouseEnters event for two features. The first is to display a message when the mouse hovers over a menuitem. The text displayed is stored within the Tooltip property within the Layout Editor. The second is to automatically open a submenu. This code is within the onMouseEntersMenuItem() function.

The code to automatically close a menu (when the mouse leaves) is within the onMouseLeavesMenuItem() and onMouseLeavesPopupMenuItem() functions, called in response to a MenuItem::EventMouseLeaves event.

By subscribing to the Window::EventCharacterKey event it becomes possible to open the menu in response to a special key. The ALT key will not work in windowed mode (as opposed to fullscreen), since it is a system key. Try pressing ALT followed by SPACE; the system menu will open (the menu in the upper left corner of a Windows window). I've used the SLASH "/" key as an alternate. Note that for the slash key to open the menu the FrameWindow must possess the focus.

Popup Menu

Since the Layout Editor does not allow us to create popup menus directly, I opted to reuse the menubar. Traditionally a menu bar contains horizontal categories and within each category are sub-categories. Since an application may contain numerous popup menus we would rapidly run out of space. A better approach is to have a menu bar with a single top-level menu and popup menus defined as its sub-menus.

For example:

  • Popup Menubar
    • Popup Menu 1
      • Item 1.1
      • Item 1.2
    • Popup Menu 2
      • Item 2.1
      • Item 2.2

Should you run out of room vertically then a second top-level menu could be created.

The configureMenu() is called for each popup menu, to automatically open and close their submenus. The Window::EventMouseButtonUp event is used to open the proper popup menu, based on which widget was right-clicked. This code is within the onPopupMenu() function.

The mouse cursor is traditionally displayed to the left of the popup menu. The problem with that is that the cursor hides the first menu item. The value of the mouseToLeftOfPopupMenu variable determines whether the traditional position is used or whether the popup menu is opened such that the mouse cursor appears to the right. The mouseOffset variable specifies the mouse offset from the upper-left or the upper-right corner. In addition the popup menu is moved to prevent it from opening offscreen.

To add menuitems runtime to a popupMenu you add a CEGUI::Window childWindow to the popupMenu. You don't create a new CEGUI::MenuItem as you might think:

CEGUI::PopupMenu* popupMenu  = (CEGUI::PopupMenu*)CEGUI::WindowManager::getSingleton().getWindow("Root/Popup/PopupMenus/FirstPopup/AutoPopup");  
CEGUI::Window* menuitem = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/MenuItem");
menuitem->setText("Quit");
menuitem->subscribeEvent("Clicked", Event::Subscriber(&ScrollablePaneSample::fileQuit, this));
popupMenu->addChildWindow(menuitem);

Wishlist

These feature are not implemented but would be nice to have:

  • A delay before automatically opening/closing a submenu.
  • Closing the entire submenu tree when a parent submenu is closed. This way the next time the submenu is opened its children are in their default mode (i.e. closed).
  • Displaying accelerator/shortcut keys to the right of the menuitems.
  • Keyboard navigation through the menus (up, down, left, right). This requires access to the CeguiMenuItem::d_hover variable, which (I think) draws the menuitem as highlighted.
  • Graphical menuitems
  • Support for a separtor (horizontal line) menuitem.
  • Support for a checkbox menuitem, to activate a feature
  • Support for a radiobutton-like group of menuitems, to activate one feature among multiple choices.

Files

Menu_Demo.h

#ifndef _Menu_h_
#define _Menu_h_
 
#include "CEGuiSample.h"
#include "CEGUI.h"
#include "CEGUIDefaultResourceProvider.h"
 
//-------------------------------------------------------------------
// Offset to ensure that the mouse cursor will be within the popup menu
// This will automatically close the popup menu whe the mouse is moved;
// without the offset the mouse is not really within the popup menu.
const float mouseOffset = 5.0f;
 
//-------------------------------------------------------------------
// Specifies whether the popup menu will open to the right (default) or
// to the left of the mouse.  Opening to the left gives better results
// with the Taharez scheme since the mouse cursor is not covering the
// menu item.
const bool mouseToLeftOfPopupMenu = false;
 
//-------------------------------------------------------------------
class DemoSample : public CEGuiSample
{
public:
	//-------------------------------------------------------------------
    bool initialiseSample()
	{
		using namespace CEGUI;
		try
		{
			// Retrieve the window manager
			WindowManager& winMgr = WindowManager::getSingleton();
 
			// Load the TaharezLook scheme and set up the default mouse cursor and font
			SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");
			System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
			if(!FontManager::getSingleton().isFontPresent("Commonwealth-10"))
				FontManager::getSingleton().createFont("Commonwealth-10.font");
 
			// Set the GUI Sheet
			Window* sheet = winMgr.createWindow("DefaultWindow", "root_wnd");
			System::getSingleton().setGUISheet(sheet);
 
			// Load a layout
			Window* guiLayout = winMgr.loadWindowLayout("Menu.layout");
			sheet->addChildWindow(guiLayout);
 
			// Subscribe to the keyboard events to control the menu
			winMgr.getWindow("Root/FrameWindow")->subscribeEvent(CEGUI::Window::EventCharacterKey,	CEGUI::Event::Subscriber(&DemoSample::onMenuKey,	this));
 
			// Configure the menu bar
			configureMenu( winMgr.getWindow("Root/FrameWindow/Menubar"), true );
 
			// Hide the menubar of the popup menus
			winMgr.getWindow("Root/Popup")->hide();
 
			// Configure the popup menus
			configureMenu( winMgr.getWindow("Root/Popup/PopupMenus"),	false );
 
			// These "widgets" will display a contextual popup menu when right-clicked
			winMgr.getWindow("Root/FrameWindow/FirstPopup")->subscribeEvent(CEGUI::Window::EventMouseButtonUp,	CEGUI::Event::Subscriber(&DemoSample::onPopupMenu, this));
			winMgr.getWindow("Root/FrameWindow/SecondPopup")->subscribeEvent(CEGUI::Window::EventMouseButtonUp,	CEGUI::Event::Subscriber(&DemoSample::onPopupMenu, this));
			winMgr.getWindow("Root/FrameWindow")->subscribeEvent(CEGUI::Window::EventMouseButtonUp,				CEGUI::Event::Subscriber(&DemoSample::onPopupMenu, this));
			winMgr.getWindow("Root")->subscribeEvent(CEGUI::Window::EventMouseButtonUp,							CEGUI::Event::Subscriber(&DemoSample::onPopupMenu, this));
		}
		catch(Exception &e)
		{
			#if defined( __WIN32__ ) || defined( _WIN32 )
				MessageBox(NULL, e.getMessage().c_str(), "Error initializing the demo", MB_OK | MB_ICONERROR | MB_TASKMODAL);
			#else
				std::cerr << "Error initializing the demo:" << e.getMessage().c_str() << "\n";
			#endif
		}
 
		return true;
	}
 
	//-------------------------------------------------------------------
    void cleanupSample(void)
	{
	}
 
	//-------------------------------------------------------------------
	void configureMenu(CEGUI::Window* pParent, const bool& pMenubar) 
	{
		// Recursively subscribe every menu item to the mouse enters/leaves/clicked events
		size_t childCount = pParent->getChildCount(); 
		for(size_t childIdx = 0; childIdx < childCount; childIdx++) 
		{ 
			if(pParent->getChildAtIdx(childIdx)->testClassName("MenuItem")
				|| pParent->getChildAtIdx(childIdx)->testClassName("PopupMenu") )
			{ 
				pParent->getChildAtIdx(childIdx)->subscribeEvent(CEGUI::MenuItem::EventMouseEnters,   CEGUI::Event::Subscriber(&DemoSample::onMouseEntersMenuItem, this)); 
				pParent->getChildAtIdx(childIdx)->subscribeEvent(CEGUI::MenuItem::EventMouseLeaves,   pMenubar ?	CEGUI::Event::Subscriber(&DemoSample::onMouseLeavesMenuItem, this)
																												:	CEGUI::Event::Subscriber(&DemoSample::onMouseLeavesPopupMenuItem, this)); 
				if(pParent->getChildAtIdx(childIdx)->testClassName("MenuItem"))
				{
					pParent->getChildAtIdx(childIdx)->subscribeEvent(CEGUI::MenuItem::EventClicked, CEGUI::Event::Subscriber(&DemoSample::onMenuItemClicked, this));
				}
			} 
			configureMenu(pParent->getChildAtIdx(childIdx), pMenubar); 
		} 
	} 
 
	//-------------------------------------------------------------------
	bool onMouseEntersMenuItem(const CEGUI::EventArgs& e)
	{
		// Open or close a submenu
		const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(e);
		CEGUI::MenuItem* menuItem = static_cast<CEGUI::MenuItem*>(we.window);
		if(menuItem)
		{
			setStatusText( menuItem->getTooltipText() );
			if( menuItem->getPopupMenu() )
			{
				if( menuItem->isOpened() )
				{
					if(menuItem->testClassName("MenuItem"))
					{
						menuItem->closePopupMenu();
					}
				}
				else
				{
					menuItem->openPopupMenu();
				}
			}
		}
		else
		{
			setStatusText( "" );
		}
		return true;
	}
 
	//-------------------------------------------------------------------
	bool onMouseLeavesMenuItem(const CEGUI::EventArgs& e)
	{
		// Close a menu
		const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(e);
		setStatusText( "" );
 
		CEGUI::Window* menubar = we.window;
		while(menubar)
		{
			if( menubar->testClassName("Menubar") )
			{
				// We found the root; a menu bar
				CEGUI::Vector2 childPosition = CEGUI::MouseCursor::getSingleton().getPosition();
				CEGUI::Window* windowUnderTheCursor = menubar->getTargetChildAtPosition(childPosition);
				if(!windowUnderTheCursor)
				{
					CEGUI::MenuItem* popupMenu = static_cast<CEGUI::Menubar*>(menubar)->getPopupMenuItem();
					if(popupMenu)
					{
						// This does not close sub-popup menus, only the current one
						popupMenu->closePopupMenu();
					}
				}
				break;
			}
			menubar = menubar->getParent();
		}
 
		return true;
	}
 
	//-------------------------------------------------------------------
	bool onMouseLeavesPopupMenuItem(const CEGUI::EventArgs& e)
	{
		// Close a popup menu
		const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(e);
		setStatusText( "" );
 
		CEGUI::Window* menubar = we.window;
		CEGUI::Window* popupParent;
		while(menubar)
		{
			popupParent = menubar->getParent();
			if( popupParent
				&& !popupParent->testClassName("Menubar")
				&& !popupParent->testClassName("PopupMenu")
				&& !popupParent->testClassName("MenuItem")
				)
			{
				// We found the root; a popup menu
				CEGUI::Window* popupMenu = menubar;
				menubar = menubar->getParent();
				CEGUI::Vector2 childPosition = CEGUI::MouseCursor::getSingleton().getPosition();
				CEGUI::Window* windowUnderTheCursor = menubar->getTargetChildAtPosition(childPosition);
				if(!windowUnderTheCursor)
				{
					popupMenu->hide();
				}
				break;
			}
			menubar = menubar->getParent();
		}
 
		return true;
	}
 
	//-------------------------------------------------------------------
	bool onMenuItemClicked(const CEGUI::EventArgs& e)
	{
		const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(e);
		setStatusText( "Clicked " + we.window->getName() );
		return true;
	}
 
	//-------------------------------------------------------------------
	bool onMenuKey(const CEGUI::EventArgs& e)
	{
		// Open or close a menu
		const CEGUI::KeyEventArgs& ke = static_cast<const CEGUI::KeyEventArgs&>(e);
		if(ke.sysKeys == CEGUI::Key::LeftAlt
			|| ke.sysKeys == CEGUI::Key::RightAlt
			|| ke.sysKeys == CEGUI::Key::Slash
			|| ke.codepoint == 47) // Slash
		{
			CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
			CEGUI::Menubar* menuBar = static_cast<CEGUI::Menubar*>(winMgr.getWindow("Root/FrameWindow/Menubar"));
			CEGUI::MenuItem* menuItem = menuBar->getPopupMenuItem();
			if(menuItem)
			{
				// There's a menu opened, let's close it
				menuBar->changePopupMenuItem(0);
			}
			else
			{
				// The menu is closed, let's open the first menu
				menuItem = static_cast<CEGUI::MenuItem*>(winMgr.getWindow("Root/FrameWindow/Menubar/File"));
				menuBar->changePopupMenuItem(menuItem);
 
				// Select the first item from this menu ??
			}
		}
 
		return true;
	}
 
	//-------------------------------------------------------------------
	bool onPopupMenu(const CEGUI::EventArgs& e)
	{
		// Open a context-sensitive menu
		const CEGUI::MouseEventArgs& me = static_cast<const CEGUI::MouseEventArgs&>(e);
		if(me.button == CEGUI::RightButton)
		{
			CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
			CEGUI::PopupMenu* popupMenu = 0;
			if(me.window->getName().compare("Root/FrameWindow/FirstPopup") == 0)
			{
				popupMenu = static_cast<CEGUI::PopupMenu*>(winMgr.getWindow("Root/Popup/PopupMenus/FirstPopup/AutoPopup"));
			}
			else if(me.window->getName().compare("Root/FrameWindow/SecondPopup") == 0)
			{
				popupMenu = static_cast<CEGUI::PopupMenu*>(winMgr.getWindow("Root/Popup/PopupMenus/SecondPopup/AutoPopup"));
			}
			else if(me.window->getName().compare("Root/FrameWindow") == 0)
			{
				popupMenu = static_cast<CEGUI::PopupMenu*>(winMgr.getWindow("Root/Popup/PopupMenus/FramePopup/AutoPopup"));
			}
			else if(me.window->getName().compare("Root") == 0)
			{
				popupMenu = static_cast<CEGUI::PopupMenu*>(winMgr.getWindow("Root/Popup/PopupMenus/SheetPopup/AutoPopup"));
			}
 
			if(popupMenu)
			{
				// Make the window the popup's parent
				me.window->addChildWindow(popupMenu);
 
				// Position of the popup menu
				CEGUI::UVector2 popupPosition;
 
				// Ensure the popup menu will be fully displayed horizontally on the screen
				float screenWidth = CEGUI::System::getSingleton().getRenderer()->getWidth();
				float popupMenuWidth = popupMenu->getWidth().d_offset;
				if(popupMenuWidth < screenWidth)
				{
					// The x coordinate is either the mouse position or the right side of the
					// screen minus the width of the popup menu.  This ensures that the popup
					// menu is fully displayed rather than clipped.
					float x;
					if(mouseToLeftOfPopupMenu)
					{
						x = me.position.d_x + popupMenuWidth > screenWidth ? screenWidth - popupMenuWidth
																		   : me.position.d_x - mouseOffset;
					}
					else
					{
						x = me.position.d_x < popupMenuWidth ? 0.0f
															 : me.position.d_x - popupMenuWidth + mouseOffset;
					}
					popupPosition.d_x = cegui_absdim(CEGUI::CoordConverter::screenToWindowX(*me.window, x));
				}
				else
				{
					// The popup menu is too wide to fit within the screen
					popupPosition.d_x = CEGUI::UDim(0.0f, 0.0f);
				}
 
				// Ensure the popup menu will be fully displayed vertically on the screen
				float screenHeight = CEGUI::System::getSingleton().getRenderer()->getHeight();
				float popupMenuHeight = popupMenu->getHeight().d_offset;
				if(popupMenuHeight < screenHeight)
				{
					// The y coordinate is either the mouse position or the bottom side of the
					// screen minus the height of the popup menu.  This ensures that the popup
					// menu is fully displayed rather than clipped.
					float y = me.position.d_y + popupMenuHeight > screenHeight ? screenHeight - popupMenuHeight
																			   : me.position.d_y - mouseOffset;
					popupPosition.d_y = cegui_absdim(CEGUI::CoordConverter::screenToWindowY(*me.window, y));
				}
				else
				{
					// The popup menu is too tall to fit within the screen
					popupPosition.d_y = CEGUI::UDim(0.0f, 0.0f);
				}
 
				// Position the context menu
				popupMenu->setPosition(popupPosition);
 
				// Show the popup menu
				popupMenu->show();
 
				// Ensure it appears on top of the other widgets
				popupMenu->moveToFront();
			}
		}
		return true;
	}
 
	//-------------------------------------------------------------------
	void setStatusText(const CEGUI::String& pText)
	{
		CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
		winMgr.getWindow("Root/FrameWindow/Status")->setText(pText);
	}
 
private:
 
};
 
#endif // _Menu_h_

Main.cpp

#if defined( __WIN32__ ) || defined( _WIN32 )
	#define WIN32_LEAN_AND_MEAN
	#define NOMINMAX
	#include "windows.h"
#endif
 
#include "Menu_demo.h"
 
#if defined( __WIN32__ ) || defined( _WIN32 )
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow)
#else
int main(int argc, char *argv[])
#endif
{
    DemoSample app;
    int i = app.run();
    return i;
}

Menu.layout

<?xml version="1.0" encoding="UTF-8"?>
 
<GUILayout >
    <Window Type="DefaultWindow" Name="Root" >
        <Property Name="InheritsAlpha" Value="False" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Window Type="TaharezLook/FrameWindow" Name="Root/FrameWindow" >
            <Property Name="TitlebarFont" Value="Commonwealth-10" />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="TitlebarEnabled" Value="True" />
            <Property Name="UnifiedAreaRect" Value="{{0.00952756,0},{0.0104167,0},{0.51085,0},{0.585417,0}}" />
            <Window Type="TaharezLook/Menubar" Name="Root/FrameWindow/Menubar" >
                <Property Name="ItemSpacing" Value="10" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0,0},{0.09,0},{0.997727,0},{0.191014,0}}" />
                <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/File" >
                    <Property Name="Text" Value="File" />
                    <Property Name="Tooltip" Value="Yes, primary menuitems can have a tooltip" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0,7},{0,0},{0,30},{0,21}}" />
                    <Property Name="VerticalAlignment" Value="Centre" />
                    <Window Type="TaharezLook/PopupMenu" Name="Root/FrameWindow/Menubar/File/AutoPopup" >
                        <Property Name="Visible" Value="False" />
                        <Property Name="FadeInTime" Value="0" />
                        <Property Name="FadeOutTime" Value="0" />
                        <Property Name="ItemSpacing" Value="2" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="ClippedByParent" Value="False" />
                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,42},{0,119.174}}" />
                        <Property Name="AutoResizeEnabled" Value="True" />
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/File/New" >
                            <Property Name="Text" Value="New" />
                            <Property Name="Tooltip" Value="Creates a new document." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,39},{0,23}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/File/Open" >
                            <Property Name="Text" Value="Open..." />
                            <Property Name="Tooltip" Value="Opens an existing document." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,39},{0,46}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/File/Close" >
                            <Property Name="Text" Value="Close" />
                            <Property Name="Tooltip" Value="Closes the active document." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,48},{0,39},{0,69}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/File/Save" >
                            <Property Name="Text" Value="Save" />
                            <Property Name="Tooltip" Value="Saves the active document." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,71},{0,39},{0,92}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/File/Exit" >
                            <Property Name="Text" Value="Exit" />
                            <Property Name="Tooltip" Value="Quits the application; prompts you to save documents." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,94},{0,39},{0,115}}" />
                        </Window>
                    </Window>
                </Window>
                <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Edit" >
                    <Property Name="Text" Value="Edit" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0,40},{0,0},{0,64},{0,21}}" />
                    <Property Name="VerticalAlignment" Value="Centre" />
                    <Window Type="TaharezLook/PopupMenu" Name="Root/FrameWindow/Menubar/Edit/AutoPopup" >
                        <Property Name="Visible" Value="False" />
                        <Property Name="FadeInTime" Value="0" />
                        <Property Name="FadeOutTime" Value="0" />
                        <Property Name="ItemSpacing" Value="2" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="ClippedByParent" Value="False" />
                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,65},{0,118.661}}" />
                        <Property Name="AutoResizeEnabled" Value="True" />
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Edit/Cut" >
                            <Property Name="Text" Value="Cut" />
                            <Property Name="Tooltip" Value="Cuts the selection and puts it on the Clipboard." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,62},{0,23}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Edit/Copy" >
                            <Property Name="Text" Value="Copy" />
                            <Property Name="Tooltip" Value="Copies the selection and puts it on the Clipboard." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,62},{0,46}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Edit/Paste" >
                            <Property Name="Text" Value="Paste" />
                            <Property Name="Tooltip" Value="Inserts the Clipboard contents." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,48},{0,62},{0,69}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Edit/Delete" >
                            <Property Name="Text" Value="Delete" />
                            <Property Name="Tooltip" Value="Erases the selection." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,71},{0,62},{0,92}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Edit/SubMenu" >
                            <Property Name="Text" Value="SubMenu" />
                            <Property Name="Tooltip" Value="This menuitem has a submenu" />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,94},{0,62},{0,115}}" />
                            <Window Type="TaharezLook/PopupMenu" Name="Root/FrameWindow/Menubar/Edit/SubMenu/AutoPopup" >
                                <Property Name="Visible" Value="False" />
                                <Property Name="FadeInTime" Value="0" />
                                <Property Name="FadeOutTime" Value="0" />
                                <Property Name="ItemSpacing" Value="2" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="ClippedByParent" Value="False" />
                                <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,43},{0,49.5221}}" />
                                <Property Name="AutoResizeEnabled" Value="True" />
                                <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Edit/SubMenu/Item1" >
                                    <Property Name="Text" Value="Item 1" />
                                    <Property Name="Tooltip" Value="This is sub-menu #1" />
                                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                    <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,40},{0,23}}" />
                                </Window>
                                <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Edit/SubMenu/Item2" >
                                    <Property Name="Text" Value="Item 2" />
                                    <Property Name="Tooltip" Value="This is sub-menu #2" />
                                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                    <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,40},{0,46}}" />
                                </Window>
                            </Window>
                        </Window>
                    </Window>
                </Window>
                <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Help" >
                    <Property Name="Text" Value="Help" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0,74},{0,0},{0,100},{0,21}}" />
                    <Property Name="VerticalAlignment" Value="Centre" />
                    <Window Type="TaharezLook/PopupMenu" Name="Root/FrameWindow/Menubar/Help/AutoPopup" >
                        <Property Name="Visible" Value="False" />
                        <Property Name="FadeInTime" Value="0" />
                        <Property Name="FadeOutTime" Value="0" />
                        <Property Name="ItemSpacing" Value="2" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="ClippedByParent" Value="False" />
                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,64},{0,49.1331}}" />
                        <Property Name="AutoResizeEnabled" Value="True" />
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Help/Contents" >
                            <Property Name="Text" Value="Contents..." />
                            <Property Name="Tooltip" Value="Displays the help contents." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,61},{0,23}}" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Help/About" >
                            <Property Name="Text" Value="About..." />
                            <Property Name="Tooltip" Value="Displays program information, version number, and copyright." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,61},{0,46}}" />
                        </Window>
                    </Window>
                </Window>
            </Window>
            <Window Type="TaharezLook/StaticText" Name="Root/FrameWindow/Status" >
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.031818,0},{0.873954,0},{0.972728,0},{0.967087,0}}" />
            </Window>
            <Window Type="TaharezLook/StaticText" Name="Root/FrameWindow/FirstPopup" >
                <Property Name="Text" Value="First Popup" />
                <Property Name="HorzFormatting" Value="HorzCentred" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.131194,0},{0.701449,0},{0.431194,0},{0.795652,0}}" />
            </Window>
            <Window Type="TaharezLook/StaticText" Name="Root/FrameWindow/SecondPopup" >
                <Property Name="Font" Value="Commonwealth-10" />
                <Property Name="Text" Value="Second Popup" />
                <Property Name="HorzFormatting" Value="HorzCentred" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.572904,0},{0.701449,0},{0.872903,0},{0.795652,0}}" />
            </Window>
        </Window>
        <Window Type="TaharezLook/Menubar" Name="Root/Popup" >
            <Property Name="ItemSpacing" Value="10" />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{0.565585,0},{0.07,0},{0.684029,0},{0.140833,0}}" />
            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus" >
                <Property Name="Text" Value="PopupMenus" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0,7},{0,0},{0,73},{0,21}}" />
                <Property Name="VerticalAlignment" Value="Centre" />
                <Window Type="TaharezLook/PopupMenu" Name="Root/Popup/PopupMenus/AutoPopup" >
                    <Property Name="FadeInTime" Value="0" />
                    <Property Name="FadeOutTime" Value="0" />
                    <Property Name="ItemSpacing" Value="2" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="ClippedByParent" Value="False" />
                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,21},{0,57},{0,116.749}}" />
                    <Property Name="AutoResizeEnabled" Value="True" />
                    <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FirstPopup" >
                        <Property Name="Text" Value="First" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,54},{0,23}}" />
                        <Window Type="TaharezLook/PopupMenu" Name="Root/Popup/PopupMenus/FirstPopup/AutoPopup" >
                            <Property Name="FadeInTime" Value="0" />
                            <Property Name="FadeOutTime" Value="0" />
                            <Property Name="ItemSpacing" Value="2" />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="ClippedByParent" Value="False" />
                            <Property Name="UnifiedAreaRect" Value="{{0,52},{0,0},{0,97},{0,119.266}}" />
                            <Property Name="AutoResizeEnabled" Value="True" />
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FirstPopup/First-1" >
                                <Property Name="Text" Value="First-1" />
                                <Property Name="Tooltip" Value="First-1" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,42},{0,23}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FirstPopup/First-2" >
                                <Property Name="Text" Value="First-2" />
                                <Property Name="Tooltip" Value="First-2" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,42},{0,46}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FirstPopup/First-3" >
                                <Property Name="Text" Value="First-3" />
                                <Property Name="Tooltip" Value="First-3" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,48},{0,42},{0,69}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FirstPopup/First-4" >
                                <Property Name="Text" Value="First-4" />
                                <Property Name="Tooltip" Value="First-4" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,71},{0,42},{0,92}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FirstPopup/First-5" >
                                <Property Name="Text" Value="First-5" />
                                <Property Name="Tooltip" Value="First-5" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,94},{0,42},{0,115}}" />
                            </Window>
                        </Window>
                    </Window>
                    <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SecondPopup" >
                        <Property Name="Text" Value="Second" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,54},{0,46}}" />
                        <Window Type="TaharezLook/PopupMenu" Name="Root/Popup/PopupMenus/SecondPopup/AutoPopup" >
                            <Property Name="FadeInTime" Value="0" />
                            <Property Name="FadeOutTime" Value="0" />
                            <Property Name="ItemSpacing" Value="2" />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="ClippedByParent" Value="False" />
                            <Property Name="UnifiedAreaRect" Value="{{0,52},{0,0},{0,117},{0,119.11}}" />
                            <Property Name="AutoResizeEnabled" Value="True" />
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SecondPopup/Second-1" >
                                <Property Name="Text" Value="Second-1" />
                                <Property Name="Tooltip" Value="Second-1" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,62},{0,23}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SecondPopup/Second-2" >
                                <Property Name="Text" Value="Second-2" />
                                <Property Name="Tooltip" Value="Second-2" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,62},{0,46}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SecondPopup/Second-3" >
                                <Property Name="Text" Value="Second-3" />
                                <Property Name="Tooltip" Value="Second-3" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,48},{0,62},{0,69}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SecondPopup/Second-4" >
                                <Property Name="Text" Value="Second-4" />
                                <Property Name="Tooltip" Value="Second-4" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,71},{0,62},{0,92}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SecondPopup/SubMenu" >
                                <Property Name="Text" Value="SubMenu" />
                                <Property Name="Tooltip" Value="SubMenu" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,94},{0,62},{0,115}}" />
                                <Window Type="TaharezLook/PopupMenu" Name="Root/Popup/PopupMenus/SecondPopup/SubMenu/AutoPopup" >
                                    <Property Name="FadeInTime" Value="0" />
                                    <Property Name="FadeOutTime" Value="0" />
                                    <Property Name="ItemSpacing" Value="2" />
                                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                    <Property Name="ClippedByParent" Value="False" />
                                    <Property Name="UnifiedAreaRect" Value="{{0,60},{0,0},{0,118},{0,49.3892}}" />
                                    <Property Name="AutoResizeEnabled" Value="True" />
                                    <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SecondPopup/SubMenu/SubItem1" >
                                        <Property Name="Text" Value="SubItem1" />
                                        <Property Name="Tooltip" Value="SubItem1" />
                                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,55},{0,23}}" />
                                    </Window>
                                    <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SecondPopup/SubMenu/SubItem2" >
                                        <Property Name="Text" Value="SubItem2" />
                                        <Property Name="Tooltip" Value="SubItem2" />
                                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,55},{0,46}}" />
                                    </Window>
                                </Window>
                            </Window>
                        </Window>
                    </Window>
                    <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FramePopup" >
                        <Property Name="Text" Value="Frame" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,48},{0,54},{0,69}}" />
                        <Window Type="TaharezLook/PopupMenu" Name="Root/Popup/PopupMenus/FramePopup/AutoPopup" >
                            <Property Name="FadeInTime" Value="0" />
                            <Property Name="FadeOutTime" Value="0" />
                            <Property Name="ItemSpacing" Value="2" />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="ClippedByParent" Value="False" />
                            <Property Name="UnifiedAreaRect" Value="{{0,52},{0,0},{0,104},{0,49.3892}}" />
                            <Property Name="AutoResizeEnabled" Value="True" />
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FramePopup/Frame-1" >
                                <Property Name="Text" Value="Frame-1" />
                                <Property Name="Tooltip" Value="Frame-1" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,49},{0,23}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/FramePopup/Frame-2" >
                                <Property Name="Text" Value="Frame-2" />
                                <Property Name="Tooltip" Value="Frame-2" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,49},{0,46}}" />
                            </Window>
                        </Window>
                    </Window>
                    <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SheetPopup" >
                        <Property Name="Text" Value="Sheet" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="UnifiedAreaRect" Value="{{0,2},{0,71},{0,54},{0,92}}" />
                        <Window Type="TaharezLook/PopupMenu" Name="Root/Popup/PopupMenus/SheetPopup/AutoPopup" >
                            <Property Name="FadeInTime" Value="0" />
                            <Property Name="FadeOutTime" Value="0" />
                            <Property Name="ItemSpacing" Value="2" />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="ClippedByParent" Value="False" />
                            <Property Name="UnifiedAreaRect" Value="{{0,52},{0,0},{0,87},{0,119.243}}" />
                            <Property Name="AutoResizeEnabled" Value="True" />
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SheetPopup/Allo" >
                                <Property Name="Text" Value="Allo" />
                                <Property Name="Tooltip" Value="Français" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,32},{0,23}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SheetPopup/Hello" >
                                <Property Name="Text" Value="Hello" />
                                <Property Name="Tooltip" Value="English" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,32},{0,46}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SheetPopup/Hallo" >
                                <Property Name="Text" Value="Hallo" />
                                <Property Name="Tooltip" Value="Deutsch" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,48},{0,32},{0,69}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SheetPopup/Ciao" >
                                <Property Name="Text" Value="Ciao" />
                                <Property Name="Tooltip" Value="Italiano" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,71},{0,32},{0,92}}" />
                            </Window>
                            <Window Type="TaharezLook/MenuItem" Name="Root/Popup/PopupMenus/SheetPopup/Hola" >
                                <Property Name="Text" Value="Hola" />
                                <Property Name="Tooltip" Value="Español" />
                                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                                <Property Name="UnifiedAreaRect" Value="{{0,2},{0,94},{0,32},{0,115}}" />
                            </Window>
                        </Window>
                    </Window>
                </Window>
            </Window>
        </Window>
    </Window>
</GUILayout>