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

Detailed Description

DtActionInputMenu provides a specialized menu for text input in VR-Engage. It captures keyboard input, displays the entered text, validates it according to format requirements, and sends the completed text as an action parameter when the user finalizes their input. This class is used for various text entry needs such as coordinates, radio frequencies, names, and other text-based inputs.

#include <actionInputMenu.h>

Inheritance diagram for makVre::DtActionInputMenu:
[legend]

Public Member Functions

 DtActionInputMenu (DtMenuManager &mgr)
 
virtual ~DtActionInputMenu () override
 
virtual void setInputText (const std::string &input)
 
virtual std::string inputText () const
 
virtual void setInputValidator (DtInputValidator validator)
 
virtual DtInputValidator inputValidator () const
 
virtual void setActionType (const std::string &actionType)
 
virtual std::string actionType () const
 
virtual void setDefaultString (const std::string &defaultString)
 
virtual std::string defaultString () const
 
virtual void select (float val=1) override
 
virtual void setActive (bool active, bool saveSelection=false, bool closeOnElementSelected=false) override
 
virtual void activateInputLogic () override
 
- Public Member Functions inherited from makVre::DtMenu
 DtMenu (DtMenuManager &mgr)
 
virtual ~DtMenu ()
 
virtual const std::string & name ()
 
virtual void setName (const std::string &name)
 
virtual void setPosition (float x, float y)
 
virtual float x () const
 
virtual float y () const
 
virtual void setSize (float x, float y)
 
virtual float width () const
 
virtual float height () const
 
virtual bool isActive () const
 
virtual bool isEmpty () const
 
virtual void tick (double dt)
 
virtual void deactivateInputLogic ()
 
virtual const std::string & title () const
 
virtual void setTitle (const std::string &title)
 
virtual const std::string & titleAttribute () const
 
void setTitleAttribute (const std::string &titleAttribute)
 
virtual void setShowTitle (bool show)
 
virtual void addElement (DtMenuElement *element)
 
virtual DtMenuElementremoveElement (DtMenuElement *element)
 
virtual DtMenuElementremoveElement (const std::string &name)
 
virtual DtMenuElementfindElement (const std::string &name)
 
virtual std::vector< DtMenuElement * > elements ()
 
virtual bool selectElement (int index)
 
virtual void selectElementByOnScreenIndex (int index)
 
virtual bool selectElement (const std::string &name)
 
virtual void selectNext (float val=1)
 
virtual void selectPrevious (float val=1)
 
virtual DtMenuElementselectedElement ()
 
virtual int selectedElementIndex () const
 
virtual void clearSelected ()
 
virtual bool scrollToItem (int index)
 
virtual void scrollDown ()
 
virtual void scrollUp ()
 
virtual void scroll (float val)
 
virtual void pageUp (float val=1)
 
virtual void pageDown (float val=1)
 
virtual void updateElements ()
 
virtual void updateVisuals ()
 
virtual void addElementGenerator (DtMenuAttributeObserver *generator)
 
virtual void setParent (const std::string &name)
 
virtual void setInheritParentPosition (bool set)
 
virtual void setInheritParentSize (bool set)
 
virtual const std::string & parent () const
 
virtual void closeMenu (float val=1)
 
virtual void selectItem (float val, unsigned int num)
 
virtual void select1 (float val)
 
virtual void select2 (float val)
 
virtual void select3 (float val)
 
virtual void select4 (float val)
 
virtual void select5 (float val)
 
virtual void select6 (float val)
 
virtual void select7 (float val)
 
virtual void select8 (float val)
 
virtual void select9 (float val)
 
virtual void select10 (float val)
 
virtual void back (float val=1)
 
virtual const DtMenuDisplayConditionsdisplayConditions () const
 
virtual DtMenuDisplayConditionsdisplayConditions ()
 
virtual bool containsEnabledDuplicate (DtMenuElement *element)
 
virtual DtMenuManagermanager ()
 
void setType (Type type)
 
Type type ()
 
virtual void clearElements ()
 
void triggerActionFromQML (int index)
 

Static Public Attributes

static DtInputValidator theNullInputValidator
 

Protected Member Functions

virtual bool handleInputData (const DtInputData &inputData)
 
