The Menu Manipulation example demonstrates the following:
- How to build a plugin module for the VR-Forces Gui
- How to remove menu items from the GUI
- How to add menu items to the GUI
- How to add menus to the gui
- How to remove menus from the gui
Modifying the Menus
The Menu Manipulation example demonstrates how to manipulate the menu, changing it from the system default.
This example shows you how to modify the following menus:
- The Task menu by removing the embark, disembark, DI-Guy animation and radio menus
- Moving Task menu items (embarkation) to a new sub-menu in the Task menu
- Adds a new item to the Create menu
- Reorganizes Set menu by removing the setting of location, heading and ordered speed to a new sub-menu
- Shows how to add a new menu to the main menu bar
- Modified the entities right click menu to add a new menu item
How to Run the Example
Usage
In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin.
To view the new behavior:
-
Start VR-Forces GUI and SIM.
-
Load an existing scneario - e.g. HawaiiGround.scnx.
-
Right click on an entity - e.g. CH-47 1. From the context meny select Task -> Embarkation. The Embark and Disembark sub-menu items are removed.
-
The Embark and Disembark sub-menu items have been moved in the new Task -> Task Example menu.
-
Select the Create manu item from the GUI main menu. A new menu item Example -> M1A2 has been added.
-
In a similar way - you can observe the other menu modifiactions listed in the previous section.
Plugin Entry Points
using namespace makVrf;
{
public:
DtMenuManipulationPaletteFilter() {};
DtMenuManipulationPaletteFilter(
const DtMenuManipulationPaletteFilter& orig) :
DtPaletteFilter(orig) {};
virtual bool shouldAddCreationItem(
const DtEntityPaletteItem& item,
const std::set<std::string>& categories,
const std::string& deployedCountry,
int force)
const
{
if ((force == DtForceFriendly) && (item.
myMapperKey == DtEntityType(1, 1, 225, 1, 1, 3, 0)))
{
return false;
}
return true;
}
{
return new DtMenuManipulationPaletteFilter(*this);
}
};
{
DtListItem* item = copySet.first();
while (item)
{
{
}
else if (entry->
label() ==
"Route")
{
}
item = item->next();
}
}
{
removeInformationItemFromSection("DtEntityInformation", "DtEntityCompactData", "DtEntityAltitude");
addInformationItemToSection("DtEntityInformation", "DtEntityCompactData", "DtEntityHeadingPitchRoll", 1, 3, 1, 1, 128);
}
{
DtMenuManipulationPaletteFilter filter;
}
{
}
{
}
{
QMessageBox::information(NULL, QObject::tr("Example Menu Item Pressed"), QObject::tr("Your menu item works!"));
}
{
}
{
}
{
}
{
&exampleMenuItemTrigger);
}
{
}
{
removeMenuItems(*de);
reorganizeTaskMenuItems(*de);
reorganizeSetMenuItems(*de);
addToCreateMenu(*de);
addMenu(*de);
modifyRightClick(*de);
modifyInformationSection(*de);
return true;
}
{
}