VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtMenuManager Class Reference

Detailed Description

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 ()
 
DtAttributeHandleplayerStore ()
 
void createMenus (DtInitTable &config)
 
void createInputMenus (DtInitTable &config)
 
void createDefaultValidators ()
 
DtInputValidator findValidator (const std::string &type)
 
void addMenu (DtMenu *menu)
 
void removeMenu (DtMenu *menu)
 
DtMenufindMenu (const std::string &name)
 
DtMenufindActiveMenu ()
 
void setActiveCursor (const std::string &name)
 
makVrv::DtDe * de ()
 
virtual DtQmlActionMenuqmlActionMenu () 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
 
DtMenuCursormyCursor
 
DtActionMenuUpdatermyUpdater
 

Member Typedef Documentation

◆ MenuMap

using makVre::DtMenuManager::MenuMap = std::map<std::string, DtMenu*>
protected

Type definition for a map of menu names to menu pointers.

◆ ValidatorMap

using makVre::DtMenuManager::ValidatorMap = std::map<std::string, DtInputValidator>
protected

Type definition for a map of validator names to validator functions.

Constructor & Destructor Documentation

◆ DtMenuManager()

makVre::DtMenuManager::DtMenuManager ( DtActionMenuUpdater * updater,
DtAttributeHandle & state,
makVrv::DtDe * de )

Constructor.

Parameters
updaterPointer to the action menu updater
stateReference to the player state attribute handle
dePointer 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().

◆ ~DtMenuManager()

virtual makVre::DtMenuManager::~DtMenuManager ( )
virtual

Virtual destructor.

Ensures proper cleanup of all menu resources and derived manager classes.

Member Function Documentation

◆ playerStore()

DtAttributeHandle & makVre::DtMenuManager::playerStore ( )
inline

Gets the player state attribute store.

Returns
Reference to the player state attribute handle

Provides access to the player state attribute store, which contains attributes used for dynamic menu content and conditional display.

References myPlayerStore.

◆ createMenus()

void makVre::DtMenuManager::createMenus ( DtInitTable & config)

Creates standard action menus from configuration.

Parameters
configConfiguration 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.

◆ createInputMenus()

void makVre::DtMenuManager::createInputMenus ( DtInitTable & config)

Creates input menus from configuration.

Parameters
configConfiguration 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.

◆ createDefaultValidators()

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.

◆ findValidator()

DtInputValidator makVre::DtMenuManager::findValidator ( const std::string & type)

Finds a validator for a specific input type.

Parameters
typeString identifier for the validator type
Returns
The requested validator delegate, or an empty validator if not found

Retrieves a validator function for the specified input type from the validator registry. This is used by input menus to validate user-entered text.

◆ addMenu()

void makVre::DtMenuManager::addMenu ( DtMenu * menu)

Adds a menu to the manager.

Parameters
menuPointer 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.

◆ removeMenu()

void makVre::DtMenuManager::removeMenu ( DtMenu * menu)

Removes a menu from the manager.

Parameters
menuPointer 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.

◆ findMenu()

DtMenu * makVre::DtMenuManager::findMenu ( const std::string & name)

Finds a menu by name.

Parameters
nameName of the menu to find
Returns
Pointer to the found menu, or NULL if not found

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.

◆ findActiveMenu()

DtMenu * makVre::DtMenuManager::findActiveMenu ( )

Finds the currently active menu.

Returns
Pointer to the active menu, or NULL if no menu is active

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.

◆ setActiveCursor()

void makVre::DtMenuManager::setActiveCursor ( const std::string & name)

Sets the active cursor by name.

Parameters
nameName 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.

◆ de()

makVrv::DtDe * makVre::DtMenuManager::de ( )
inline

Gets the display engine.

Returns
Pointer to the display engine

Provides access to the display engine used for rendering menus and cursors.

References myDe.

Referenced by DtMenuManager().

◆ qmlActionMenu()

virtual DtQmlActionMenu * makVre::DtMenuManager::qmlActionMenu ( ) const
virtual

Gets the QML action menu component.

Returns
Pointer to the QML action menu

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.

◆ validateMgrsInput()

bool makVre::DtMenuManager::validateMgrsInput ( const std::string & input)
protected

Validates MGRS coordinate input.

Parameters
inputThe string to validate
Returns
True if the input is a valid MGRS coordinate

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.

◆ validateLaserInput()

bool makVre::DtMenuManager::validateLaserInput ( const std::string & input)
protected

Validates laser code input.

Parameters
inputThe string to validate
Returns
True if the input is a valid laser code

Checks if the provided string is a valid laser designator code format. Laser codes are used for targeting systems and typically follow specific formats.

◆ validateCryptoKey()

bool makVre::DtMenuManager::validateCryptoKey ( const std::string & input)
protected

Validates cryptographic key input.

Parameters
inputThe string to validate
Returns
True if the input is a valid crypto key

Checks if the provided string is a valid cryptographic key format. Crypto keys are used for secure communications and follow specific formats.

◆ validateIntegerInput()

bool makVre::DtMenuManager::validateIntegerInput ( const std::string & input)
protected

Validates integer input.

Parameters
inputThe string to validate
Returns
True if the input is a valid integer

Checks if the provided string represents a valid integer number.

◆ validateTrue()

bool makVre::DtMenuManager::validateTrue ( const std::string & input)
protected

Always returns true for any input.

Parameters
inputThe string to validate (unused)
Returns
Always returns true

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.

◆ validateDecimalLatLonInDegrees()

bool makVre::DtMenuManager::validateDecimalLatLonInDegrees ( const std::string & input)
protected

Validates latitude/longitude coordinate input.

Parameters
inputThe string to validate
Returns
True if the input contains valid decimal lat/lon coordinates

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).

◆ handleMenuMessage()

DtVreMessageResult makVre::DtMenuManager::handleMenuMessage ( DtVreMessage * msg)
protected

Handles menu-related messages.

Parameters
msgPointer to the message to handle
Returns
Message handling result

Processes messages related to menu state changes, such as requests to show or hide specific menus, menu selection events, and menu configuration changes.

Member Data Documentation

◆ myDe

makVrv::DtDe* makVre::DtMenuManager::myDe
protected

Pointer to the display engine.

The display engine used for rendering menus and cursors.

Referenced by de().

◆ myMenuMap

MenuMap makVre::DtMenuManager::myMenuMap
protected

Registry of all menus managed by this manager.

Maps menu names to their corresponding menu objects for lookup and management.

◆ myValidatorMap

ValidatorMap makVre::DtMenuManager::myValidatorMap
protected

Registry of input validators.

Maps validator type names to their corresponding validator functions. Used to validate user input in text entry fields.

◆ myPlayerStore

DtAttributeHandle makVre::DtMenuManager::myPlayerStore
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().

◆ myScale

float makVre::DtMenuManager::myScale
protected

Global scale factor for menu elements.

Controls the overall size of menu elements for display scaling.

◆ myCursor

DtMenuCursor* makVre::DtMenuManager::myCursor
protected

Pointer to the current menu cursor.

Manages the visual representation of the cursor in menus.

◆ myUpdater

DtActionMenuUpdater* makVre::DtMenuManager::myUpdater
protected

Pointer to the action menu updater.

Handles the visual updating and rendering of menus.


The documentation for this class was generated from the following file: