InsertMenuItem(compatibility, "Use DTD", eventHandler, VIEWER_USE_DTD_MODE);
void CreateViewerMenus(QWidget *aParent, void * data, PRInt32 * aMenuBarHeight){    nsBrowserWindow * window = (nsBrowserWindow *) data;    nsMenuEventHandler * eventHandler = new nsMenuEventHandler(window);    QMenuBar * menuBar = new QMenuBar(aParent);    QPopupMenu * file = new QPopupMenu(aParent);    QObject::connect(file,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * samples = new QPopupMenu(aParent);    QObject::connect(samples,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * xptests = new QPopupMenu(aParent);    QObject::connect(xptests,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * edit = new QPopupMenu(aParent);    QObject::connect(edit,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * debug = new QPopupMenu(aParent);    QObject::connect(debug,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * eventdebug = new QPopupMenu(aParent);    QObject::connect(eventdebug,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * style = new QPopupMenu(aParent);    QObject::connect(style,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * tools = new QPopupMenu(aParent);    QObject::connect(tools,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * select = new QPopupMenu(aParent);    QObject::connect(select,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * compatibility = new QPopupMenu(aParent);    QObject::connect(compatibility,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    QPopupMenu * render = new QPopupMenu(aParent);    QObject::connect(render,                      SIGNAL(activated(int)),                      eventHandler,                      SLOT(MenuItemActivated(int)));    InsertMenuItem(file, "&New Window", eventHandler, VIEWER_WINDOW_OPEN);    InsertMenuItem(file, "&Open", eventHandler, VIEWER_FILE_OPEN);    InsertMenuItem(file, "&View Source", eventHandler, VIEW_SOURCE);    InsertMenuItem(samples, "demo #0", eventHandler, VIEWER_DEMO0);    InsertMenuItem(samples, "demo #1", eventHandler, VIEWER_DEMO1);    InsertMenuItem(samples, "demo #2", eventHandler, VIEWER_DEMO2);    InsertMenuItem(samples, "demo #3", eventHandler, VIEWER_DEMO3);    InsertMenuItem(samples, "demo #4", eventHandler, VIEWER_DEMO4);    InsertMenuItem(samples, "demo #5", eventHandler, VIEWER_DEMO5);    InsertMenuItem(samples, "demo #6", eventHandler, VIEWER_DEMO6);    InsertMenuItem(samples, "demo #7", eventHandler, VIEWER_DEMO7);    InsertMenuItem(samples, "demo #8", eventHandler, VIEWER_DEMO8);    InsertMenuItem(samples, "demo #9", eventHandler, VIEWER_DEMO9);    InsertMenuItem(samples, "demo #10", eventHandler, VIEWER_DEMO10);    InsertMenuItem(samples, "demo #11", eventHandler, VIEWER_DEMO11);    InsertMenuItem(samples, "demo #12", eventHandler, VIEWER_DEMO12);    InsertMenuItem(samples, "demo #13", eventHandler, VIEWER_DEMO13);    InsertMenuItem(samples, "demo #14", eventHandler, VIEWER_DEMO14);    InsertMenuItem(samples, "demo #15", eventHandler, VIEWER_DEMO15);    InsertMenuItem(samples, "demo #16", eventHandler, VIEWER_DEMO16);    InsertMenuItem(samples, "demo #17", eventHandler, VIEWER_DEMO17);    file->insertItem("&Samples", samples);    InsertMenuItem(file, "&Test Sites", eventHandler, VIEWER_TOP100);    InsertMenuItem(xptests, "Toolbar Test 1", eventHandler, VIEWER_XPTOOLKITTOOLBAR1);    InsertMenuItem(xptests, "Tree Test 1", eventHandler, VIEWER_XPTOOLKITTREE1);    file->insertItem("XPToolkit Tests", xptests);    InsertMenuItem(file, nsnull, nsnull, 0);    InsertMenuItem(file, "Print Preview", eventHandler, VIEWER_ONE_COLUMN);    InsertMenuItem(file, "Print", eventHandler, VIEWER_PRINT);    InsertMenuItem(file, "Print Setup", eventHandler, VIEWER_PRINT_SETUP);    InsertMenuItem(file, nsnull, nsnull, 0);    InsertMenuItem(file, "&Exit", eventHandler, VIEWER_EXIT);    InsertMenuItem(edit, "Cu&t", eventHandler, VIEWER_EDIT_CUT);    InsertMenuItem(edit, "&Copy", eventHandler, VIEWER_EDIT_COPY);    InsertMenuItem(edit, "&Paste", eventHandler, VIEWER_EDIT_PASTE);    InsertMenuItem(edit, nsnull, nsnull, 0);    InsertMenuItem(edit, "Select All", eventHandler, VIEWER_EDIT_SELECTALL);    InsertMenuItem(edit, nsnull, nsnull, 0);    InsertMenuItem(edit, "Find in Page", eventHandler, VIEWER_EDIT_FINDINPAGE);    InsertMenuItem(debug, "&Visual Debugging", eventHandler, VIEWER_VISUAL_DEBUGGING);    InsertMenuItem(debug, nsnull, nsnull, 0);    InsertMenuItem(eventdebug, "Toggle Paint Flashing", eventHandler, VIEWER_TOGGLE_PAINT_FLASHING);    InsertMenuItem(eventdebug, "Toggle Paint Dumping", eventHandler, VIEWER_TOGGLE_PAINT_DUMPING);    InsertMenuItem(eventdebug, "Toggle Invalidate Dumping", eventHandler, VIEWER_TOGGLE_INVALIDATE_DUMPING);    InsertMenuItem(eventdebug, "Toggle Event Dumping", eventHandler, VIEWER_TOGGLE_EVENT_DUMPING);    InsertMenuItem(eventdebug, nsnull, nsnull, 0);    InsertMenuItem(eventdebug, "Toggle Motion Event Dumping", eventHandler, VIEWER_TOGGLE_MOTION_EVENT_DUMPING);    InsertMenuItem(eventdebug, "Toggle Crossing Event Dumping", eventHandler, VIEWER_TOGGLE_CROSSING_EVENT_DUMPING);    debug->insertItem("Event Debugging", eventdebug);    InsertMenuItem(debug, nsnull, nsnull, 0);    InsertMenuItem(debug, "&Reflow Test", eventHandler, VIEWER_REFLOW_TEST);    InsertMenuItem(debug, nsnull, nsnull, 0);    InsertMenuItem(debug, "Dump &Content", eventHandler, VIEWER_DUMP_CONTENT);    InsertMenuItem(debug, "Dump &Frames", eventHandler, VIEWER_DUMP_FRAMES);    InsertMenuItem(debug, "Dump &Views", eventHandler, VIEWER_DUMP_VIEWS);    InsertMenuItem(debug, nsnull, nsnull, 0);    InsertMenuItem(debug, "Dump &Style Sheets", eventHandler, VIEWER_DUMP_STYLE_SHEETS);    InsertMenuItem(debug, "Dump &Style Contexts", eventHandler, VIEWER_DUMP_STYLE_CONTEXTS);    InsertMenuItem(debug, nsnull, nsnull, 0);    InsertMenuItem(debug, "Show Content Size", eventHandler, VIEWER_SHOW_CONTENT_SIZE);    InsertMenuItem(debug, "Show Frame Size", eventHandler, VIEWER_SHOW_FRAME_SIZE);    InsertMenuItem(debug, "Show Style Size", eventHandler, VIEWER_SHOW_STYLE_SIZE);    InsertMenuItem(debug, nsnull, nsnull, 0);    InsertMenuItem(debug, "Debug Save", eventHandler, VIEWER_DEBUGSAVE);    InsertMenuItem(debug, "Debug Output Text", eventHandler, VIEWER_DISPLAYTEXT);    InsertMenuItem(debug, "Debug Output HTML", eventHandler, VIEWER_DISPLAYHTML);    InsertMenuItem(debug, "Debug Toggle Selection", eventHandler, VIEWER_TOGGLE_SELECTION);    InsertMenuItem(debug, nsnull, nsnull, 0);    InsertMenuItem(debug, "Debug Robot", eventHandler, VIEWER_DEBUGROBOT);    InsertMenuItem(debug, nsnull, nsnull, 0);    InsertMenuItem(debug, "Show Content Quality", eventHandler, VIEWER_SHOW_CONTENT_QUALITY);    InsertMenuItem(debug, nsnull, nsnull, 0);    debug->insertItem("Style", style);    InsertMenuItem(select, "List Available Sheets", eventHandler, VIEWER_SELECT_STYLE_LIST);    InsertMenuItem(select, nsnull, nsnull, 0);    InsertMenuItem(select, "Select Default", eventHandler, VIEWER_SELECT_STYLE_DEFAULT);    InsertMenuItem(select, nsnull, nsnull, 0);    InsertMenuItem(select, "Select Alternative 1", eventHandler, VIEWER_SELECT_STYLE_ONE);    InsertMenuItem(select, "Select Alternative 2", eventHandler, VIEWER_SELECT_STYLE_TWO);    InsertMenuItem(select, "Select Alternative 3", eventHandler, VIEWER_SELECT_STYLE_THREE);    InsertMenuItem(select, "Select Alternative 4", eventHandler, VIEWER_SELECT_STYLE_FOUR);    style->insertItem("Select &Style Sheet", select);    InsertMenuItem(compatibility, "Nav Quirks", eventHandler, VIEWER_NAV_QUIRKS_MODE);    InsertMenuItem(compatibility, "Standard", eventHandler, VIEWER_STANDARD_MODE);    style->insertItem("&Compatibility Mode", compatibility);    InsertMenuItem(render, "Native", eventHandler, VIEWER_NATIVE_WIDGET_MODE);    InsertMenuItem(render, "Gfx", eventHandler, VIEWER_GFX_WIDGET_MODE);    style->insertItem("&Widget Render Mode", render);    InsertMenuItem(tools, "&JavaScript Console", eventHandler, JS_CONSOLE);    InsertMenuItem(tools, "&Editor Mode", eventHandler, EDITOR_MODE);    menuBar->insertItem("&File", file);    menuBar->insertItem("&Edit", edit);    menuBar->insertItem("&Debug", debug);    menuBar->insertItem("&Tools", tools);    menuBar->show();    *aMenuBarHeight = menuBar->height();}