virtual void addCharacter (makVrv::DtKeyState::KeyType key)
 
virtual void removeCharacter ()
 
virtual void sendText ()
 
- Protected Member Functions inherited from makVre::DtMenu
virtual DtVreMessageResult handlePlayerControlsState (DtVreMessage *msg)
 
virtual DtVreMessageResult handleMenuInputMessage (DtVreMessage *msg)
 
virtual bool scrollToItem (int index, bool doUpdate)
 
virtual void updateImguiUI ()
 

Protected Attributes

std::string myInputString
 
std::string myActionType
 
DtInputValidator myInputValidator
 
DtMenuElementmyInputElement
 
std::string myDefaultString
 
- Protected Attributes inherited from makVre::DtMenu
DtMenuManagermyManager
 
std::string myName
 
std::string myTitleString
 
std::string myTitleAttribute
 
std::string myParent
 
DtMenuDisplayConditions myDisplayConditions
 
Type myType
 
float myX
 
float myY
 
float myWidth
 
float myHeight
 
bool myIsActive
 
bool myShowTitle
 
bool myNeedParentSize
 
bool myNeedParentPosition
 
bool myShouldShowNumbers
 
std::vector< Item * > myItems
 
std::vector< Item * > myEnabledItems
 
ItemmySelectedItem
 
ItemmySavedSelection
 
Item myScrollUp
 
Item myScrollDown
 
bool myCanScrollUp
 
bool myCanScrollDown
 
int myScrollOffset
 
int myVisibleScrollItems
 
double myActionFlash
 
bool myCloseOnSelection
 
int myLineHeight
 
DtMenuAttributeObservermyElementGenerator
 
DtInputLogic myInputLogic
 

Additional Inherited Members

- Public Types inherited from makVre::DtMenu
enum  Type { STATIC , QUICK }
 
- Protected Types inherited from makVre::DtMenu
enum  Layers { HIDDEN , BACKGROUND , GRAPHIC , LABEL }
 

Constructor & Destructor Documentation

◆ DtActionInputMenu()

makVre::DtActionInputMenu::DtActionInputMenu ( DtMenuManager & mgr)

Constructor.

Parameters
mgrReference to the menu manager

Creates a new input menu associated with the specified menu manager. The menu starts with empty input text and uses the default null validator which accepts any input text as valid.

◆ ~DtActionInputMenu()

virtual makVre::DtActionInputMenu::~DtActionInputMenu ( )
overridevirtual

Virtual destructor.

Ensures proper cleanup of derived input menu classes.

Member Function Documentation

◆ setInputText()

virtual void makVre::DtActionInputMenu::setInputText ( const std::string & input)
virtual

Sets the current input text.

Parameters
inputThe text to set as the current input

Updates the current input text and refreshes the visual display. This can be used to preset the input field with existing text.

◆ inputText()

virtual std::string makVre::DtActionInputMenu::inputText ( ) const
virtual

Gets the current input text.

Returns
The current input text

Retrieves the text currently entered in the input field.

◆ setInputValidator()

virtual void makVre::DtActionInputMenu::setInputValidator ( DtInputValidator validator)
virtual

Sets the input validator function.

Parameters
validatorThe validator delegate function to use

Sets the function used to validate input text. The validator function receives the current input text and returns true if it is valid according to the expected format, or false if it is invalid.

◆ inputValidator()

virtual DtInputValidator makVre::DtActionInputMenu::inputValidator ( ) const
virtual

Gets the current input validator.

Returns
The current input validator function

Retrieves the validator function currently being used to validate input.

◆ setActionType()

virtual void makVre::DtActionInputMenu::setActionType ( const std::string & actionType)
virtual

Sets the action type for this input menu.

Parameters
actionTypeThe action type identifier

Sets the action type that will be sent when the user completes their input. This identifier helps the receiving component determine how to handle the input. The default action type is "InputMenuAccept".

References actionType().

◆ actionType()

virtual std::string makVre::DtActionInputMenu::actionType ( ) const
virtual

Gets the current action type.

Returns
The current action type identifier

Retrieves the action type that will be sent when input is completed.

Referenced by setActionType().

◆ setDefaultString()

