|
VR-Engage
2.2
|
DtMenuManager serves as the central coordinating system for all menus in VR-Engage. It manages the creation, organization, and interaction with menus, handling both standard action menus and input menus. The manager maintains a registry of menus by name, provides access to the player state store for dynamically updating menu content, and coordinates cursor visualization for menu selections.
This class also provides input validation functionality for text input fields in menus, with a registry of validators for different data types and formats.
#include <actionMenuManager.h>
Public Member Functions | |
| DtMenuManager (DtActionMenuUpdater *updater, DtAttributeHandle &state, makVrv::DtDe *de) | |
| virtual | ~DtMenuManager () |
| DtAttributeHandle & | playerStore () |
| void | createMenus (DtInitTable &config) |
| void | createInputMenus (DtInitTable &config) |
| void | createDefaultValidators () |
| DtInputValidator | findValidator (const std::string &type) |
| void | addMenu (DtMenu *menu) |
| void | removeMenu (DtMenu *menu) |
| DtMenu * | findMenu (const std::string &name) |
| DtMenu * | findActiveMenu () |
| void | setActiveCursor (const std::string &name) |
| makVrv::DtDe * | de () |
| virtual DtQmlActionMenu * | qmlActionMenu () const |
Protected Types | |
| using | MenuMap = std::map<std::string, DtMenu*> |
| using | ValidatorMap = std::map<std::string, DtInputValidator> |
Protected Member Functions | |
| bool | validateMgrsInput (const std::string &input) |
| bool | validateLaserInput (const std::string &input) |
| bool | validateCryptoKey (const std::string &input) |
| bool | validateIntegerInput (const std::string &input) |
| bool | validateTrue (const std::string &input) |
| bool | validateDecimalLatLonInDegrees (const std::string &input) |
| DtVreMessageResult | handleMenuMessage (DtVreMessage *msg) |
Protected Attributes | |
| makVrv::DtDe * | myDe |
| MenuMap | myMenuMap |
| ValidatorMap | myValidatorMap |
| DtAttributeHandle | myPlayerStore |
| float | myScale |
| DtMenuCursor * | myCursor |
| DtActionMenuUpdater * | myUpdater |
|
protected |
Type definition for a map of menu names to menu pointers.
|
protected |
Type definition for a map of validator names to validator functions.
| makVre::DtMenuManager::DtMenuManager | ( | DtActionMenuUpdater * | updater, |
| DtAttributeHandle & | state, | ||
| makVrv::DtDe * | de ) |
Constructor.
| updater | Pointer to the action menu updater |
| state | Reference to the player state attribute handle |
| de | Pointer to the display engine |
Creates a new menu manager with references to the necessary components for menu management, including the updater for visual presentation, the player state store for dynamic content, and the display engine for rendering.
References de().
|
virtual |
Virtual destructor.
Ensures proper cleanup of all menu resources and derived manager classes.
|
inline |
Gets the player state attribute store.
Provides access to the player state attribute store, which contains attributes used for dynamic menu content and conditional display.
References myPlayerStore.
| void makVre::DtMenuManager::createMenus | ( | DtInitTable & | config | ) |
Creates standard action menus from configuration.
| config | Configuration table with menu definitions |
Builds the standard menu system based on the provided configuration data. This includes the main action menu and its submenus, creating the menu hierarchy and registering all menus with the manager.
| void makVre::DtMenuManager::createInputMenus | ( | DtInitTable & | config | ) |
Creates input menus from configuration.
| config | Configuration table with input menu definitions |
Builds special input menus based on the provided configuration data. Input menus are used for text and value entry, such as coordinates, radio frequencies, or other user-entered data.
| void makVre::DtMenuManager::createDefaultValidators | ( | ) |
Creates the standard set of input validators.
Sets up the default input validators for various data types and formats, such as MGRS coordinates, laser codes, crypto keys, and numeric values. These validators are used to ensure user input meets format requirements.
| DtInputValidator makVre::DtMenuManager::findValidator | ( | const std::string & | type | ) |
Finds a validator for a specific input type.
| type | String identifier for the validator type |
Retrieves a validator function for the specified input type from the validator registry. This is used by input menus to validate user-entered text.
| void makVre::DtMenuManager::addMenu | ( | DtMenu * | menu | ) |
Adds a menu to the manager.
| menu | Pointer to the menu to add |
Registers a menu with the manager and takes ownership of it. The menu manager becomes responsible for deleting the menu when it's no longer needed or when the manager is destroyed.
| void makVre::DtMenuManager::removeMenu | ( | DtMenu * | menu | ) |
Removes a menu from the manager.
| menu | Pointer to the menu to remove |
Unregisters a menu from the manager without deleting it. The caller becomes responsible for deleting the menu to avoid memory leaks.
| DtMenu * makVre::DtMenuManager::findMenu | ( | const std::string & | name | ) |
Finds a menu by name.
| name | Name of the menu to find |
Looks up a menu in the registry by its name identifier. This is used to access specific menus for operations like showing, hiding, or updating them.
| DtMenu * makVre::DtMenuManager::findActiveMenu | ( | ) |
Finds the currently active menu.
Searches for and returns the currently active (visible) menu. If multiple menus are active, behavior is undefined and typically returns the first active menu found.
| void makVre::DtMenuManager::setActiveCursor | ( | const std::string & | name | ) |
Sets the active cursor by name.
| name | Name of the cursor to activate |
Activates a specific cursor design by name. Different cursors can provide visual feedback about the current context or selection type. An empty name deactivates the cursor display.
|
inline |
Gets the display engine.
Provides access to the display engine used for rendering menus and cursors.
References myDe.
Referenced by DtMenuManager().
|
virtual |
Gets the QML action menu component.
Provides access to the QML-based action menu implementation. This is used by components that need to directly interact with the modern UI representation of menus.
|
protected |
Validates MGRS coordinate input.
| input | The string to validate |
Checks if the provided string is a valid Military Grid Reference System (MGRS) coordinate format. MGRS is a geocoordinate standard used by NATO military forces.
|
protected |
Validates laser code input.
| input | The string to validate |
Checks if the provided string is a valid laser designator code format. Laser codes are used for targeting systems and typically follow specific formats.
|
protected |
Validates cryptographic key input.
| input | The string to validate |
Checks if the provided string is a valid cryptographic key format. Crypto keys are used for secure communications and follow specific formats.
|
protected |
Validates integer input.
| input | The string to validate |
Checks if the provided string represents a valid integer number.
|
protected |
Always returns true for any input.
| input | The string to validate (unused) |
Placeholder validator that accepts any input. This can be used for fields where no specific validation is needed or where validation will be performed later in the processing pipeline.
|
protected |
Validates latitude/longitude coordinate input.
| input | The string to validate |
Validates input string for decimal latitude and longitude in degrees. Expected format is two numbers separated by a space, with the first number representing latitude (-90 to 90) and the second representing longitude (-180 to 180).
|
protected |
Handles menu-related messages.
| msg | Pointer to the message to handle |
Processes messages related to menu state changes, such as requests to show or hide specific menus, menu selection events, and menu configuration changes.
|
protected |
Pointer to the display engine.
The display engine used for rendering menus and cursors.
Referenced by de().
|
protected |
Registry of all menus managed by this manager.
Maps menu names to their corresponding menu objects for lookup and management.
|
protected |
Registry of input validators.
Maps validator type names to their corresponding validator functions. Used to validate user input in text entry fields.
|
protected |
Handle to the player attribute store.
Provides access to player state attributes used for dynamic menu content and conditional display logic.
Referenced by playerStore().
|
protected |
Global scale factor for menu elements.
Controls the overall size of menu elements for display scaling.
|
protected |
Pointer to the current menu cursor.
Manages the visual representation of the cursor in menus.
|
protected |
Pointer to the action menu updater.
Handles the visual updating and rendering of menus.