MCPcopy Create free account
hub / github.com/Kitware/VTK / AddTooltipForInput

Method AddTooltipForInput

Rendering/VR/vtkVRInteractorStyle.cxx:1067–1136  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1065
1066//------------------------------------------------------------------------------
1067void vtkVRInteractorStyle::AddTooltipForInput(
1068 vtkEventDataDevice device, vtkEventDataDeviceInput input, const std::string& text)
1069{
1070 int iInput = static_cast<int>(input);
1071 int iDevice = static_cast<int>(device);
1072
1073 std::string controlName;
1074 std::string controlText;
1075 int drawSide = -1;
1076 int buttonSide = -1;
1077
1078 // Setup default text and layout
1079 switch (input)
1080 {
1081 case vtkEventDataDeviceInput::Trigger:
1082 controlName = "trigger";
1083 drawSide = vtkVRControlsHelper::Left;
1084 buttonSide = vtkVRControlsHelper::Back;
1085 controlText = "Trigger :\n";
1086 break;
1087 case vtkEventDataDeviceInput::TrackPad:
1088 controlName = "trackpad";
1089 drawSide = vtkVRControlsHelper::Right;
1090 buttonSide = vtkVRControlsHelper::Front;
1091 controlText = "Trackpad :\n";
1092 break;
1093 case vtkEventDataDeviceInput::Grip:
1094 controlName = "lgrip";
1095 drawSide = vtkVRControlsHelper::Right;
1096 buttonSide = vtkVRControlsHelper::Back;
1097 controlText = "Grip :\n";
1098 break;
1099 case vtkEventDataDeviceInput::ApplicationMenu:
1100 controlName = "button";
1101 drawSide = vtkVRControlsHelper::Left;
1102 buttonSide = vtkVRControlsHelper::Front;
1103 controlText = "Application Menu :\n";
1104 break;
1105 default:
1106 vtkWarningMacro(<< "AddTooltipForInput: unknown input type " << static_cast<int>(input));
1107 break;
1108 }
1109
1110 controlText += text;
1111
1112 // Clean already existing helpers
1113 if (this->ControlsHelpers[iDevice][iInput] != nullptr)
1114 {
1115 if (this->CurrentRenderer)
1116 {
1117 this->CurrentRenderer->RemoveViewProp(this->ControlsHelpers[iDevice][iInput]);
1118 }
1119 this->ControlsHelpers[iDevice][iInput]->Delete();
1120 this->ControlsHelpers[iDevice][iInput] = nullptr;
1121 }
1122
1123 // Create an input helper and add it to the renderer
1124 vtkVRControlsHelper* inputHelper = this->MakeControlsHelper();

Callers

nothing calls this directly

Calls 9

MakeControlsHelperMethod · 0.80
DeleteMethod · 0.65
RemoveViewPropMethod · 0.45
SetTooltipInfoMethod · 0.45
c_strMethod · 0.45
SetDeviceMethod · 0.45
SetRendererMethod · 0.45
BuildRepresentationMethod · 0.45
AddViewPropMethod · 0.45

Tested by

no test coverage detected