virtual void makVre::DtActionInputMenu::setDefaultString ( const std::string & defaultString)
virtual

Sets the default string to use when input is empty.

Parameters
defaultStringThe default string to use

Sets a default string that will be used if the user submits an empty input. This allows for pre-defined values to be used when no specific input is provided.

References defaultString().

◆ defaultString()

virtual std::string makVre::DtActionInputMenu::defaultString ( ) const
virtual

Gets the current default string.

Returns
The current default string

Retrieves the default string that will be used for empty input.

Referenced by setDefaultString().

◆ select()

virtual void makVre::DtActionInputMenu::select ( float val = 1)
overridevirtual

Handles selection of the input menu.

Parameters
valInput value (typically 1.0 for full selection)

Called when the input is completed by the user. This sends the entered text (or default text if empty) as an action with the specified action type, then returns to the parent menu or closes if no parent exists.

Reimplemented from makVre::DtMenu.

◆ setActive()

virtual void makVre::DtActionInputMenu::setActive ( bool active,
bool saveSelection = false,
bool closeOnElementSelected = false )
overridevirtual

Sets the active state of the input menu.

Parameters
activeTrue to activate the menu, false to deactivate
saveSelectionWhether to save the current selection state
closeOnElementSelectedWhether to close after selection (unused)

Overrides DtMenu::setActive to reset the input text when the menu is activated and display the default string hint if one is set.

Reimplemented from makVre::DtMenu.

◆ activateInputLogic()

virtual void makVre::DtActionInputMenu::activateInputLogic ( )
overridevirtual

Activates the input handling logic.

Overrides DtMenu::activateInputLogic to set up raw input handling for keyboard input. This allows the menu to capture keyboard events directly for text entry.

Reimplemented from makVre::DtMenu.

◆ handleInputData()

virtual bool makVre::DtActionInputMenu::handleInputData ( const DtInputData & inputData)
protectedvirtual

Handles raw input data for text entry.

Parameters
inputDataThe input data event to process
Returns
True if the input was handled, false otherwise

Processes keyboard input events for text entry. This method handles special keys (backspace, enter, escape) and passes regular characters to addCharacter for text building. It's registered as a raw input handler when the menu is activated.

◆ addCharacter()

virtual void makVre::DtActionInputMenu::addCharacter ( makVrv::DtKeyState::KeyType key)
protectedvirtual

Adds a character to the input text.

Parameters
keyThe keyboard key type to add

Converts a keyboard key code to a character and adds it to the input text if the resulting string passes validation. Updates the visual display after adding the character.

◆ removeCharacter()

virtual void makVre::DtActionInputMenu::removeCharacter ( )
protectedvirtual

Removes the last character from the input text.

Removes the last character from the input text (backspace functionality). If the input becomes empty, displays the default string hint if one is set. Updates the visual display after removing the character.

◆ sendText()

virtual void makVre::DtActionInputMenu::sendText ( )
protectedvirtual

Sends the completed input text as an action.

Creates and queues a MenuActionMessage with the current action type and the input text (or default text if input is empty) as the parameter. This is called when the user completes their input by pressing Enter.

Member Data Documentation

◆ theNullInputValidator

DtInputValidator makVre::DtActionInputMenu::theNullInputValidator
static

Default validator that accepts any input.

A static input validator that always returns true, accepting any input. This is used as the default validator when no specific validation is needed.

◆ myInputString

std::string makVre::DtActionInputMenu::myInputString
protected

Current input text string.

Stores the text currently entered by the user.

◆ myActionType

std::string makVre::DtActionInputMenu::myActionType
protected

Action type identifier for this input menu.

The action type that will be sent when the user completes their input. Default is "InputMenuAccept".

◆ myInputValidator

DtInputValidator makVre::DtActionInputMenu::myInputValidator
protected

Validator function for input validation.

Function delegate used to validate input text against format requirements.

◆ myInputElement

DtMenuElement* makVre::DtActionInputMenu::myInputElement
protected

Menu element that displays the input text.

The menu element used to display the current input text to the user.

◆ myDefaultString

std::string makVre::DtActionInputMenu::myDefaultString
protected

Default string to use when input is empty.

String that will be used if the user submits an empty input. Also displayed as a hint when the input field is empty.


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