|
VR-Engage
2.2
|
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>
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 DtMenuElement * | removeElement (DtMenuElement *element) |
| virtual DtMenuElement * | removeElement (const std::string &name) |
| virtual DtMenuElement * | findElement (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 DtMenuElement * | selectedElement () |
| 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 DtMenuDisplayConditions & | displayConditions () const |
| virtual DtMenuDisplayConditions & | displayConditions () |
| virtual bool | containsEnabledDuplicate (DtMenuElement *element) |
| virtual DtMenuManager & | manager () |
| 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 |
| DtMenuElement * | myInputElement |
| std::string | myDefaultString |
Protected Attributes inherited from makVre::DtMenu | |
| DtMenuManager & | myManager |
| 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 |
| Item * | mySelectedItem |
| Item * | mySavedSelection |
| Item | myScrollUp |
| Item | myScrollDown |
| bool | myCanScrollUp |
| bool | myCanScrollDown |
| int | myScrollOffset |
| int | myVisibleScrollItems |
| double | myActionFlash |
| bool | myCloseOnSelection |
| int | myLineHeight |
| DtMenuAttributeObserver * | myElementGenerator |
| 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 } |
| makVre::DtActionInputMenu::DtActionInputMenu | ( | DtMenuManager & | mgr | ) |
Constructor.
| mgr | Reference 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.
|
overridevirtual |
Virtual destructor.
Ensures proper cleanup of derived input menu classes.
|
virtual |
Sets the current input text.
| input | The 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.
|
virtual |
Gets the current input text.
Retrieves the text currently entered in the input field.
|
virtual |
Sets the input validator function.
| validator | The 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.
|
virtual |
Gets the current input validator.
Retrieves the validator function currently being used to validate input.
|
virtual |
Sets the action type for this input menu.
| actionType | The 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().
|
virtual |
Gets the current action type.
Retrieves the action type that will be sent when input is completed.
Referenced by setActionType().
|
virtual |
Sets the default string to use when input is empty.
| defaultString | The 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().
|
virtual |
Gets the current default string.
Retrieves the default string that will be used for empty input.
Referenced by setDefaultString().
|
overridevirtual |
Handles selection of the input menu.
| val | Input 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.
|
overridevirtual |
Sets the active state of the input menu.
| active | True to activate the menu, false to deactivate |
| saveSelection | Whether to save the current selection state |
| closeOnElementSelected | Whether 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.
|
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.
|
protectedvirtual |
Handles raw input data for text entry.
| inputData | The input data event to process |
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.
|
protectedvirtual |
Adds a character to the input text.
| key | The 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.
|
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.
|
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.
|
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.
|
protected |
Current input text string.
Stores the text currently entered by the user.
|
protected |
Action type identifier for this input menu.
The action type that will be sent when the user completes their input. Default is "InputMenuAccept".
|
protected |
Validator function for input validation.
Function delegate used to validate input text against format requirements.
|
protected |
Menu element that displays the input text.
The menu element used to display the current input text to the user.
|
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.