MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / FindControlInfo

Method FindControlInfo

Source/HelpDisplay.cpp:303–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303HelpDisplay::UIControlTooltipInfo* HelpDisplay::FindControlInfo(IUIControl* control)
304{
305 ModuleTooltipInfo* moduleInfo = nullptr;
306 IDrawableModule* parent = dynamic_cast<IDrawableModule*>(control->GetParent());
307 if (parent != nullptr)
308 moduleInfo = FindModuleInfo(parent->GetTypeName());
309 if (moduleInfo)
310 {
311 std::string controlName = control->Name();
312 for (auto& info : moduleInfo->controlTooltips)
313 {
314 if (StringMatch(info.controlName, controlName))
315 return &info;
316 }
317 }
318
319 //didn't find it, try again with the "module parent"
320 parent = control->GetModuleParent();
321 if (parent != nullptr)
322 moduleInfo = FindModuleInfo(parent->GetTypeName());
323 if (moduleInfo)
324 {
325 std::string controlName = control->Name();
326 for (auto& info : moduleInfo->controlTooltips)
327 {
328 if (StringMatch(info.controlName, controlName))
329 return &info;
330 }
331 }
332
333 return nullptr;
334}
335
336std::string HelpDisplay::GetUIControlTooltip(IUIControl* control)
337{

Callers

nothing calls this directly

Calls 5

StringMatchFunction · 0.85
GetParentMethod · 0.80
GetTypeNameMethod · 0.80
GetModuleParentMethod · 0.80
NameMethod · 0.45

Tested by

no test coverage detected